Skip to content

Commit

Permalink
Move tab_list_ui/ code into its own DFM
Browse files Browse the repository at this point in the history
BUG=925126

(cherry picked from commit 02d5848947400d769890ab3bfdf8eb66cd731c4e)

Change-Id: I7e0f676f4e9e332945d70bedcbcb6f84665a3c80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1475881
Reviewed-by: Tommy Nyquist <[email protected]>
Reviewed-by: Ilya Sherman <[email protected]>
Reviewed-by: Ted Choc <[email protected]>
Reviewed-by: Theresa <[email protected]>
Reviewed-by: Tibor Goldschwendt <[email protected]>
Commit-Queue: Yusuf Ozuysal <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#639609}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1519092
Reviewed-by: Yusuf Ozuysal <[email protected]>
Cr-Commit-Position: refs/branch-heads/3729@{#62}
Cr-Branched-From: d4a8972-refs/heads/master@{#638880}
  • Loading branch information
Yusuf Ozuysal authored and Yusuf Ozuysal committed Mar 12, 2019
1 parent 603ef46 commit c0b9245
Show file tree
Hide file tree
Showing 53 changed files with 498 additions and 214 deletions.
28 changes: 27 additions & 1 deletion chrome/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import("//build/config/python.gni")
import("//build/util/process_version.gni")
import("//chrome/android/chrome_common_shared_library.gni")
import("//chrome/android/chrome_public_apk_tmpl.gni")
import("//chrome/android/features/tab_ui/tab_management_java_sources.gni")
import("//chrome/android/features/tab_ui/tab_ui_module_tmpl.gni")
import("//chrome/android/features/vr/public_vr_java_sources.gni")
import("//chrome/android/feed/feed_java_sources.gni")
import("//chrome/android/monochrome_android_manifest_jinja_variables.gni")
Expand Down Expand Up @@ -420,6 +422,9 @@ android_library("chrome_java") {

java_files += public_vr_java_sources

# Include sources from public_tab_management_java_sources.gni.
java_files += public_tab_management_java_sources

if (enable_vr) {
deps += [
":chrome_vr_java_resources",
Expand Down Expand Up @@ -585,6 +590,7 @@ junit_binary("chrome_junit_tests") {
"//base:base_java",
"//base:base_java_test_support",
"//base:base_junit_test_support",
"//chrome/android/features/tab_ui:java",
"//chrome/android/webapk/libs/client:client_java",
"//chrome/android/webapk/libs/common:common_java",
"//chrome/android/webapk/test:junit_test_support",
Expand Down Expand Up @@ -687,6 +693,7 @@ android_library("chrome_test_java") {
"//base:base_java_test_support",
"//chrome/android:app_hooks_java",
"//chrome/android:chrome_java",
"//chrome/android/features/tab_ui:java",
"//chrome/android/third_party/compositor_animator:compositor_animator_java",
"//chrome/android/webapk/libs/client:client_java",
"//chrome/android/webapk/libs/common:common_java",
Expand Down Expand Up @@ -2033,6 +2040,19 @@ template("monochrome_public_bundle_tmpl") {
}
}

tab_ui_module_tmpl("${target_name}__tab_ui_bundle_module") {
manifest_package = manifest_package
module_name = "TabUiMonochromePublic"
base_module_target = ":$_base_module_target_name"
if (_is_trichrome) {
version_code = trichrome_version_code
} else {
version_code = monochrome_version_code
}
version_name = chrome_version_name
uncompress_shared_libraries = true
}

android_app_bundle(target_name) {
if (_is_trichrome) {
add_native_lib_placeholders_for_base_module = true
Expand All @@ -2049,7 +2069,7 @@ template("monochrome_public_bundle_tmpl") {

extra_modules = []
if (modularize_ar) {
extra_modules = [
extra_modules += [
{
name = "ar"
module_target = ":${target_name}__ar_bundle_module"
Expand All @@ -2064,6 +2084,12 @@ template("monochrome_public_bundle_tmpl") {
},
]
}
extra_modules += [
{
name = "tab_ui"
module_target = ":${target_name}__tab_ui_bundle_module"
},
]
}
}

Expand Down
1 change: 1 addition & 0 deletions chrome/android/features/module_names_to_package_ids.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
resource_packages_id_mapping = [
"ar=0x7e",
"vr=0x7d",
"tab_ui=0x7c",
]
21 changes: 21 additions & 0 deletions chrome/android/features/tab_ui/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
featureSplit="tab_ui"
package="{{manifest_package}}">

<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="{{target_sdk_version}}" />
<application></application>
<dist:module
dist:onDemand="true"
dist:title="@string/tab_management_module_title">
<dist:fusing dist:include="false" />
</dist:module>
</manifest>

58 changes: 58 additions & 0 deletions chrome/android/features/tab_ui/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/android/rules.gni")
import("//chrome/common/features.gni")

android_library("java") {
java_files = [
"java/src/org/chromium/chrome/browser/tasks/tab_groups/TabGroupUtils.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridContainerViewBinder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetMediator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetContent.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetProperties.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetToolbarCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridSheetViewBinder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewBinder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridViewHolder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiToolbarView.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiToolbarViewBinder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabListContainerProperties.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabListCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabListMediator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabListModel.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabListRecyclerView.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabManagementModuleImpl.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabProperties.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabStripToolbarCoordinator.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabStripToolbarViewProperties.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabStripViewBinder.java",
"java/src/org/chromium/chrome/browser/tasks/tab_management/TabStripViewHolder.java",
]

classpath_deps = [
"//base:base_java",
"//chrome/android:chrome_java",
"//chrome/android:chrome_strings_grd",
"//chrome/android:ui_locale_string_resources",
"//chrome/app:java_strings_grd",
"//components/feature_engagement:feature_engagement_java",
"//components/policy/android:policy_java",
"//content/public/android:content_java_resources",
"//content/public/android:content_java",
"//third_party/android_deps:android_arch_lifecycle_common_java",
"//third_party/android_deps:android_arch_lifecycle_runtime_java",
"//third_party/android_deps:android_support_annotations_java",
"//third_party/android_deps:android_support_compat_java",
"//third_party/android_deps:android_support_v13_java",
"//third_party/android_deps:android_support_v7_appcompat_java",
"//third_party/android_deps:android_support_v7_recyclerview_java",
"//ui/android:ui_java",
]
}
6 changes: 6 additions & 0 deletions chrome/android/features/tab_ui/java/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include_rules = [
"+components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement",
"+components/module_installer",

"+content/public/android/java/src/org/chromium/content_public/browser",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tasks.tab_management;

import org.chromium.chrome.browser.compositor.layouts.OverviewModeController;

/**
* Interface for the Grid Tab Switcher.
*/
public interface GridTabSwitcher { OverviewModeController getOverviewModeController(); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tasks.tab_list_ui;
package org.chromium.chrome.browser.tasks.tab_management;

import android.content.Context;

Expand All @@ -26,7 +26,7 @@
* Parent coordinator that is responsible for showing a grid of tabs for the main TabSwitcher UI.
*/
public class GridTabSwitcherCoordinator
implements Destroyable, GridTabSwitcherMediator.ResetHandler {
implements Destroyable, GridTabSwitcher, GridTabSwitcherMediator.ResetHandler {
private final PropertyModelChangeProcessor mContainerViewChangeProcessor;
private final ActivityLifecycleDispatcher mLifecycleDispatcher;
private final TabListCoordinator mTabGridCoordinator;
Expand Down Expand Up @@ -55,6 +55,7 @@ public GridTabSwitcherCoordinator(Context context,
* @return OverviewModeController implementation that will can be used for controlling
* OverviewMode changes.
*/
@Override
public OverviewModeController getOverviewModeController() {
return mMediator;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tasks.tab_list_ui;
package org.chromium.chrome.browser.tasks.tab_management;

import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.BOTTOM_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.INITIAL_SCROLL_INDEX;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.IS_INCOGNITO;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.IS_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.VISIBILITY_LISTENER;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.BOTTOM_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.INITIAL_SCROLL_INDEX;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_INCOGNITO;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER;

import org.chromium.chrome.browser.compositor.layouts.OverviewModeController;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
Expand Down Expand Up @@ -101,7 +101,6 @@ public void onTabModelSelected(TabModel newModel, TabModel oldModel) {
mTabModelSelector.addObserver(mTabModelSelectorObserver);

mTabModelObserver = new TabModelSelectorTabModelObserver(mTabModelSelector) {

@Override
public void didSelectTab(Tab tab, int type, int lastId) {
if (type == TabSelectionType.FROM_CLOSE || mShouldIgnoreNextSelect) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tasks.tab_management;

import org.chromium.chrome.R;

/**
* Hacky class to avoid lint errors for resources called on the module.
*/
/* package */ class SilenceLintErrors {
// TODO(yusufo): Add these resources to the DFM
private int[] mRes =
new int[] {R.dimen.tab_grid_favicon_size, R.string.tab_management_module_title,
R.string.iph_tab_groups_quickly_compare_pages_text,
R.string.iph_tab_groups_tap_to_see_another_tab_text,
R.string.iph_tab_groups_your_tabs_together_text,
R.string.bottom_tab_grid_description, R.string.bottom_tab_grid_opened_half,
R.string.bottom_tab_grid_opened_full, R.string.bottom_tab_grid_closed,
R.dimen.tab_list_selected_inset, R.layout.tab_strip_item,
R.drawable.selected_tab_background, R.drawable.tab_grid_card_background,
R.layout.tab_grid_card_item, R.layout.tab_list_recycler_view_layout,
R.layout.bottom_tab_grid_toolbar, R.string.bottom_tab_grid_new_tab,
R.string.bottom_tab_grid_new_tab, R.plurals.bottom_tab_grid_title_placeholder,
R.string.iph_tab_groups_tap_to_see_another_tab_accessibility_text,
R.string.accessibility_bottom_tab_strip_expand_tab_sheet,
R.layout.bottom_tab_strip_toolbar};

private SilenceLintErrors() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tasks.tab_list_ui;
package org.chromium.chrome.browser.tasks.tab_management;

import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.BOTTOM_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.INITIAL_SCROLL_INDEX;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.IS_INCOGNITO;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.IS_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_list_ui.TabListContainerProperties.VISIBILITY_LISTENER;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.BOTTOM_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.INITIAL_SCROLL_INDEX;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_INCOGNITO;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.IS_VISIBLE;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER;

import android.widget.FrameLayout;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.tasks.tab_list_ui;
package org.chromium.chrome.browser.tasks.tab_management;

import android.view.View;

Expand All @@ -11,16 +11,16 @@
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.ContentPriority;

/** A {@link BottomSheetContent} that displays tab grid. **/
public class BottomTabGridSheetContent implements BottomSheetContent {
public class TabGridSheetContent implements BottomSheetContent {
private final TabListRecyclerView mRecyclerView;
private final View mToolbarView;

/**
* Construct a new {@link BottomTabGridSheetContent}.
* Construct a new {@link TabGridSheetContent}.
* @param recyclerView The {@link TabListRecyclerView} holding the tab grid.
* @param toolbarView The toolbar {@link View} to use.}
*/
BottomTabGridSheetContent(TabListRecyclerView recyclerView, View toolbarView) {
TabGridSheetContent(TabListRecyclerView recyclerView, View toolbarView) {
mRecyclerView = recyclerView;
mToolbarView = toolbarView;
}
Expand Down
Loading

0 comments on commit c0b9245

Please sign in to comment.