Commit ccf157fb authored by gogerald's avatar gogerald Committed by Commit Bot

[StartSurface] Remove unused code from TabSwitcherModeTT*

StartSurfaceToolbar* is used when start surface is enabled right now.

Bug: 990600
Change-Id: Ib63ae8423c1027cacd27d88179a451f014055f79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094713Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Commit-Queue: Ganggui Tang <gogerald@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751763}
parent 50e42dd8
......@@ -11,10 +11,8 @@ import android.view.ViewStub;
import androidx.annotation.Nullable;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.incognito.IncognitoUtils;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabCreationState;
import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver;
......@@ -25,15 +23,13 @@ import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.browser.toolbar.IncognitoStateProvider;
import org.chromium.chrome.browser.toolbar.TabCountProvider;
import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper;
import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration;
import org.chromium.components.search_engines.TemplateUrlService.TemplateUrlServiceObserver;
/**
* The coordinator for the tab switcher mode top toolbar shown on phones, responsible for
* communication with other UI components and lifecycle. Lazily creates the tab
* switcher mode top toolbar the first time it's needed.
*/
class TabSwitcherModeTTCoordinatorPhone implements TemplateUrlServiceObserver {
class TabSwitcherModeTTCoordinatorPhone {
private final ViewStub mTabSwitcherToolbarStub;
// TODO(twellington): Create a model to hold all of these properties. Consider using
......@@ -50,10 +46,6 @@ class TabSwitcherModeTTCoordinatorPhone implements TemplateUrlServiceObserver {
private TabSwitcherModeTTPhone mTabSwitcherModeToolbar;
@Nullable
private IncognitoSwitchCoordinator mIncognitoSwitchCoordinator;
@Nullable
private View mLogo;
@Nullable
private TabModelObserver mTabModelObserver;
......@@ -69,25 +61,11 @@ class TabSwitcherModeTTCoordinatorPhone implements TemplateUrlServiceObserver {
mTabSwitcherModeToolbar.destroy();
mTabSwitcherModeToolbar = null;
}
if (mIncognitoSwitchCoordinator != null) {
mIncognitoSwitchCoordinator.destroy();
mIncognitoSwitchCoordinator = null;
}
if (StartSurfaceConfiguration.isStartSurfaceEnabled()) {
TemplateUrlServiceFactory.get().removeObserver(this);
}
if (mTabModelSelector != null && mTabModelObserver != null) {
mTabModelSelector.getModel(true).removeObserver(mTabModelObserver);
}
}
@Override
public void onTemplateURLServiceChanged() {
mLogo.setVisibility(
(TemplateUrlServiceFactory.get().isDefaultSearchEngineGoogle() ? View.VISIBLE
: View.GONE));
}
/**
* Called when tab switcher mode is entered or exited.
* @param inTabSwitcherMode Whether or not tab switcher mode should be shown or hidden.
......@@ -264,15 +242,6 @@ class TabSwitcherModeTTCoordinatorPhone implements TemplateUrlServiceObserver {
incognitoTabModel.addObserver(mTabModelObserver);
mTabSwitcherModeToolbar.onIncognitoTabsCountChanged(incognitoTabModel.getCount());
}
if (StartSurfaceConfiguration.isStartSurfaceEnabled()) {
mIncognitoSwitchCoordinator =
new IncognitoSwitchCoordinator(mTabSwitcherModeToolbar, mTabModelSelector);
mLogo = mTabSwitcherModeToolbar.findViewById(R.id.logo);
if (TemplateUrlServiceFactory.get().isDefaultSearchEngineGoogle()) {
mLogo.setVisibility(View.VISIBLE);
}
TemplateUrlServiceFactory.get().addObserver(this);
}
assert mIncognitoStateProvider != null;
mTabSwitcherModeToolbar.setIncognitoStateProvider(mIncognitoStateProvider);
......
......@@ -32,7 +32,6 @@ import org.chromium.chrome.browser.toolbar.TabCountProvider;
import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration;
import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarVariationManager;
import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper;
import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration;
import org.chromium.components.browser_ui.styles.ChromeColors;
import org.chromium.components.browser_ui.widget.animation.CancelAwareAnimatorListener;
import org.chromium.components.browser_ui.widget.animation.Interpolators;
......@@ -385,11 +384,6 @@ public class TabSwitcherModeTTPhone extends OptimizedFrameLayout
}
private void setIncognitoToggleVisibility(boolean showIncognitoToggle) {
// If StartSurface is enabled, the incognito switch is shown and handled
// by the IncognitoSwitchCoordinator in the
// TabSwitcherModeTTCoordinatorPhone.
if (StartSurfaceConfiguration.isStartSurfaceEnabled()) return;
if (mIncognitoToggleTabLayout == null) {
if (showIncognitoToggle) inflateIncognitoToggle();
} else {
......
......@@ -1371,9 +1371,6 @@ const FeatureEntry::FeatureParam kStartSurfaceAndroid_SingleSurface[] = {
const FeatureEntry::FeatureParam kStartSurfaceAndroid_TwoPanesSurface[] = {
{"start_surface_variation", "twopanes"}};
const FeatureEntry::FeatureParam kStartSurfaceAndroid_Toolbar[] = {
{"start_surface_variation", "toolbar"}};
const FeatureEntry::FeatureParam kStartSurfaceAndroid_TasksOnly[] = {
{"start_surface_variation", "tasksonly"}};
......@@ -1385,8 +1382,6 @@ const FeatureEntry::FeatureVariation kStartSurfaceAndroidVariations[] = {
base::size(kStartSurfaceAndroid_SingleSurface), nullptr},
{"Two Panes Surface", kStartSurfaceAndroid_TwoPanesSurface,
base::size(kStartSurfaceAndroid_TwoPanesSurface), nullptr},
{"Start Surface Toolbar", kStartSurfaceAndroid_Toolbar,
base::size(kStartSurfaceAndroid_Toolbar), nullptr},
{"Tasks Only", kStartSurfaceAndroid_TasksOnly,
base::size(kStartSurfaceAndroid_TasksOnly), nullptr},
{"Omnibox Only", kStartSurfaceAndroid_OmniboxOnly,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment