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

[iOS] Renaming CommandHandler to ServiceDelegate

Gives a better name to <GoogleServicesSettingsCommandHandler> and
renames it to GoogleServicesSettings.
The delegate is to handle changes for all services from the VC
This is related to crrev.com/c/1163521

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ic952a98d659c92a355f0cb8eb4bc56e0c75af33e
Reviewed-on: https://chromium-review.googlesource.com/1166964
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581829}
parent 3d493dc6
...@@ -42,13 +42,13 @@ source_set("settings") { ...@@ -42,13 +42,13 @@ source_set("settings") {
"dataplan_usage_collection_view_controller.mm", "dataplan_usage_collection_view_controller.mm",
"do_not_track_collection_view_controller.h", "do_not_track_collection_view_controller.h",
"do_not_track_collection_view_controller.mm", "do_not_track_collection_view_controller.mm",
"google_services_settings_command_handler.h",
"google_services_settings_consumer.h", "google_services_settings_consumer.h",
"google_services_settings_coordinator.h", "google_services_settings_coordinator.h",
"google_services_settings_coordinator.mm", "google_services_settings_coordinator.mm",
"google_services_settings_local_commands.h", "google_services_settings_local_commands.h",
"google_services_settings_mediator.h", "google_services_settings_mediator.h",
"google_services_settings_mediator.mm", "google_services_settings_mediator.mm",
"google_services_settings_service_delegate.h",
"google_services_settings_view_controller.h", "google_services_settings_view_controller.h",
"google_services_settings_view_controller.mm", "google_services_settings_view_controller.mm",
"google_services_settings_view_controller_model_delegate.h", "google_services_settings_view_controller_model_delegate.h",
......
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
- (void)start { - (void)start {
UICollectionViewLayout* layout = [[MDCCollectionViewFlowLayout alloc] init]; UICollectionViewLayout* layout = [[MDCCollectionViewFlowLayout alloc] init];
GoogleServicesSettingsViewController* controller = GoogleServicesSettingsViewController* viewController =
[[GoogleServicesSettingsViewController alloc] [[GoogleServicesSettingsViewController alloc]
initWithLayout:layout initWithLayout:layout
style:CollectionViewControllerStyleAppBar]; style:CollectionViewControllerStyleAppBar];
controller.presentationDelegate = self; viewController.presentationDelegate = self;
controller.localDispatcher = self; viewController.localDispatcher = self;
self.viewController = controller; self.viewController = viewController;
SyncSetupService* syncSetupService = SyncSetupService* syncSetupService =
SyncSetupServiceFactory::GetForBrowserState(self.browserState); SyncSetupServiceFactory::GetForBrowserState(self.browserState);
browser_sync::ProfileSyncService* syncService = browser_sync::ProfileSyncService* syncService =
...@@ -54,11 +54,11 @@ ...@@ -54,11 +54,11 @@
initWithPrefService:self.browserState->GetPrefs() initWithPrefService:self.browserState->GetPrefs()
syncService:syncService syncService:syncService
syncSetupService:syncSetupService]; syncSetupService:syncSetupService];
self.mediator.consumer = controller; self.mediator.consumer = viewController;
self.mediator.authService = self.mediator.authService =
AuthenticationServiceFactory::GetForBrowserState(self.browserState); AuthenticationServiceFactory::GetForBrowserState(self.browserState);
controller.modelDelegate = self.mediator; viewController.modelDelegate = self.mediator;
controller.commandHandler = self.mediator; viewController.serviceDelegate = self.mediator;
DCHECK(self.navigationController); DCHECK(self.navigationController);
[self.navigationController pushViewController:self.viewController [self.navigationController pushViewController:self.viewController
animated:YES]; animated:YES];
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/settings/google_services_settings_command_handler.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_consumer.h" #import "ios/chrome/browser/ui/settings/google_services_settings_consumer.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_service_delegate.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_view_controller.h" #import "ios/chrome/browser/ui/settings/google_services_settings_view_controller.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_view_controller_model_delegate.h" #import "ios/chrome/browser/ui/settings/google_services_settings_view_controller_model_delegate.h"
...@@ -23,7 +23,7 @@ class ProfileSyncService; ...@@ -23,7 +23,7 @@ class ProfileSyncService;
// Mediator for the Google services settings. // Mediator for the Google services settings.
@interface GoogleServicesSettingsMediator @interface GoogleServicesSettingsMediator
: NSObject<GoogleServicesSettingsCommandHandler, : NSObject<GoogleServicesSettingsServiceDelegate,
GoogleServicesSettingsViewControllerModelDelegate> GoogleServicesSettingsViewControllerModelDelegate>
// View controller. // View controller.
......
...@@ -496,7 +496,7 @@ textItemWithItemType:(NSInteger)itemType ...@@ -496,7 +496,7 @@ textItemWithItemType:(NSInteger)itemType
[self loadNonPersonalizedSection]; [self loadNonPersonalizedSection];
} }
#pragma mark - GoogleServicesSettingsCommandHandler #pragma mark - GoogleServicesSettingsServiceDelegate
- (void)toggleSyncEverythingWithValue:(BOOL)value { - (void)toggleSyncEverythingWithValue:(BOOL)value {
if (value == self.isConsentGiven) if (value == self.isConsentGiven)
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_SETTINGS_COMMAND_HANDLER_H_ #ifndef IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_SETTINGS_SERVICE_DELEGATE_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_SETTINGS_COMMAND_HANDLER_H_ #define IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_SETTINGS_SERVICE_DELEGATE_H_
// List of Google Services Settings commands. // List of Google Services Settings commands.
typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) { typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) {
...@@ -34,7 +34,7 @@ typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) { ...@@ -34,7 +34,7 @@ typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) {
}; };
// Protocol to handle Google services settings commands. // Protocol to handle Google services settings commands.
@protocol GoogleServicesSettingsCommandHandler<NSObject> @protocol GoogleServicesSettingsServiceDelegate<NSObject>
// Called when GoogleServicesSettingsCommandIDToggleSyncEverything is triggered. // Called when GoogleServicesSettingsCommandIDToggleSyncEverything is triggered.
- (void)toggleSyncEverythingWithValue:(BOOL)value; - (void)toggleSyncEverythingWithValue:(BOOL)value;
...@@ -60,4 +60,4 @@ typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) { ...@@ -60,4 +60,4 @@ typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) {
@end @end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_SETTINGS_COMMAND_HANDLER_H_ #endif // IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_SETTINGS_SERVICE_DELEGATE_H_
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#import "ios/chrome/browser/ui/settings/google_services_settings_consumer.h" #import "ios/chrome/browser/ui/settings/google_services_settings_consumer.h"
@class GoogleServicesSettingsViewController; @class GoogleServicesSettingsViewController;
@protocol GoogleServicesSettingsCommandHandler; @protocol GoogleServicesSettingsServiceDelegate;
@protocol GoogleServicesSettingsLocalCommands; @protocol GoogleServicesSettingsLocalCommands;
@protocol GoogleServicesSettingsViewControllerModelDelegate; @protocol GoogleServicesSettingsViewControllerModelDelegate;
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
@property(nonatomic, weak) id<GoogleServicesSettingsViewControllerModelDelegate> @property(nonatomic, weak) id<GoogleServicesSettingsViewControllerModelDelegate>
modelDelegate; modelDelegate;
// Handler for GoogleServicesSettingsCommand. // Handler for GoogleServicesSettingsCommand.
@property(nonatomic, weak) id<GoogleServicesSettingsCommandHandler> @property(nonatomic, weak) id<GoogleServicesSettingsServiceDelegate>
commandHandler; serviceDelegate;
// Local command dispatcher. // Local command dispatcher.
@property(nonatomic, weak) id<GoogleServicesSettingsLocalCommands> @property(nonatomic, weak) id<GoogleServicesSettingsLocalCommands>
localDispatcher; localDispatcher;
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_collapsible_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_collapsible_item.h"
#import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_command_handler.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h" #import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_service_delegate.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_view_controller_model_delegate.h" #import "ios/chrome/browser/ui/settings/google_services_settings_view_controller_model_delegate.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/l10n/l10n_util_mac.h"
...@@ -32,7 +32,7 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -32,7 +32,7 @@ constexpr NSInteger kSectionOffset = 1000;
@synthesize presentationDelegate = _presentationDelegate; @synthesize presentationDelegate = _presentationDelegate;
@synthesize modelDelegate = _modelDelegate; @synthesize modelDelegate = _modelDelegate;
@synthesize commandHandler = _commandHandler; @synthesize serviceDelegate = _serviceDelegate;
@synthesize localDispatcher = _localDispatcher; @synthesize localDispatcher = _localDispatcher;
- (instancetype)initWithLayout:(UICollectionViewLayout*)layout - (instancetype)initWithLayout:(UICollectionViewLayout*)layout
...@@ -104,23 +104,23 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -104,23 +104,23 @@ constexpr NSInteger kSectionOffset = 1000;
static_cast<GoogleServicesSettingsCommandID>(syncSwitchItem.commandID); static_cast<GoogleServicesSettingsCommandID>(syncSwitchItem.commandID);
switch (commandID) { switch (commandID) {
case GoogleServicesSettingsCommandIDToggleSyncEverything: case GoogleServicesSettingsCommandIDToggleSyncEverything:
[self.commandHandler toggleSyncEverythingWithValue:isOn]; [self.serviceDelegate toggleSyncEverythingWithValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDToggleDataTypeSync: case GoogleServicesSettingsCommandIDToggleDataTypeSync:
[self.commandHandler toggleSyncDataSync:syncSwitchItem.dataType [self.serviceDelegate toggleSyncDataSync:syncSwitchItem.dataType
withValue:isOn]; withValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDToggleAutocompleteSearchesService: case GoogleServicesSettingsCommandIDToggleAutocompleteSearchesService:
[self.commandHandler toggleAutocompleteSearchesServiceWithValue:isOn]; [self.serviceDelegate toggleAutocompleteSearchesServiceWithValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDTogglePreloadPagesService: case GoogleServicesSettingsCommandIDTogglePreloadPagesService:
[self.commandHandler togglePreloadPagesServiceWithValue:isOn]; [self.serviceDelegate togglePreloadPagesServiceWithValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDToggleImproveChromeService: case GoogleServicesSettingsCommandIDToggleImproveChromeService:
[self.commandHandler toggleImproveChromeServiceWithValue:isOn]; [self.serviceDelegate toggleImproveChromeServiceWithValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDToggleBetterSearchAndBrowsingService: case GoogleServicesSettingsCommandIDToggleBetterSearchAndBrowsingService:
[self.commandHandler toggleBetterSearchAndBrowsingServiceWithValue:isOn]; [self.serviceDelegate toggleBetterSearchAndBrowsingServiceWithValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDNoOp: case GoogleServicesSettingsCommandIDNoOp:
case GoogleServicesSettingsCommandIDOpenGoogleActivityControlsDialog: case GoogleServicesSettingsCommandIDOpenGoogleActivityControlsDialog:
......
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