Commit be20a4ba authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Adding dispatcher to Google sync services

Adding dispatcher to GoogleServicesNavigationCoordinator and
AdvancedSigninSettingsCoordinator, to be able to open links from the
advanced sign-in settings.

Bug: 883075, 948681
Change-Id: I18db56209daa32a5b1c3ad6e7b2c26878b51c0f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559310Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649820}
parent deec397e
...@@ -1686,6 +1686,7 @@ enum class EnterTabSwitcherSnapshotResult { ...@@ -1686,6 +1686,7 @@ enum class EnterTabSwitcherSnapshotResult {
initWithBaseViewController:baseViewController initWithBaseViewController:baseViewController
browserState:_mainBrowserState]; browserState:_mainBrowserState];
_googleServicesNavigationCoordinator.delegate = self; _googleServicesNavigationCoordinator.delegate = self;
_googleServicesNavigationCoordinator.dispatcher = self;
[_googleServicesNavigationCoordinator start]; [_googleServicesNavigationCoordinator start];
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" #import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
@class AdvancedSigninSettingsCoordinator; @class AdvancedSigninSettingsCoordinator;
@protocol ApplicationCommands;
// AdvancedSigninSettingsCoordinator delegate. // AdvancedSigninSettingsCoordinator delegate.
@protocol AdvancedSigninSettingsCoordinatorDelegate <NSObject> @protocol AdvancedSigninSettingsCoordinatorDelegate <NSObject>
...@@ -26,6 +27,8 @@ ...@@ -26,6 +27,8 @@
// Delegate. // Delegate.
@property(nonatomic, weak) id<AdvancedSigninSettingsCoordinatorDelegate> @property(nonatomic, weak) id<AdvancedSigninSettingsCoordinatorDelegate>
delegate; delegate;
// Global dispatcher.
@property(nonatomic, weak) id<ApplicationCommands> dispatcher;
// Cancels the coordinator, and calls the delegate. This method does nothing if // Cancels the coordinator, and calls the delegate. This method does nothing if
// called twice. // called twice.
......
...@@ -52,6 +52,7 @@ using l10n_util::GetNSString; ...@@ -52,6 +52,7 @@ using l10n_util::GetNSString;
browserState:self.browserState browserState:self.browserState
mode: mode:
GoogleServicesSettingsModeAdvancedSigninSettings]; GoogleServicesSettingsModeAdvancedSigninSettings];
self.googleServicesSettingsCoordinator.dispatcher = self.dispatcher;
self.googleServicesSettingsCoordinator.navigationController = self.googleServicesSettingsCoordinator.navigationController =
self.advancedSigninSettingsNavigationController; self.advancedSigninSettingsNavigationController;
[self.googleServicesSettingsCoordinator start]; [self.googleServicesSettingsCoordinator start];
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" #import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
@protocol ApplicationCommands;
@class GoogleServicesNavigationCoordinator; @class GoogleServicesNavigationCoordinator;
// GoogleServicesNavigationCoordinator delegate. // GoogleServicesNavigationCoordinator delegate.
...@@ -24,6 +25,8 @@ ...@@ -24,6 +25,8 @@
// Delegate. // Delegate.
@property(nonatomic, weak) id<GoogleServicesNavigationCoordinatorDelegate> @property(nonatomic, weak) id<GoogleServicesNavigationCoordinatorDelegate>
delegate; delegate;
// Global dispatcher.
@property(nonatomic, weak) id<ApplicationCommands> dispatcher;
@end @end
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
initWithBaseViewController:self.navigationController initWithBaseViewController:self.navigationController
browserState:self.browserState browserState:self.browserState
mode:GoogleServicesSettingsModeSettings]; mode:GoogleServicesSettingsModeSettings];
self.googleServicesSettingsCoordinator.dispatcher = self.dispatcher;
self.googleServicesSettingsCoordinator.navigationController = self.googleServicesSettingsCoordinator.navigationController =
self.navigationController; self.navigationController;
[self.googleServicesSettingsCoordinator start]; [self.googleServicesSettingsCoordinator start];
......
...@@ -60,6 +60,8 @@ ...@@ -60,6 +60,8 @@
@implementation ManageSyncSettingsCoordinator @implementation ManageSyncSettingsCoordinator
- (void)start { - (void)start {
DCHECK(self.dispatcher);
DCHECK(self.navigationController);
self.mediator = [[ManageSyncSettingsMediator alloc] self.mediator = [[ManageSyncSettingsMediator alloc]
initWithSyncService:self.syncService initWithSyncService:self.syncService
userPrefService:self.browserState->GetPrefs()]; userPrefService:self.browserState->GetPrefs()];
...@@ -73,7 +75,6 @@ ...@@ -73,7 +75,6 @@
self.viewController.presentationDelegate = self; self.viewController.presentationDelegate = self;
self.viewController.modelDelegate = self.mediator; self.viewController.modelDelegate = self.mediator;
self.mediator.consumer = self.viewController; self.mediator.consumer = self.viewController;
DCHECK(self.navigationController);
[self.navigationController pushViewController:self.viewController [self.navigationController pushViewController:self.viewController
animated:YES]; animated:YES];
_syncObserver.reset(new SyncObserverBridge(self, self.syncService)); _syncObserver.reset(new SyncObserverBridge(self, self.syncService));
......
...@@ -250,6 +250,7 @@ ...@@ -250,6 +250,7 @@
initWithBaseViewController:self.presentingViewController initWithBaseViewController:self.presentingViewController
browserState:self.browserState]; browserState:self.browserState];
self.advancedSigninSettingsCoordinator.delegate = self; self.advancedSigninSettingsCoordinator.delegate = self;
self.advancedSigninSettingsCoordinator.dispatcher = self.dispatcher;
[self.advancedSigninSettingsCoordinator start]; [self.advancedSigninSettingsCoordinator start];
} else { } else {
[self signinDoneWithSuccess:YES]; [self signinDoneWithSuccess:YES];
......
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