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 {
initWithBaseViewController:baseViewController
browserState:_mainBrowserState];
_googleServicesNavigationCoordinator.delegate = self;
_googleServicesNavigationCoordinator.dispatcher = self;
[_googleServicesNavigationCoordinator start];
}
......
......@@ -8,6 +8,7 @@
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
@class AdvancedSigninSettingsCoordinator;
@protocol ApplicationCommands;
// AdvancedSigninSettingsCoordinator delegate.
@protocol AdvancedSigninSettingsCoordinatorDelegate <NSObject>
......@@ -26,6 +27,8 @@
// Delegate.
@property(nonatomic, weak) id<AdvancedSigninSettingsCoordinatorDelegate>
delegate;
// Global dispatcher.
@property(nonatomic, weak) id<ApplicationCommands> dispatcher;
// Cancels the coordinator, and calls the delegate. This method does nothing if
// called twice.
......
......@@ -52,6 +52,7 @@ using l10n_util::GetNSString;
browserState:self.browserState
mode:
GoogleServicesSettingsModeAdvancedSigninSettings];
self.googleServicesSettingsCoordinator.dispatcher = self.dispatcher;
self.googleServicesSettingsCoordinator.navigationController =
self.advancedSigninSettingsNavigationController;
[self.googleServicesSettingsCoordinator start];
......
......@@ -7,6 +7,7 @@
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
@protocol ApplicationCommands;
@class GoogleServicesNavigationCoordinator;
// GoogleServicesNavigationCoordinator delegate.
......@@ -24,6 +25,8 @@
// Delegate.
@property(nonatomic, weak) id<GoogleServicesNavigationCoordinatorDelegate>
delegate;
// Global dispatcher.
@property(nonatomic, weak) id<ApplicationCommands> dispatcher;
@end
......
......@@ -39,6 +39,7 @@
initWithBaseViewController:self.navigationController
browserState:self.browserState
mode:GoogleServicesSettingsModeSettings];
self.googleServicesSettingsCoordinator.dispatcher = self.dispatcher;
self.googleServicesSettingsCoordinator.navigationController =
self.navigationController;
[self.googleServicesSettingsCoordinator start];
......
......@@ -60,6 +60,8 @@
@implementation ManageSyncSettingsCoordinator
- (void)start {
DCHECK(self.dispatcher);
DCHECK(self.navigationController);
self.mediator = [[ManageSyncSettingsMediator alloc]
initWithSyncService:self.syncService
userPrefService:self.browserState->GetPrefs()];
......@@ -73,7 +75,6 @@
self.viewController.presentationDelegate = self;
self.viewController.modelDelegate = self.mediator;
self.mediator.consumer = self.viewController;
DCHECK(self.navigationController);
[self.navigationController pushViewController:self.viewController
animated:YES];
_syncObserver.reset(new SyncObserverBridge(self, self.syncService));
......
......@@ -250,6 +250,7 @@
initWithBaseViewController:self.presentingViewController
browserState:self.browserState];
self.advancedSigninSettingsCoordinator.delegate = self;
self.advancedSigninSettingsCoordinator.dispatcher = self.dispatcher;
[self.advancedSigninSettingsCoordinator start];
} else {
[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