Commit 9f582f34 authored by Mei Liang's avatar Mei Liang Committed by Commit Bot

Migrate RootUiCoordinator to use LayoutStateObserver

Change-Id: Id164d3564d3fec41d3c1014d9282e5989b33f8b3
Bug: 1108496
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2491444
Commit-Queue: Mei Liang <meiliang@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821879}
parent f99ef034
......@@ -1475,7 +1475,8 @@ public class ChromeTabbedActivity extends ChromeActivity<ChromeActivityComponent
getActivityTabProvider(), mEphemeralTabCoordinatorSupplier,
mTabModelProfileSupplier, mBookmarkBridgeSupplier,
getOverviewModeBehaviorSupplier(), this::getContextualSearchManager,
mTabModelSelectorSupplier, mStartSurfaceSupplier);
mTabModelSelectorSupplier, mStartSurfaceSupplier,
mLayoutStateProviderOneshotSupplier);
}
@Override
......
......@@ -390,7 +390,7 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
return new RootUiCoordinator(this, null, getShareDelegateSupplier(),
getActivityTabProvider(), mTabModelProfileSupplier, mBookmarkBridgeSupplier,
getOverviewModeBehaviorSupplier(), this::getContextualSearchManager,
mTabModelSelectorSupplier, new OneshotSupplierImpl<>(),
mTabModelSelectorSupplier, new OneshotSupplierImpl<>(), new OneshotSupplierImpl<>(),
new OneshotSupplierImpl<>());
}
......
......@@ -20,8 +20,6 @@ import androidx.browser.customtabs.CustomTabsIntent;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.OneshotSupplierImpl;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.KeyboardShortcuts;
......@@ -29,7 +27,6 @@ import org.chromium.chrome.browser.app.ChromeActivity;
import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider;
import org.chromium.chrome.browser.browserservices.ui.controller.Verifier;
import org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.TrustedWebActivityCoordinator;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController;
import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabController;
import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabFactory;
......@@ -79,8 +76,6 @@ public abstract class BaseCustomTabActivity extends ChromeActivity<BaseCustomTab
protected @Nullable WebappActivityCoordinator mWebappActivityCoordinator;
protected @Nullable TrustedWebActivityCoordinator mTwaCoordinator;
protected Verifier mVerifier;
private OneshotSupplier<OverviewModeBehavior> mOverviewModeBehaviorSupplier =
new OneshotSupplierImpl<>();
// This is to give the right package name while using the client's resources during an
// overridePendingTransition call.
......@@ -151,9 +146,7 @@ public abstract class BaseCustomTabActivity extends ChromeActivity<BaseCustomTab
()
-> mNavigationController,
getActivityTabProvider(), mTabModelProfileSupplier, mBookmarkBridgeSupplier,
mOverviewModeBehaviorSupplier, this::getContextualSearchManager,
mTabModelSelectorSupplier, new OneshotSupplierImpl<>(),
new OneshotSupplierImpl<>());
this::getContextualSearchManager, mTabModelSelectorSupplier);
}
@Override
......
......@@ -6,24 +6,21 @@ package org.chromium.chrome.browser.customtabs;
import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.base.supplier.OneShotCallback;
import org.chromium.base.supplier.OneshotSupplier;
import org.chromium.base.supplier.OneshotSupplierImpl;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.browser.ActivityTabProvider;
import org.chromium.chrome.browser.app.ChromeActivity;
import org.chromium.chrome.browser.app.reengagement.ReengagementActivity;
import org.chromium.chrome.browser.bookmarks.BookmarkBridge;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager;
import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController;
import org.chromium.chrome.browser.customtabs.features.toolbar.CustomTabToolbarCoordinator;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.intent.IntentMetadata;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.reengagement.ReengagementNotificationController;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.ui.RootUiCoordinator;
import org.chromium.chrome.features.start_surface.StartSurface;
import org.chromium.components.feature_engagement.Tracker;
/**
......@@ -39,15 +36,13 @@ public class BaseCustomTabRootUiCoordinator extends RootUiCoordinator {
Supplier<CustomTabActivityNavigationController> customTabNavigationController,
ActivityTabProvider tabProvider, ObservableSupplier<Profile> profileSupplier,
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier,
OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
Supplier<ContextualSearchManager> contextualSearchManagerSupplier,
ObservableSupplier<TabModelSelector> tabModelSelectorSupplier,
OneshotSupplier<StartSurface> startSurfaceSupplier,
OneshotSupplier<IntentMetadata> intentMetadataOneshotSupplier) {
ObservableSupplier<TabModelSelector> tabModelSelectorSupplier) {
super(activity, null, shareDelegateSupplier, tabProvider, profileSupplier,
bookmarkBridgeSupplier, overviewModeBehaviorSupplier,
contextualSearchManagerSupplier, tabModelSelectorSupplier, startSurfaceSupplier,
intentMetadataOneshotSupplier);
bookmarkBridgeSupplier, new OneshotSupplierImpl<>(),
contextualSearchManagerSupplier, tabModelSelectorSupplier,
new OneshotSupplierImpl<>(), new OneshotSupplierImpl<>(),
new OneshotSupplierImpl<>());
mToolbarCoordinator = customTabToolbarCoordinator;
mNavigationController = customTabNavigationController;
}
......
......@@ -37,6 +37,7 @@ import org.chromium.chrome.browser.gesturenav.TabbedSheetDelegate;
import org.chromium.chrome.browser.history.HistoryManagerUtils;
import org.chromium.chrome.browser.intent.IntentMetadata;
import org.chromium.chrome.browser.language.LanguageAskPrompt;
import org.chromium.chrome.browser.layouts.LayoutStateProvider;
import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
import org.chromium.chrome.browser.offlinepages.indicator.OfflineIndicatorControllerV2;
......@@ -98,6 +99,7 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator {
* @param overviewModeBehaviorSupplier Supplier of the overview mode manager.
* @param contextualSearchManagerSupplier Supplier of the {@link ContextualSearchManager}.
* @param startSurfaceSupplier Supplier of the {@link StartSurface}.
* @param layoutStateProviderOneshotSupplier Supplier of the {@link LayoutStateProvider}.
*/
public TabbedRootUiCoordinator(ChromeActivity activity,
Callback<Boolean> onOmniboxFocusChangedListener,
......@@ -110,11 +112,12 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator {
OneshotSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier,
Supplier<ContextualSearchManager> contextualSearchManagerSupplier,
ObservableSupplier<TabModelSelector> tabModelSelectorSupplier,
OneshotSupplier<StartSurface> startSurfaceSupplier) {
OneshotSupplier<StartSurface> startSurfaceSupplier,
OneshotSupplier<LayoutStateProvider> layoutStateProviderOneshotSupplier) {
super(activity, onOmniboxFocusChangedListener, shareDelegateSupplier, tabProvider,
profileSupplier, bookmarkBridgeSupplier, overviewModeBehaviorSupplier,
contextualSearchManagerSupplier, tabModelSelectorSupplier, startSurfaceSupplier,
intentMetadataOneshotSupplier);
intentMetadataOneshotSupplier, layoutStateProviderOneshotSupplier);
mEphemeralTabCoordinatorSupplier = ephemeralTabCoordinatorSupplier;
mCanAnimateBrowserControls = () -> {
// These null checks prevent any exceptions that may be caused by callbacks after
......
......@@ -172,7 +172,8 @@ public class ShareIntentTest {
return new RootUiCoordinator(mockActivity, null,
mockActivity.getShareDelegateSupplier(), mockActivity.getActivityTabProvider(),
null, null, mockActivity.getOverviewModeBehaviorSupplier(), null, null,
new OneshotSupplierImpl<>(), new OneshotSupplierImpl<>());
new OneshotSupplierImpl<>(), new OneshotSupplierImpl<>(),
new OneshotSupplierImpl<>());
});
ShareHelper.setLastShareComponentName(new ComponentName("test.package", "test.activity"));
// Skips the capture of screenshot and notifies with an empty file.
......
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