Commit 3d1fc225 authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

[multiball] Reparent BrowserViewWrangler.

Just moves ownership of BrowserViewWrangler to SceneController.
It is still created by MainController.

Bug: 1045658
Change-Id: Ie886cf0e54b236e66aa07ffe33be840fac327623
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2084993
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746725}
parent b85d9896
...@@ -328,11 +328,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -328,11 +328,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
BOOL _animationDisabled; BOOL _animationDisabled;
} }
// Wrangler to handle BVC and tab model creation, access, and related logic.
// Implements faetures exposed from this object through the
// BrowserViewInformation protocol.
@property(nonatomic, strong) BrowserViewWrangler* browserViewWrangler;
// The ChromeBrowserState associated with the main (non-OTR) browsing mode. // The ChromeBrowserState associated with the main (non-OTR) browsing mode.
@property(nonatomic, assign) ChromeBrowserState* mainBrowserState; // Weak. @property(nonatomic, assign) ChromeBrowserState* mainBrowserState; // Weak.
...@@ -602,10 +597,10 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -602,10 +597,10 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
// This is per-window code. // This is per-window code.
DCHECK(!self.browserViewWrangler); DCHECK(!self.sceneController.browserViewWrangler);
DCHECK(self.sceneController.appURLLoadingService); DCHECK(self.sceneController.appURLLoadingService);
self.browserViewWrangler = [[BrowserViewWrangler alloc] self.sceneController.browserViewWrangler = [[BrowserViewWrangler alloc]
initWithBrowserState:self.mainBrowserState initWithBrowserState:self.mainBrowserState
webStateListObserver:self.sceneController webStateListObserver:self.sceneController
applicationCommandEndpoint:self.sceneController applicationCommandEndpoint:self.sceneController
...@@ -613,7 +608,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -613,7 +608,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
appURLLoadingService:self.sceneController.appURLLoadingService]; appURLLoadingService:self.sceneController.appURLLoadingService];
// Ensure the main tab model is created. This also creates the BVC. // Ensure the main tab model is created. This also creates the BVC.
[self.browserViewWrangler createMainBrowser]; [self.sceneController.browserViewWrangler createMainBrowser];
// Only create the restoration helper if the browser state was backed up // Only create the restoration helper if the browser state was backed up
// successfully. // successfully.
...@@ -641,7 +636,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -641,7 +636,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
if (postCrashLaunch || switchFromIncognito) { if (postCrashLaunch || switchFromIncognito) {
[self.sceneController clearIOSSpecificIncognitoData]; [self.sceneController clearIOSSpecificIncognitoData];
if (switchFromIncognito) if (switchFromIncognito)
[self.browserViewWrangler [self.sceneController.browserViewWrangler
switchGlobalStateToMode:ApplicationMode::NORMAL]; switchGlobalStateToMode:ApplicationMode::NORMAL];
} }
if (switchFromIncognito) if (switchFromIncognito)
...@@ -650,7 +645,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -650,7 +645,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[self createInitialUI:(startInIncognito ? ApplicationMode::INCOGNITO [self createInitialUI:(startInIncognito ? ApplicationMode::INCOGNITO
: ApplicationMode::NORMAL)]; : ApplicationMode::NORMAL)];
[self.browserViewWrangler updateDeviceSharingManager]; [self.sceneController.browserViewWrangler updateDeviceSharingManager];
if (!self.startupParameters) { if (!self.startupParameters) {
// The startup parameters may create new tabs or navigations. If the restore // The startup parameters may create new tabs or navigations. If the restore
...@@ -728,7 +723,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -728,7 +723,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
#pragma mark - Property implementation. #pragma mark - Property implementation.
- (id<BrowserInterfaceProvider>)interfaceProvider { - (id<BrowserInterfaceProvider>)interfaceProvider {
return self.browserViewWrangler; return self.sceneController.browserViewWrangler;
} }
- (TabGridCoordinator*)mainCoordinator { - (TabGridCoordinator*)mainCoordinator {
...@@ -786,8 +781,8 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -786,8 +781,8 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
// Invariant: The UI is stopped before the model is shutdown. // Invariant: The UI is stopped before the model is shutdown.
DCHECK(!_mainCoordinator); DCHECK(!_mainCoordinator);
[self.browserViewWrangler shutdown]; [self.sceneController.browserViewWrangler shutdown];
self.browserViewWrangler = nil; self.sceneController.browserViewWrangler = nil;
// End of per-window code. // End of per-window code.
...@@ -1211,7 +1206,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1211,7 +1206,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
experimental_flags::AlwaysDisplayFirstRun()) && experimental_flags::AlwaysDisplayFirstRun()) &&
!tests_hook::DisableFirstRun(); !tests_hook::DisableFirstRun();
[self.browserViewWrangler switchGlobalStateToMode:launchMode]; [self.sceneController.browserViewWrangler switchGlobalStateToMode:launchMode];
TabModel* tabModel; TabModel* tabModel;
if (launchMode == ApplicationMode::INCOGNITO) { if (launchMode == ApplicationMode::INCOGNITO) {
...@@ -1536,7 +1531,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1536,7 +1531,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
} }
- (DeviceSharingManager*)deviceSharingManager { - (DeviceSharingManager*)deviceSharingManager {
return [self.browserViewWrangler deviceSharingManager]; return [self.sceneController.browserViewWrangler deviceSharingManager];
} }
- (void)setTabSwitcher:(id<TabSwitcher>)switcher { - (void)setTabSwitcher:(id<TabSwitcher>)switcher {
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#import "ios/chrome/browser/crash_report/crash_restore_helper.h" #import "ios/chrome/browser/crash_report/crash_restore_helper.h"
@class BrowserViewController; @class BrowserViewController;
@class BrowserViewWrangler;
class ChromeBrowserState; class ChromeBrowserState;
@class TabGridCoordinator; @class TabGridCoordinator;
@protocol BrowserInterfaceProvider; @protocol BrowserInterfaceProvider;
...@@ -39,7 +38,6 @@ class ChromeBrowserState; ...@@ -39,7 +38,6 @@ class ChromeBrowserState;
// Keeps track of the restore state during startup. // Keeps track of the restore state during startup.
@property(nonatomic, strong) CrashRestoreHelper* restoreHelper; @property(nonatomic, strong) CrashRestoreHelper* restoreHelper;
- (BrowserViewWrangler*)browserViewWrangler;
- (id<TabSwitcher>)tabSwitcher; - (id<TabSwitcher>)tabSwitcher;
- (TabModel*)currentTabModel; - (TabModel*)currentTabModel;
- (ChromeBrowserState*)mainBrowserState; - (ChromeBrowserState*)mainBrowserState;
......
...@@ -151,6 +151,8 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO }; ...@@ -151,6 +151,8 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO };
@synthesize settingsNavigationController; //< From AppNavigation protocol. @synthesize settingsNavigationController; //< From AppNavigation protocol.
@synthesize appURLLoadingService = @synthesize appURLLoadingService =
_appURLLoadingService; //< From SceneControllerGuts _appURLLoadingService; //< From SceneControllerGuts
@synthesize browserViewWrangler =
_browserViewWrangler; //< From SceneControllerGuts
- (instancetype)initWithSceneState:(SceneState*)sceneState { - (instancetype)initWithSceneState:(SceneState*)sceneState {
self = [super init]; self = [super init];
...@@ -1347,7 +1349,7 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO }; ...@@ -1347,7 +1349,7 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO };
self.incognitoInterface.browserState)); self.incognitoInterface.browserState));
} }
[self.mainController.browserViewWrangler destroyAndRebuildIncognitoBrowser]; [self.browserViewWrangler destroyAndRebuildIncognitoBrowser];
if (base::FeatureList::IsEnabled(kLogBreadcrumbs)) { if (base::FeatureList::IsEnabled(kLogBreadcrumbs)) {
breakpad::MonitorBreadcrumbManagerService( breakpad::MonitorBreadcrumbManagerService(
......
...@@ -15,10 +15,16 @@ ...@@ -15,10 +15,16 @@
#import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h" #import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h"
class ChromeBrowserState; class ChromeBrowserState;
@class BrowserViewWrangler;
@class TabModel; @class TabModel;
@protocol SceneControllerGuts <WebStateListObserving> @protocol SceneControllerGuts <WebStateListObserving>
// Wrangler to handle BVC and tab model creation, access, and related logic.
// Implements faetures exposed from this object through the
// BrowserViewInformation protocol.
@property(nonatomic, strong) BrowserViewWrangler* browserViewWrangler;
// The scene level component for url loading. Is passed down to // The scene level component for url loading. Is passed down to
// browser state level UrlLoadingService instances. // browser state level UrlLoadingService instances.
@property(nonatomic, assign) AppUrlLoadingService* appURLLoadingService; @property(nonatomic, assign) AppUrlLoadingService* appURLLoadingService;
......
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