Commit eb5d58fa authored by Michele Mancina's avatar Michele Mancina Committed by Commit Bot

Switching ActivityTabTabObservers to use the new method

Bug: b/159308598
Change-Id: Ic067a1a60cb5a202daa5f21d9f909d9b5f3b1486
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375427
Commit-Queue: Michele Mancina <micantox@google.com>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801733}
parent 715f82f7
...@@ -132,7 +132,7 @@ public class AutofillAssistantUiController { ...@@ -132,7 +132,7 @@ public class AutofillAssistantUiController {
mActivityTabObserver = mActivityTabObserver =
new ActivityTabProvider.ActivityTabTabObserver(activity.getActivityTabProvider()) { new ActivityTabProvider.ActivityTabTabObserver(activity.getActivityTabProvider()) {
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
if (mWebContents == null) return; if (mWebContents == null) return;
if (!allowTabSwitching) { if (!allowTabSwitching) {
......
...@@ -93,7 +93,6 @@ public class ActivityTabProvider implements Supplier<Tab> { ...@@ -93,7 +93,6 @@ public class ActivityTabProvider implements Supplier<Tab> {
mActivityTabObserver = (tab, hint) -> { mActivityTabObserver = (tab, hint) -> {
updateObservedTab(tab); updateObservedTab(tab);
onObservingDifferentTab(tab, hint); onObservingDifferentTab(tab, hint);
onObservingDifferentTab(tab);
}; };
if (shouldTrigger) { if (shouldTrigger) {
mTabProvider.addObserverAndTrigger(mActivityTabObserver); mTabProvider.addObserverAndTrigger(mActivityTabObserver);
...@@ -113,14 +112,6 @@ public class ActivityTabProvider implements Supplier<Tab> { ...@@ -113,14 +112,6 @@ public class ActivityTabProvider implements Supplier<Tab> {
if (mTab != null) mTab.addObserver(ActivityTabTabObserver.this); if (mTab != null) mTab.addObserver(ActivityTabTabObserver.this);
} }
/**
* A notification that the observer has switched to observing a different tab.
* @param tab The tab that the observer is now observing. This can be null.
* @deprecated Use {@link #onObservingDifferentTab(Tab, boolean)} instead.
*/
@Deprecated
protected void onObservingDifferentTab(Tab tab) {}
/** /**
* A notification that the observer has switched to observing a different tab. This can be * A notification that the observer has switched to observing a different tab. This can be
* called a first time with the {@code hint} parameter set to true, indicating that a new * called a first time with the {@code hint} parameter set to true, indicating that a new
......
...@@ -66,7 +66,7 @@ public class ChromeActionModeHandler { ...@@ -66,7 +66,7 @@ public class ChromeActionModeHandler {
mActivityTabTabObserver = mActivityTabTabObserver =
new ActivityTabProvider.ActivityTabTabObserver(activityTabProvider) { new ActivityTabProvider.ActivityTabTabObserver(activityTabProvider) {
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
// ActivityTabProvider will null out the tab passed to // ActivityTabProvider will null out the tab passed to
// onObservingDifferentTab when the tab is non-interactive (e.g. when // onObservingDifferentTab when the tab is non-interactive (e.g. when
// entering the TabSwitcher), but in those cases we actually still want to // entering the TabSwitcher), but in those cases we actually still want to
......
...@@ -25,7 +25,7 @@ public class TabThemeColorProvider extends ThemeColorProvider { ...@@ -25,7 +25,7 @@ public class TabThemeColorProvider extends ThemeColorProvider {
public void setActivityTabProvider(ActivityTabProvider provider) { public void setActivityTabProvider(ActivityTabProvider provider) {
mActivityTabTabObserver = new ActivityTabTabObserver(provider) { mActivityTabTabObserver = new ActivityTabTabObserver(provider) {
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
if (tab == null) return; if (tab == null) return;
updatePrimaryColor(TabThemeColorHelper.getColor(tab), false); updatePrimaryColor(TabThemeColorHelper.getColor(tab), false);
} }
......
...@@ -184,7 +184,7 @@ public class BrowserControlsManager ...@@ -184,7 +184,7 @@ public class BrowserControlsManager
ApplicationStatus.registerStateListenerForActivity(this, mActivity); ApplicationStatus.registerStateListenerForActivity(this, mActivity);
mActiveTabObserver = new ActivityTabTabObserver(activityTabProvider) { mActiveTabObserver = new ActivityTabTabObserver(activityTabProvider) {
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
setTab(tab); setTab(tab);
} }
}; };
......
...@@ -209,7 +209,7 @@ public class FullscreenHtmlApiHandler implements ActivityStateListener, WindowFo ...@@ -209,7 +209,7 @@ public class FullscreenHtmlApiHandler implements ActivityStateListener, WindowFo
ApplicationStatus.registerWindowFocusChangedListener(this); ApplicationStatus.registerWindowFocusChangedListener(this);
mActiveTabObserver = new ActivityTabTabObserver(activityTabProvider) { mActiveTabObserver = new ActivityTabTabObserver(activityTabProvider) {
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
mTab = tab; mTab = tab;
setContentView(tab != null ? tab.getContentView() : null); setContentView(tab != null ? tab.getContentView() : null);
if (tab != null) updateMultiTouchZoomSupport(!getPersistentFullscreenMode()); if (tab != null) updateMultiTouchZoomSupport(!getPersistentFullscreenMode());
......
...@@ -115,7 +115,7 @@ public class HistoryNavigationCoordinator ...@@ -115,7 +115,7 @@ public class HistoryNavigationCoordinator
mActivityTabObserver = new ActivityTabProvider.ActivityTabTabObserver(tabProvider) { mActivityTabObserver = new ActivityTabProvider.ActivityTabTabObserver(tabProvider) {
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
if (mTab != null && mTab.isInitialized()) { if (mTab != null && mTab.isInitialized()) {
SwipeRefreshHandler.from(mTab).setNavigationCoordinator(null); SwipeRefreshHandler.from(mTab).setNavigationCoordinator(null);
} }
......
...@@ -373,7 +373,7 @@ class AutocompleteMediator implements OnSuggestionsReceivedListener, StartStopWi ...@@ -373,7 +373,7 @@ class AutocompleteMediator implements OnSuggestionsReceivedListener, StartStopWi
} }
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
if (tab == null) return; if (tab == null) return;
maybeTriggerCacheRefresh(tab.getUrlString()); maybeTriggerCacheRefresh(tab.getUrlString());
} }
......
...@@ -20,7 +20,7 @@ public class AccessibilityVisibilityHandler implements Destroyable { ...@@ -20,7 +20,7 @@ public class AccessibilityVisibilityHandler implements Destroyable {
ActivityTabProvider activityTabProvider, TabObscuringHandler tabObscuringHandler) { ActivityTabProvider activityTabProvider, TabObscuringHandler tabObscuringHandler) {
mActivityTabObserver = new ActivityTabProvider.ActivityTabTabObserver(activityTabProvider) { mActivityTabObserver = new ActivityTabProvider.ActivityTabTabObserver(activityTabProvider) {
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
if (mTab == tab) return; if (mTab == tab) return;
TabImpl tabImpl = (TabImpl) tab; TabImpl tabImpl = (TabImpl) tab;
......
...@@ -167,7 +167,7 @@ public class HomeButton extends ChromeImageButton ...@@ -167,7 +167,7 @@ public class HomeButton extends ChromeImageButton
mActivityTabProvider = activityTabProvider; mActivityTabProvider = activityTabProvider;
mActivityTabTabObserver = new ActivityTabTabObserver(activityTabProvider) { mActivityTabTabObserver = new ActivityTabTabObserver(activityTabProvider) {
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
if (tab == null) return; if (tab == null) return;
updateButtonEnabledState(tab); updateButtonEnabledState(tab);
} }
......
...@@ -353,7 +353,7 @@ public class ToolbarManager implements UrlFocusChangeListener, ThemeColorObserve ...@@ -353,7 +353,7 @@ public class ToolbarManager implements UrlFocusChangeListener, ThemeColorObserve
mActivityTabTabObserver = new ActivityTabProvider.ActivityTabTabObserver( mActivityTabTabObserver = new ActivityTabProvider.ActivityTabTabObserver(
mActivityTabProvider) { mActivityTabProvider) {
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
// ActivityTabProvider will null out the tab passed to onObservingDifferentTab when // ActivityTabProvider will null out the tab passed to onObservingDifferentTab when
// the tab is non-interactive (e.g. when entering the TabSwitcher), but in those // the tab is non-interactive (e.g. when entering the TabSwitcher), but in those
// cases we actually still want to use the most recently selected tab. // cases we actually still want to use the most recently selected tab.
......
...@@ -59,7 +59,7 @@ class ShareButton extends ChromeImageButton implements TintObserver { ...@@ -59,7 +59,7 @@ class ShareButton extends ChromeImageButton implements TintObserver {
void setActivityTabProvider(ActivityTabProvider activityTabProvider) { void setActivityTabProvider(ActivityTabProvider activityTabProvider) {
mActivityTabTabObserver = new ActivityTabTabObserver(activityTabProvider) { mActivityTabTabObserver = new ActivityTabTabObserver(activityTabProvider) {
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
updateButtonEnabledState(tab); updateButtonEnabledState(tab);
} }
......
...@@ -85,7 +85,7 @@ public class LoadProgressMediator { ...@@ -85,7 +85,7 @@ public class LoadProgressMediator {
} }
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
onNewTabObserved(tab); onNewTabObserved(tab);
} }
}; };
......
...@@ -152,7 +152,7 @@ public class StatusBarColorController ...@@ -152,7 +152,7 @@ public class StatusBarColorController
} }
@Override @Override
protected void onObservingDifferentTab(Tab tab) { protected void onObservingDifferentTab(Tab tab, boolean hint) {
mCurrentTab = tab; mCurrentTab = tab;
mShouldUpdateStatusBarColorForNTP = isStandardNTP(); mShouldUpdateStatusBarColorForNTP = isStandardNTP();
......
...@@ -58,7 +58,7 @@ public class ActivityTabProviderTest { ...@@ -58,7 +58,7 @@ public class ActivityTabProviderTest {
} }
@Override @Override
public void onObservingDifferentTab(Tab tab) { public void onObservingDifferentTab(Tab tab, boolean hint) {
mObservedTab = tab; mObservedTab = tab;
mObserverMoveHelper.notifyCalled(); mObserverMoveHelper.notifyCalled();
} }
......
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