Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/app/main_controller.h" | 5 #import "ios/chrome/app/main_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #import <CoreSpotlight/CoreSpotlight.h> | 10 #import <CoreSpotlight/CoreSpotlight.h> |
| 11 #import <objc/objc.h> | 11 #import <objc/objc.h> |
| 12 #import <objc/runtime.h> | 12 #import <objc/runtime.h> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/callback_helpers.h" | 15 #include "base/callback_helpers.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/ios/block_types.h" | 17 #include "base/ios/block_types.h" |
| 18 #import "base/mac/bind_objc_block.h" | 18 #import "base/mac/bind_objc_block.h" |
| 19 #include "base/mac/bundle_locations.h" | 19 #include "base/mac/bundle_locations.h" |
| 20 #include "base/mac/foundation_util.h" | 20 #include "base/mac/foundation_util.h" |
| 21 #include "base/mac/objc_property_releaser.h" | |
| 22 #import "base/mac/scoped_nsobject.h" | |
| 23 #include "base/macros.h" | 21 #include "base/macros.h" |
| 24 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 25 #include "base/strings/sys_string_conversions.h" | 23 #include "base/strings/sys_string_conversions.h" |
| 26 #include "base/task_scheduler/post_task.h" | 24 #include "base/task_scheduler/post_task.h" |
| 27 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 28 #include "components/component_updater/component_updater_service.h" | 26 #include "components/component_updater/component_updater_service.h" |
| 29 #include "components/content_settings/core/browser/host_content_settings_map.h" | 27 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 30 #include "components/metrics/metrics_pref_names.h" | 28 #include "components/metrics/metrics_pref_names.h" |
| 31 #include "components/metrics/metrics_service.h" | 29 #include "components/metrics/metrics_service.h" |
| 32 #include "components/prefs/pref_change_registrar.h" | 30 #include "components/prefs/pref_change_registrar.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 #include "ios/web/net/web_http_protocol_handler_delegate.h" | 139 #include "ios/web/net/web_http_protocol_handler_delegate.h" |
| 142 #import "ios/web/public/navigation_manager.h" | 140 #import "ios/web/public/navigation_manager.h" |
| 143 #include "ios/web/public/web_capabilities.h" | 141 #include "ios/web/public/web_capabilities.h" |
| 144 #include "ios/web/public/web_state/web_state.h" | 142 #include "ios/web/public/web_state/web_state.h" |
| 145 #import "ios/web/public/web_view_creation_util.h" | 143 #import "ios/web/public/web_view_creation_util.h" |
| 146 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" | 144 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" |
| 147 #include "mojo/edk/embedder/embedder.h" | 145 #include "mojo/edk/embedder/embedder.h" |
| 148 #import "net/base/mac/url_conversions.h" | 146 #import "net/base/mac/url_conversions.h" |
| 149 #include "net/url_request/url_request_context.h" | 147 #include "net/url_request/url_request_context.h" |
| 150 | 148 |
| 149 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 150 #error "This file requires ARC support." | |
| 151 #endif | |
| 152 | |
| 151 namespace { | 153 namespace { |
| 152 | 154 |
| 153 // Preference key used to store which profile is current. | 155 // Preference key used to store which profile is current. |
| 154 NSString* kIncognitoCurrentKey = @"IncognitoActive"; | 156 NSString* kIncognitoCurrentKey = @"IncognitoActive"; |
| 155 | 157 |
| 156 // Constants for deferred initialization of preferences observer. | 158 // Constants for deferred initialization of preferences observer. |
| 157 NSString* const kPrefObserverInit = @"PrefObserverInit"; | 159 NSString* const kPrefObserverInit = @"PrefObserverInit"; |
| 158 | 160 |
| 159 // Constants for deferring notifying the AuthenticationService of a new cold | 161 // Constants for deferring notifying the AuthenticationService of a new cold |
| 160 // start. | 162 // start. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 // The object that drives the Chrome startup/shutdown logic. | 241 // The object that drives the Chrome startup/shutdown logic. |
| 240 std::unique_ptr<IOSChromeMain> _chromeMain; | 242 std::unique_ptr<IOSChromeMain> _chromeMain; |
| 241 | 243 |
| 242 // The ChromeBrowserState associated with the main (non-OTR) browsing mode. | 244 // The ChromeBrowserState associated with the main (non-OTR) browsing mode. |
| 243 ios::ChromeBrowserState* _mainBrowserState; // Weak. | 245 ios::ChromeBrowserState* _mainBrowserState; // Weak. |
| 244 | 246 |
| 245 // Coordinators used to run the Chrome UI; there will be one of these active | 247 // Coordinators used to run the Chrome UI; there will be one of these active |
| 246 // at any given time, usually |_mainCoordinator|. | 248 // at any given time, usually |_mainCoordinator|. |
| 247 // Main coordinator, backing object for the property of the same name, which | 249 // Main coordinator, backing object for the property of the same name, which |
| 248 // lazily initializes on access. | 250 // lazily initializes on access. |
| 249 base::scoped_nsobject<MainCoordinator> _mainCoordinator; | 251 MainCoordinator* _mainCoordinator; |
|
gambard
2017/06/12 12:42:47
Can probably be synthesize instead.
marq (ping after 24h)
2017/06/12 14:25:09
The lazy init behavior, coupled with a few places
gambard
2017/06/12 14:44:54
Sorry my comment was unclear. The ivar declaration
marq (ping after 24h)
2017/06/12 16:25:29
Gotcha. Done.
| |
| 250 | 252 |
| 251 // Wrangler to handle BVC and tab model creation, access, and related logic. | 253 // Wrangler to handle BVC and tab model creation, access, and related logic. |
| 252 // Implements faetures exposed from this object through the | 254 // Implements faetures exposed from this object through the |
| 253 // BrowserViewInformation protocol. | 255 // BrowserViewInformation protocol. |
| 254 base::scoped_nsobject<BrowserViewWrangler> _browserViewWrangler; | 256 BrowserViewWrangler* _browserViewWrangler; |
| 255 | 257 |
| 256 // Parameters received at startup time when the app is launched from another | 258 // Parameters received at startup time when the app is launched from another |
| 257 // app. | 259 // app. |
| 258 base::scoped_nsobject<AppStartupParameters> _startupParameters; | 260 AppStartupParameters* _startupParameters; |
| 259 | 261 |
| 260 // Navigation View controller for the settings. | 262 // Navigation View controller for the settings. |
| 261 base::scoped_nsobject<SettingsNavigationController> | 263 SettingsNavigationController* _settingsNavigationController; |
| 262 _settingsNavigationController; | |
| 263 | 264 |
| 264 // View controller for switching tabs. | 265 // View controller for switching tabs. |
| 265 base::scoped_nsobject<UIViewController<TabSwitcher>> _tabSwitcherController; | 266 UIViewController<TabSwitcher>* _tabSwitcherController; |
| 266 | 267 |
| 267 // Controller to display the re-authentication flow. | 268 // Controller to display the re-authentication flow. |
| 268 base::scoped_nsobject<SigninInteractionController> | 269 SigninInteractionController* _signinInteractionController; |
| 269 _signinInteractionController; | |
| 270 | 270 |
| 271 // The number of memory warnings that have been received in this | 271 // The number of memory warnings that have been received in this |
| 272 // foreground session. | 272 // foreground session. |
| 273 int _foregroundMemoryWarningCount; | 273 int _foregroundMemoryWarningCount; |
|
gambard
2017/06/12 12:42:48
Is this used?
marq (ping after 24h)
2017/06/12 14:25:09
No, but I'll remove it in another CL.
| |
| 274 | 274 |
| 275 // The time at which to reset the OOM crash flag in the user defaults. This | 275 // The time at which to reset the OOM crash flag in the user defaults. This |
| 276 // is used to handle receiving multiple memory warnings in short succession. | 276 // is used to handle receiving multiple memory warnings in short succession. |
| 277 CFAbsoluteTime _outOfMemoryResetTime; | 277 CFAbsoluteTime _outOfMemoryResetTime; |
|
gambard
2017/06/12 12:42:48
Is it used?
marq (ping after 24h)
2017/06/12 14:25:09
No, but I'll remove it in another CL.
| |
| 278 | 278 |
| 279 // YES while animating the dismissal of stack view. | 279 // YES while animating the dismissal of stack view. |
| 280 BOOL _dismissingStackView; | 280 BOOL _dismissingStackView; |
| 281 | 281 |
| 282 // If not NONE, the current BVC should be switched to this BVC on completion | 282 // If not NONE, the current BVC should be switched to this BVC on completion |
| 283 // of stack view dismissal. | 283 // of stack view dismissal. |
| 284 StackViewDismissalMode _modeToDisplayOnStackViewDismissal; | 284 StackViewDismissalMode _modeToDisplayOnStackViewDismissal; |
| 285 | 285 |
| 286 // If YES, the tab switcher is currently active. | 286 // If YES, the tab switcher is currently active. |
| 287 BOOL _tabSwitcherIsActive; | 287 BOOL _tabSwitcherIsActive; |
| 288 | 288 |
| 289 // True if the current session began from a cold start. False if the app has | 289 // True if the current session began from a cold start. False if the app has |
| 290 // entered the background at least once since start up. | 290 // entered the background at least once since start up. |
| 291 BOOL _isColdStart; | 291 BOOL _isColdStart; |
| 292 | 292 |
| 293 // Keeps track of the restore state during startup. | 293 // Keeps track of the restore state during startup. |
| 294 base::scoped_nsobject<CrashRestoreHelper> _restoreHelper; | 294 CrashRestoreHelper* _restoreHelper; |
| 295 | 295 |
| 296 // An object to record metrics related to the user's first action. | 296 // An object to record metrics related to the user's first action. |
| 297 std::unique_ptr<FirstUserActionRecorder> _firstUserActionRecorder; | 297 std::unique_ptr<FirstUserActionRecorder> _firstUserActionRecorder; |
| 298 | 298 |
| 299 // RequestTrackerFactory to customize the behavior of the network stack. | 299 // RequestTrackerFactory to customize the behavior of the network stack. |
| 300 std::unique_ptr<web::RequestTrackerFactoryImpl> _requestTrackerFactory; | 300 std::unique_ptr<web::RequestTrackerFactoryImpl> _requestTrackerFactory; |
| 301 | 301 |
| 302 // Configuration for the HTTP protocol handler. | 302 // Configuration for the HTTP protocol handler. |
| 303 std::unique_ptr<web::WebHTTPProtocolHandlerDelegate> | 303 std::unique_ptr<web::WebHTTPProtocolHandlerDelegate> |
| 304 _httpProtocolHandlerDelegate; | 304 _httpProtocolHandlerDelegate; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 319 BOOL _isProcessingTabSwitcherCommand; | 319 BOOL _isProcessingTabSwitcherCommand; |
| 320 BOOL _isProcessingVoiceSearchCommand; | 320 BOOL _isProcessingVoiceSearchCommand; |
| 321 | 321 |
| 322 // Bridge to listen to pref changes. | 322 // Bridge to listen to pref changes. |
| 323 std::unique_ptr<PrefObserverBridge> _localStatePrefObserverBridge; | 323 std::unique_ptr<PrefObserverBridge> _localStatePrefObserverBridge; |
| 324 | 324 |
| 325 // Registrar for pref changes notifications to the local state. | 325 // Registrar for pref changes notifications to the local state. |
| 326 PrefChangeRegistrar _localStatePrefChangeRegistrar; | 326 PrefChangeRegistrar _localStatePrefChangeRegistrar; |
| 327 | 327 |
| 328 // Clears browsing data from ChromeBrowserStates. | 328 // Clears browsing data from ChromeBrowserStates. |
| 329 base::scoped_nsobject<BrowsingDataRemovalController> | 329 BrowsingDataRemovalController* _browsingDataRemovalController; |
| 330 _browsingDataRemovalController; | |
| 331 | 330 |
| 332 // The class in charge of showing/hiding the memory debugger when the | 331 // The class in charge of showing/hiding the memory debugger when the |
| 333 // appropriate pref changes. | 332 // appropriate pref changes. |
| 334 base::scoped_nsobject<MemoryDebuggerManager> _memoryDebuggerManager; | 333 MemoryDebuggerManager* _memoryDebuggerManager; |
| 335 | |
| 336 base::mac::ObjCPropertyReleaser _propertyReleaser_MainController; | |
| 337 | 334 |
| 338 // Responsible for indexing chrome links (such as bookmarks, most likely...) | 335 // Responsible for indexing chrome links (such as bookmarks, most likely...) |
| 339 // in system Spotlight index. | 336 // in system Spotlight index. |
| 340 base::scoped_nsobject<SpotlightManager> _spotlightManager; | 337 SpotlightManager* _spotlightManager; |
| 341 | 338 |
| 342 // Cached launchOptions from -didFinishLaunchingWithOptions. | 339 // Cached launchOptions from -didFinishLaunchingWithOptions. |
| 343 base::scoped_nsobject<NSDictionary> _launchOptions; | 340 NSDictionary* _launchOptions; |
| 344 | 341 |
| 345 // View controller for displaying the history panel. | 342 // View controller for displaying the history panel. |
| 346 base::scoped_nsobject<UIViewController> _historyPanelViewController; | 343 UIViewController* _historyPanelViewController; |
| 347 | 344 |
| 348 // Variable backing metricsMediator property. | 345 // Variable backing metricsMediator property. |
| 349 base::WeakNSObject<MetricsMediator> _metricsMediator; | 346 __weak MetricsMediator* _metricsMediator; |
| 350 | 347 |
| 351 // Hander for the startup tasks, deferred or not. | 348 // Hander for the startup tasks, deferred or not. |
| 352 base::scoped_nsobject<StartupTasks> _startupTasks; | 349 StartupTasks* _startupTasks; |
| 353 } | 350 } |
| 354 | 351 |
| 355 // Pointer to the main view controller, always owned by the main window. | 352 // Pointer to the main view controller, always owned by the main window. |
| 356 @property(nonatomic, readonly) MainViewController* mainViewController; | 353 @property(weak, nonatomic, readonly) MainViewController* mainViewController; |
| 357 | 354 |
| 358 // The main coordinator, lazily created the first time it is accessed. Manages | 355 // The main coordinator, lazily created the first time it is accessed. Manages |
| 359 // the MainViewController. This property should not be accessed before the | 356 // the MainViewController. This property should not be accessed before the |
| 360 // browser has started up to the FOREGROUND stage. | 357 // browser has started up to the FOREGROUND stage. |
| 361 @property(nonatomic, readonly) MainCoordinator* mainCoordinator; | 358 @property(weak, nonatomic, readonly) MainCoordinator* mainCoordinator; |
| 362 | 359 |
| 363 // A property to track whether the QR Scanner should be started upon tab | 360 // A property to track whether the QR Scanner should be started upon tab |
| 364 // switcher dismissal. It can only be YES if the QR Scanner experiment is | 361 // switcher dismissal. It can only be YES if the QR Scanner experiment is |
| 365 // enabled. | 362 // enabled. |
| 366 @property(nonatomic, readwrite) BOOL startQRScannerAfterTabSwitcherDismissal; | 363 @property(nonatomic, readwrite) BOOL startQRScannerAfterTabSwitcherDismissal; |
| 367 // Whether the QR Scanner should be started upon tab switcher dismissal. | 364 // Whether the QR Scanner should be started upon tab switcher dismissal. |
| 368 @property(nonatomic, readwrite) BOOL startVoiceSearchAfterTabSwitcherDismissal; | 365 @property(nonatomic, readwrite) BOOL startVoiceSearchAfterTabSwitcherDismissal; |
| 369 // Whether the omnibox should be focused upon tab switcher dismissal. | 366 // Whether the omnibox should be focused upon tab switcher dismissal. |
| 370 @property(nonatomic, readwrite) BOOL startFocusOmniboxAfterTabSwitcherDismissal; | 367 @property(nonatomic, readwrite) BOOL startFocusOmniboxAfterTabSwitcherDismissal; |
| 371 | 368 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 _startVoiceSearchAfterTabSwitcherDismissal; | 543 _startVoiceSearchAfterTabSwitcherDismissal; |
| 547 @synthesize startQRScannerAfterTabSwitcherDismissal = | 544 @synthesize startQRScannerAfterTabSwitcherDismissal = |
| 548 _startQRScannerAfterTabSwitcherDismissal; | 545 _startQRScannerAfterTabSwitcherDismissal; |
| 549 @synthesize startFocusOmniboxAfterTabSwitcherDismissal = | 546 @synthesize startFocusOmniboxAfterTabSwitcherDismissal = |
| 550 _startFocusOmniboxAfterTabSwitcherDismissal; | 547 _startFocusOmniboxAfterTabSwitcherDismissal; |
| 551 | 548 |
| 552 #pragma mark - Application lifecycle | 549 #pragma mark - Application lifecycle |
| 553 | 550 |
| 554 - (instancetype)init { | 551 - (instancetype)init { |
| 555 if ((self = [super init])) { | 552 if ((self = [super init])) { |
| 556 _propertyReleaser_MainController.Init(self, [MainController class]); | 553 _startupTasks = [[StartupTasks alloc] init]; |
| 557 _startupTasks.reset([[StartupTasks alloc] init]); | |
| 558 } | 554 } |
| 559 return self; | 555 return self; |
| 560 } | 556 } |
| 561 | 557 |
| 562 - (void)dealloc { | 558 - (void)dealloc { |
| 563 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 559 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 564 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); | 560 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); |
| 565 net::RequestTracker::SetRequestTrackerFactory(nullptr); | 561 net::RequestTracker::SetRequestTrackerFactory(nullptr); |
| 566 [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 562 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| 567 [super dealloc]; | |
| 568 } | 563 } |
| 569 | 564 |
| 570 // This function starts up to only what is needed at each stage of the | 565 // This function starts up to only what is needed at each stage of the |
| 571 // initialization. It is possible to continue initialization later. | 566 // initialization. It is possible to continue initialization later. |
| 572 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { | 567 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { |
| 573 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && | 568 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && |
| 574 stage >= INITIALIZATION_STAGE_BASIC) { | 569 stage >= INITIALIZATION_STAGE_BASIC) { |
| 575 [self startUpBrowserBasicInitialization]; | 570 [self startUpBrowserBasicInitialization]; |
| 576 _browserInitializationStage = INITIALIZATION_STAGE_BASIC; | 571 _browserInitializationStage = INITIALIZATION_STAGE_BASIC; |
| 577 } | 572 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 _browserStateManager = | 674 _browserStateManager = |
| 680 GetApplicationContext()->GetChromeBrowserStateManager(); | 675 GetApplicationContext()->GetChromeBrowserStateManager(); |
| 681 ios::ChromeBrowserState* chromeBrowserState = | 676 ios::ChromeBrowserState* chromeBrowserState = |
| 682 _browserStateManager->GetLastUsedBrowserState(); | 677 _browserStateManager->GetLastUsedBrowserState(); |
| 683 | 678 |
| 684 // The CrashRestoreHelper must clean up the old browser state information | 679 // The CrashRestoreHelper must clean up the old browser state information |
| 685 // before the tabModels can be created. |_restoreHelper| must be kept alive | 680 // before the tabModels can be created. |_restoreHelper| must be kept alive |
| 686 // until the BVC receives the browser state and tab model. | 681 // until the BVC receives the browser state and tab model. |
| 687 BOOL postCrashLaunch = [self mustShowRestoreInfobar]; | 682 BOOL postCrashLaunch = [self mustShowRestoreInfobar]; |
| 688 if (postCrashLaunch) { | 683 if (postCrashLaunch) { |
| 689 _restoreHelper.reset( | 684 _restoreHelper = |
| 690 [[CrashRestoreHelper alloc] initWithBrowserState:chromeBrowserState]); | 685 [[CrashRestoreHelper alloc] initWithBrowserState:chromeBrowserState]; |
| 691 [_restoreHelper moveAsideSessionInformation]; | 686 [_restoreHelper moveAsideSessionInformation]; |
| 692 } | 687 } |
| 693 | 688 |
| 694 // Initialize and set the main browser state. | 689 // Initialize and set the main browser state. |
| 695 [self initializeBrowserState:chromeBrowserState]; | 690 [self initializeBrowserState:chromeBrowserState]; |
| 696 _mainBrowserState = chromeBrowserState; | 691 _mainBrowserState = chromeBrowserState; |
| 697 _browserViewWrangler.reset([[BrowserViewWrangler alloc] | 692 _browserViewWrangler = |
| 698 initWithBrowserState:_mainBrowserState | 693 [[BrowserViewWrangler alloc] initWithBrowserState:_mainBrowserState |
| 699 tabModelObserver:self]); | 694 tabModelObserver:self]; |
| 700 // Ensure the main tab model is created. | 695 // Ensure the main tab model is created. |
| 701 ignore_result([_browserViewWrangler mainTabModel]); | 696 ignore_result([_browserViewWrangler mainTabModel]); |
| 702 | 697 |
| 703 _spotlightManager.reset([[SpotlightManager | 698 _spotlightManager = |
| 704 spotlightManagerWithBrowserState:_mainBrowserState] retain]); | 699 [SpotlightManager spotlightManagerWithBrowserState:_mainBrowserState]; |
| 705 | 700 |
| 706 ShareExtensionService* service = | 701 ShareExtensionService* service = |
| 707 ShareExtensionServiceFactory::GetForBrowserState(_mainBrowserState); | 702 ShareExtensionServiceFactory::GetForBrowserState(_mainBrowserState); |
| 708 service->Initialize(); | 703 service->Initialize(); |
| 709 | 704 |
| 710 // Before bringing up the UI, make sure the launch mode is correct, and | 705 // Before bringing up the UI, make sure the launch mode is correct, and |
| 711 // check for previous crashes. | 706 // check for previous crashes. |
| 712 BOOL startInIncognito = [standardDefaults boolForKey:kIncognitoCurrentKey]; | 707 BOOL startInIncognito = [standardDefaults boolForKey:kIncognitoCurrentKey]; |
| 713 BOOL switchFromIncognito = startInIncognito && ![self canLaunchInIncognito]; | 708 BOOL switchFromIncognito = startInIncognito && ![self canLaunchInIncognito]; |
| 714 | 709 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 729 [MetricsMediator logLaunchMetricsWithStartupInformation:self | 724 [MetricsMediator logLaunchMetricsWithStartupInformation:self |
| 730 browserViewInformation:_browserViewWrangler]; | 725 browserViewInformation:_browserViewWrangler]; |
| 731 | 726 |
| 732 [self scheduleLowPriorityStartupTasks]; | 727 [self scheduleLowPriorityStartupTasks]; |
| 733 | 728 |
| 734 [_browserViewWrangler updateDeviceSharingManager]; | 729 [_browserViewWrangler updateDeviceSharingManager]; |
| 735 | 730 |
| 736 [self openTabFromLaunchOptions:_launchOptions | 731 [self openTabFromLaunchOptions:_launchOptions |
| 737 startupInformation:self | 732 startupInformation:self |
| 738 appState:self.appState]; | 733 appState:self.appState]; |
| 739 _launchOptions.reset(); | 734 _launchOptions = nil; |
| 740 | 735 |
| 741 mojo::edk::Init(); | 736 mojo::edk::Init(); |
| 742 | 737 |
| 743 if (!_startupParameters) { | 738 if (!_startupParameters) { |
| 744 // The startup parameters may create new tabs or navigations. If the restore | 739 // The startup parameters may create new tabs or navigations. If the restore |
| 745 // infobar is displayed now, it may be dismissed immediately and the user | 740 // infobar is displayed now, it may be dismissed immediately and the user |
| 746 // will never be able to restore the session. | 741 // will never be able to restore the session. |
| 747 [_restoreHelper showRestoreIfNeeded:[self currentTabModel]]; | 742 [_restoreHelper showRestoreIfNeeded:[self currentTabModel]]; |
| 748 _restoreHelper.reset(); | 743 _restoreHelper = nil; |
| 749 } | 744 } |
| 750 | 745 |
| 751 [self scheduleTasksRequiringBVCWithBrowserState]; | 746 [self scheduleTasksRequiringBVCWithBrowserState]; |
| 752 | 747 |
| 753 // Now that everything is properly set up, run the tests. | 748 // Now that everything is properly set up, run the tests. |
| 754 tests_hook::RunTestsIfPresent(); | 749 tests_hook::RunTestsIfPresent(); |
| 755 } | 750 } |
| 756 | 751 |
| 757 - (void)initializeBrowserState:(ios::ChromeBrowserState*)browserState { | 752 - (void)initializeBrowserState:(ios::ChromeBrowserState*)browserState { |
| 758 DCHECK(!browserState->IsOffTheRecord()); | 753 DCHECK(!browserState->IsOffTheRecord()); |
| 759 search_engines::UpdateSearchEnginesIfNeeded( | 754 search_engines::UpdateSearchEnginesIfNeeded( |
| 760 browserState->GetPrefs(), | 755 browserState->GetPrefs(), |
| 761 ios::TemplateURLServiceFactory::GetForBrowserState(browserState)); | 756 ios::TemplateURLServiceFactory::GetForBrowserState(browserState)); |
| 762 | 757 |
| 763 if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) { | 758 if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) { |
| 764 base::scoped_nsobject<TouchToSearchPermissionsMediator> | 759 TouchToSearchPermissionsMediator* touchToSearchPermissions = |
| 765 touchToSearchPermissions([[TouchToSearchPermissionsMediator alloc] | 760 [[TouchToSearchPermissionsMediator alloc] |
| 766 initWithBrowserState:browserState]); | 761 initWithBrowserState:browserState]; |
| 767 if (experimental_flags::IsForceResetContextualSearchEnabled()) { | 762 if (experimental_flags::IsForceResetContextualSearchEnabled()) { |
| 768 [touchToSearchPermissions setPreferenceState:TouchToSearch::UNDECIDED]; | 763 [touchToSearchPermissions setPreferenceState:TouchToSearch::UNDECIDED]; |
| 769 } | 764 } |
| 770 ContextualSearch::RecordPreferenceState( | 765 ContextualSearch::RecordPreferenceState( |
| 771 [touchToSearchPermissions preferenceState]); | 766 [touchToSearchPermissions preferenceState]); |
| 772 } | 767 } |
| 773 } | 768 } |
| 774 | 769 |
| 775 - (void)handleFirstRunUIWillFinish { | 770 - (void)handleFirstRunUIWillFinish { |
| 776 DCHECK(_isPresentingFirstRunUI); | 771 DCHECK(_isPresentingFirstRunUI); |
| 777 _isPresentingFirstRunUI = NO; | 772 _isPresentingFirstRunUI = NO; |
| 778 [[NSNotificationCenter defaultCenter] | 773 [[NSNotificationCenter defaultCenter] |
| 779 removeObserver:self | 774 removeObserver:self |
| 780 name:kChromeFirstRunUIWillFinishNotification | 775 name:kChromeFirstRunUIWillFinishNotification |
| 781 object:nil]; | 776 object:nil]; |
| 782 | 777 |
| 783 [self markEulaAsAccepted]; | 778 [self markEulaAsAccepted]; |
| 784 | 779 |
| 785 if (_startupParameters.get()) { | 780 if (_startupParameters) { |
| 786 [self dismissModalsAndOpenSelectedTabInMode:ApplicationMode::NORMAL | 781 [self dismissModalsAndOpenSelectedTabInMode:ApplicationMode::NORMAL |
| 787 withURL:[_startupParameters externalURL] | 782 withURL:[_startupParameters externalURL] |
| 788 transition:ui::PAGE_TRANSITION_LINK | 783 transition:ui::PAGE_TRANSITION_LINK |
| 789 completion:nil]; | 784 completion:nil]; |
| 790 _startupParameters.reset(); | 785 _startupParameters = nil; |
| 791 } | 786 } |
| 792 } | 787 } |
| 793 | 788 |
| 794 - (void)handleFirstRunUIDidFinish { | 789 - (void)handleFirstRunUIDidFinish { |
| 795 [[NSNotificationCenter defaultCenter] | 790 [[NSNotificationCenter defaultCenter] |
| 796 removeObserver:self | 791 removeObserver:self |
| 797 name:kChromeFirstRunUIDidFinishNotification | 792 name:kChromeFirstRunUIDidFinishNotification |
| 798 object:nil]; | 793 object:nil]; |
| 799 | 794 |
| 800 // As soon as First Run has finished, give OmniboxGeolocationController an | 795 // As soon as First Run has finished, give OmniboxGeolocationController an |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 837 } | 832 } |
| 838 | 833 |
| 839 // Always set the new otr tab model on iPad with tab switcher enabled. | 834 // Always set the new otr tab model on iPad with tab switcher enabled. |
| 840 // Notify the _tabSwitcherController with the new otrBVC. | 835 // Notify the _tabSwitcherController with the new otrBVC. |
| 841 if (IsIPadIdiom() || _tabSwitcherIsActive) | 836 if (IsIPadIdiom() || _tabSwitcherIsActive) |
| 842 [_tabSwitcherController setOtrTabModel:self.otrTabModel]; | 837 [_tabSwitcherController setOtrTabModel:self.otrTabModel]; |
| 843 } | 838 } |
| 844 | 839 |
| 845 - (BrowsingDataRemovalController*)browsingDataRemovalController { | 840 - (BrowsingDataRemovalController*)browsingDataRemovalController { |
| 846 if (!_browsingDataRemovalController) { | 841 if (!_browsingDataRemovalController) { |
| 847 _browsingDataRemovalController.reset( | 842 _browsingDataRemovalController = |
| 848 [[BrowsingDataRemovalController alloc] initWithDelegate:self]); | 843 [[BrowsingDataRemovalController alloc] initWithDelegate:self]; |
| 849 } | 844 } |
| 850 return _browsingDataRemovalController; | 845 return _browsingDataRemovalController; |
| 851 } | 846 } |
| 852 | 847 |
| 853 - (void)setWebUsageEnabled:(BOOL)enabled { | 848 - (void)setWebUsageEnabled:(BOOL)enabled { |
| 854 DCHECK([NSThread isMainThread]); | 849 DCHECK([NSThread isMainThread]); |
| 855 if (enabled) { | 850 if (enabled) { |
| 856 [self activateBVCAndMakeCurrentBVCPrimary]; | 851 [self activateBVCAndMakeCurrentBVCPrimary]; |
| 857 } else { | 852 } else { |
| 858 [self.mainBVC setActive:NO]; | 853 [self.mainBVC setActive:NO]; |
| 859 [self.otrBVC setActive:NO]; | 854 [self.otrBVC setActive:NO]; |
| 860 } | 855 } |
| 861 } | 856 } |
| 862 | 857 |
| 863 - (void)activateBVCAndMakeCurrentBVCPrimary { | 858 - (void)activateBVCAndMakeCurrentBVCPrimary { |
| 864 // If there are pending removal operations, the activation will be deferred | 859 // If there are pending removal operations, the activation will be deferred |
| 865 // until the callback for |removeBrowsingDataFromBrowserState:| is received. | 860 // until the callback for |removeBrowsingDataFromBrowserState:| is received. |
| 866 if (![self.browsingDataRemovalController | 861 if (![self.browsingDataRemovalController |
| 867 hasPendingRemovalOperations:self.currentBrowserState]) { | 862 hasPendingRemovalOperations:self.currentBrowserState]) { |
| 868 [self.mainBVC setActive:YES]; | 863 [self.mainBVC setActive:YES]; |
| 869 [self.otrBVC setActive:YES]; | 864 [self.otrBVC setActive:YES]; |
| 870 | 865 |
| 871 [self.currentBVC setPrimary:YES]; | 866 [self.currentBVC setPrimary:YES]; |
| 872 } | 867 } |
| 873 } | 868 } |
| 874 | 869 |
| 875 #pragma mark - BrowserLauncher implementation. | 870 #pragma mark - BrowserLauncher implementation. |
| 876 | 871 |
| 877 - (NSDictionary*)launchOptions { | 872 - (NSDictionary*)launchOptions { |
|
gambard
2017/06/12 12:42:48
Synthesize?
marq (ping after 24h)
2017/06/12 14:25:09
Done.
| |
| 878 return _launchOptions; | 873 return _launchOptions; |
| 879 } | 874 } |
| 880 | 875 |
| 881 - (void)setLaunchOptions:(NSDictionary*)launchOptions { | 876 - (void)setLaunchOptions:(NSDictionary*)launchOptions { |
| 882 _launchOptions.reset([launchOptions retain]); | 877 _launchOptions = launchOptions; |
| 883 } | 878 } |
| 884 | 879 |
| 885 #pragma mark - Property implementation. | 880 #pragma mark - Property implementation. |
| 886 | 881 |
| 887 - (id<BrowserViewInformation>)browserViewInformation { | 882 - (id<BrowserViewInformation>)browserViewInformation { |
| 888 return _browserViewWrangler; | 883 return _browserViewWrangler; |
| 889 } | 884 } |
| 890 | 885 |
| 891 - (AppStartupParameters*)startupParameters { | 886 - (AppStartupParameters*)startupParameters { |
|
gambard
2017/06/12 12:42:48
Remove this getter and the setter below for a synt
marq (ping after 24h)
2017/06/12 14:25:09
Done.
| |
| 892 return _startupParameters; | 887 return _startupParameters; |
| 893 } | 888 } |
| 894 | 889 |
| 895 - (void)setStartupParameters:(AppStartupParameters*)startupParameters { | 890 - (void)setStartupParameters:(AppStartupParameters*)startupParameters { |
| 896 _startupParameters.reset([startupParameters retain]); | 891 _startupParameters = startupParameters; |
| 897 } | 892 } |
| 898 | 893 |
| 899 - (MainViewController*)mainViewController { | 894 - (MainViewController*)mainViewController { |
| 900 return self.mainCoordinator.mainViewController; | 895 return self.mainCoordinator.mainViewController; |
| 901 } | 896 } |
| 902 | 897 |
| 903 - (MainCoordinator*)mainCoordinator { | 898 - (MainCoordinator*)mainCoordinator { |
| 904 if (_browserInitializationStage == INITIALIZATION_STAGE_BASIC) { | 899 if (_browserInitializationStage == INITIALIZATION_STAGE_BASIC) { |
| 905 NOTREACHED() << "mainCoordinator accessed too early in initialization."; | 900 NOTREACHED() << "mainCoordinator accessed too early in initialization."; |
| 906 return nil; | 901 return nil; |
| 907 } | 902 } |
| 908 if (!_mainCoordinator) { | 903 if (!_mainCoordinator) { |
| 909 // Lazily create the main coordinator. | 904 // Lazily create the main coordinator. |
| 910 _mainCoordinator.reset( | 905 _mainCoordinator = [[MainCoordinator alloc] initWithWindow:self.window]; |
| 911 [[MainCoordinator alloc] initWithWindow:self.window]); | |
| 912 } | 906 } |
| 913 return _mainCoordinator; | 907 return _mainCoordinator; |
| 914 } | 908 } |
| 915 | 909 |
| 916 - (BOOL)isFirstLaunchAfterUpgrade { | 910 - (BOOL)isFirstLaunchAfterUpgrade { |
| 917 return [[PreviousSessionInfo sharedInstance] isFirstSessionAfterUpgrade]; | 911 return [[PreviousSessionInfo sharedInstance] isFirstSessionAfterUpgrade]; |
| 918 } | 912 } |
| 919 | 913 |
| 920 - (MetricsMediator*)metricsMediator { | 914 - (MetricsMediator*)metricsMediator { |
|
gambard
2017/06/12 12:42:47
Same, synthesize here and below instead?
marq (ping after 24h)
2017/06/12 14:25:09
Done.
| |
| 921 return _metricsMediator; | 915 return _metricsMediator; |
| 922 } | 916 } |
| 923 | 917 |
| 924 - (void)setMetricsMediator:(MetricsMediator*)metricsMediator { | 918 - (void)setMetricsMediator:(MetricsMediator*)metricsMediator { |
| 925 _metricsMediator.reset(metricsMediator); | 919 _metricsMediator = metricsMediator; |
| 926 } | 920 } |
| 927 | 921 |
| 928 - (SettingsNavigationController*)settingsNavigationController { | 922 - (SettingsNavigationController*)settingsNavigationController { |
|
gambard
2017/06/12 12:42:48
Same
marq (ping after 24h)
2017/06/12 14:25:09
Done.
| |
| 929 return _settingsNavigationController; | 923 return _settingsNavigationController; |
| 930 } | 924 } |
| 931 | 925 |
| 932 - (void)setSettingsNavigationController: | 926 - (void)setSettingsNavigationController: |
| 933 (SettingsNavigationController*)settingsNavigationController { | 927 (SettingsNavigationController*)settingsNavigationController { |
| 934 _settingsNavigationController.reset([settingsNavigationController retain]); | 928 _settingsNavigationController = settingsNavigationController; |
| 935 } | 929 } |
| 936 | 930 |
| 937 #pragma mark - StartupInformation implementation. | 931 #pragma mark - StartupInformation implementation. |
| 938 | 932 |
| 939 - (FirstUserActionRecorder*)firstUserActionRecorder { | 933 - (FirstUserActionRecorder*)firstUserActionRecorder { |
| 940 return _firstUserActionRecorder.get(); | 934 return _firstUserActionRecorder.get(); |
| 941 } | 935 } |
| 942 | 936 |
| 943 - (void)resetFirstUserActionRecorder { | 937 - (void)resetFirstUserActionRecorder { |
| 944 _firstUserActionRecorder.reset(); | 938 _firstUserActionRecorder.reset(); |
| 945 } | 939 } |
| 946 | 940 |
| 947 - (void)expireFirstUserActionRecorderAfterDelay:(NSTimeInterval)delay { | 941 - (void)expireFirstUserActionRecorderAfterDelay:(NSTimeInterval)delay { |
| 948 [self performSelector:@selector(expireFirstUserActionRecorder) | 942 [self performSelector:@selector(expireFirstUserActionRecorder) |
| 949 withObject:nil | 943 withObject:nil |
| 950 afterDelay:delay]; | 944 afterDelay:delay]; |
| 951 } | 945 } |
| 952 | 946 |
| 953 - (void)activateFirstUserActionRecorderWithBackgroundTime: | 947 - (void)activateFirstUserActionRecorderWithBackgroundTime: |
| 954 (NSTimeInterval)backgroundTime { | 948 (NSTimeInterval)backgroundTime { |
| 955 base::TimeDelta delta = base::TimeDelta::FromSeconds(backgroundTime); | 949 base::TimeDelta delta = base::TimeDelta::FromSeconds(backgroundTime); |
| 956 _firstUserActionRecorder.reset(new FirstUserActionRecorder(delta)); | 950 _firstUserActionRecorder.reset(new FirstUserActionRecorder(delta)); |
| 957 } | 951 } |
| 958 | 952 |
| 959 - (void)stopChromeMain { | 953 - (void)stopChromeMain { |
| 960 [_spotlightManager shutdown]; | 954 [_spotlightManager shutdown]; |
| 961 _spotlightManager.reset(); | 955 _spotlightManager = nil; |
| 962 | 956 |
| 963 _browserViewWrangler.reset(); | 957 _browserViewWrangler = nil; |
| 964 _chromeMain.reset(); | 958 _chromeMain.reset(); |
| 965 } | 959 } |
| 966 | 960 |
| 967 - (BOOL)isTabSwitcherActive { | 961 - (BOOL)isTabSwitcherActive { |
| 968 return _tabSwitcherIsActive; | 962 return _tabSwitcherIsActive; |
| 969 } | 963 } |
| 970 | 964 |
| 971 #pragma mark - BrowserViewInformation implementation. | 965 #pragma mark - BrowserViewInformation implementation. |
| 972 | 966 |
| 973 - (void)haltAllTabs { | 967 - (void)haltAllTabs { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1152 if (![self mustShowRestoreInfobar]) { | 1146 if (![self mustShowRestoreInfobar]) { |
| 1153 [self scheduleSnapshotPurge]; | 1147 [self scheduleSnapshotPurge]; |
| 1154 } | 1148 } |
| 1155 } | 1149 } |
| 1156 | 1150 |
| 1157 - (void)scheduleMemoryDebuggingTools { | 1151 - (void)scheduleMemoryDebuggingTools { |
| 1158 if (experimental_flags::IsMemoryDebuggingEnabled()) { | 1152 if (experimental_flags::IsMemoryDebuggingEnabled()) { |
| 1159 [[DeferredInitializationRunner sharedInstance] | 1153 [[DeferredInitializationRunner sharedInstance] |
| 1160 enqueueBlockNamed:kMemoryDebuggingToolsStartup | 1154 enqueueBlockNamed:kMemoryDebuggingToolsStartup |
| 1161 block:^{ | 1155 block:^{ |
| 1162 _memoryDebuggerManager.reset( | 1156 _memoryDebuggerManager = [[MemoryDebuggerManager alloc] |
| 1163 [[MemoryDebuggerManager alloc] | 1157 initWithView:self.window |
| 1164 initWithView:self.window | 1158 prefs:GetApplicationContext() |
| 1165 prefs:GetApplicationContext() | 1159 ->GetLocalState()]; |
| 1166 ->GetLocalState()]); | |
| 1167 }]; | 1160 }]; |
| 1168 } | 1161 } |
| 1169 } | 1162 } |
| 1170 | 1163 |
| 1171 - (void)startFreeMemoryMonitoring { | 1164 - (void)startFreeMemoryMonitoring { |
| 1172 base::PostTaskWithTraits( | 1165 base::PostTaskWithTraits( |
| 1173 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, | 1166 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 1174 base::BindOnce(&ios_internal::AsynchronousFreeMemoryMonitor)); | 1167 base::BindOnce(&ios_internal::AsynchronousFreeMemoryMonitor)); |
| 1175 } | 1168 } |
| 1176 | 1169 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1291 } | 1284 } |
| 1292 if (_tabSwitcherIsActive) | 1285 if (_tabSwitcherIsActive) |
| 1293 [self dismissTabSwitcherWithoutAnimationInModel:self.mainTabModel]; | 1286 [self dismissTabSwitcherWithoutAnimationInModel:self.mainTabModel]; |
| 1294 if (firstRun || [self shouldOpenNTPTabOnActivationOfTabModel:tabModel]) { | 1287 if (firstRun || [self shouldOpenNTPTabOnActivationOfTabModel:tabModel]) { |
| 1295 [self.currentBVC newTab:nil]; | 1288 [self.currentBVC newTab:nil]; |
| 1296 } | 1289 } |
| 1297 | 1290 |
| 1298 if (firstRun) { | 1291 if (firstRun) { |
| 1299 [self showFirstRunUI]; | 1292 [self showFirstRunUI]; |
| 1300 // Do not ever show the 'restore' infobar during first run. | 1293 // Do not ever show the 'restore' infobar during first run. |
| 1301 _restoreHelper.reset(); | 1294 _restoreHelper = nil; |
| 1302 } | 1295 } |
| 1303 } | 1296 } |
| 1304 | 1297 |
| 1305 - (void)showFirstRunUI { | 1298 - (void)showFirstRunUI { |
| 1306 // Register for notification when First Run is completed. | 1299 // Register for notification when First Run is completed. |
| 1307 // Some initializations are held back until First Run modal dialog | 1300 // Some initializations are held back until First Run modal dialog |
| 1308 // is dismissed. | 1301 // is dismissed. |
| 1309 [[NSNotificationCenter defaultCenter] | 1302 [[NSNotificationCenter defaultCenter] |
| 1310 addObserver:self | 1303 addObserver:self |
| 1311 selector:@selector(handleFirstRunUIWillFinish) | 1304 selector:@selector(handleFirstRunUIWillFinish) |
| 1312 name:kChromeFirstRunUIWillFinishNotification | 1305 name:kChromeFirstRunUIWillFinishNotification |
| 1313 object:nil]; | 1306 object:nil]; |
| 1314 [[NSNotificationCenter defaultCenter] | 1307 [[NSNotificationCenter defaultCenter] |
| 1315 addObserver:self | 1308 addObserver:self |
| 1316 selector:@selector(handleFirstRunUIDidFinish) | 1309 selector:@selector(handleFirstRunUIDidFinish) |
| 1317 name:kChromeFirstRunUIDidFinishNotification | 1310 name:kChromeFirstRunUIDidFinishNotification |
| 1318 object:nil]; | 1311 object:nil]; |
| 1319 | 1312 |
| 1320 base::scoped_nsobject<WelcomeToChromeViewController> welcomeToChrome( | 1313 WelcomeToChromeViewController* welcomeToChrome = |
| 1321 [[WelcomeToChromeViewController alloc] | 1314 [[WelcomeToChromeViewController alloc] |
| 1322 initWithBrowserState:_mainBrowserState | 1315 initWithBrowserState:_mainBrowserState |
| 1323 tabModel:self.mainTabModel]); | 1316 tabModel:self.mainTabModel]; |
| 1324 base::scoped_nsobject<UINavigationController> navController( | 1317 UINavigationController* navController = |
| 1325 [[OrientationLimitingNavigationController alloc] | 1318 [[OrientationLimitingNavigationController alloc] |
| 1326 initWithRootViewController:welcomeToChrome]); | 1319 initWithRootViewController:welcomeToChrome]; |
| 1327 [navController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; | 1320 [navController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; |
| 1328 CGRect appFrame = [[UIScreen mainScreen] bounds]; | 1321 CGRect appFrame = [[UIScreen mainScreen] bounds]; |
| 1329 [[navController view] setFrame:appFrame]; | 1322 [[navController view] setFrame:appFrame]; |
| 1330 _isPresentingFirstRunUI = YES; | 1323 _isPresentingFirstRunUI = YES; |
| 1331 [self.mainBVC presentViewController:navController animated:NO completion:nil]; | 1324 [self.mainBVC presentViewController:navController animated:NO completion:nil]; |
| 1332 } | 1325 } |
| 1333 | 1326 |
| 1334 - (void)crashIfRequested { | 1327 - (void)crashIfRequested { |
| 1335 if (experimental_flags::IsStartupCrashEnabled()) { | 1328 if (experimental_flags::IsStartupCrashEnabled()) { |
| 1336 // Flush out the value cached for | 1329 // Flush out the value cached for |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1382 | 1375 |
| 1383 break; | 1376 break; |
| 1384 } | 1377 } |
| 1385 } | 1378 } |
| 1386 } | 1379 } |
| 1387 | 1380 |
| 1388 - (void)showPromo:(UIViewController*)promo { | 1381 - (void)showPromo:(UIViewController*)promo { |
| 1389 // Make sure we have the BVC here with a valid profile. | 1382 // Make sure we have the BVC here with a valid profile. |
| 1390 DCHECK([self.currentBVC browserState]); | 1383 DCHECK([self.currentBVC browserState]); |
| 1391 | 1384 |
| 1392 base::scoped_nsobject<OrientationLimitingNavigationController> navController( | 1385 OrientationLimitingNavigationController* navController = |
| 1393 [[OrientationLimitingNavigationController alloc] | 1386 [[OrientationLimitingNavigationController alloc] |
| 1394 initWithRootViewController:promo]); | 1387 initWithRootViewController:promo]; |
| 1395 | 1388 |
| 1396 // Avoid presenting the promo if the current device orientation is not | 1389 // Avoid presenting the promo if the current device orientation is not |
| 1397 // supported. The promo will be presented at a later moment, when the device | 1390 // supported. The promo will be presented at a later moment, when the device |
| 1398 // orientation is supported. | 1391 // orientation is supported. |
| 1399 UIInterfaceOrientation orientation = | 1392 UIInterfaceOrientation orientation = |
| 1400 [UIApplication sharedApplication].statusBarOrientation; | 1393 [UIApplication sharedApplication].statusBarOrientation; |
| 1401 NSUInteger supportedOrientationsMask = | 1394 NSUInteger supportedOrientationsMask = |
| 1402 [navController supportedInterfaceOrientations]; | 1395 [navController supportedInterfaceOrientations]; |
| 1403 if (!((1 << orientation) & supportedOrientationsMask)) | 1396 if (!((1 << orientation) & supportedOrientationsMask)) |
| 1404 return; | 1397 return; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1423 break; | 1416 break; |
| 1424 case IDC_NEW_INCOGNITO_TAB: | 1417 case IDC_NEW_INCOGNITO_TAB: |
| 1425 [self createNewTabInBVC:self.otrBVC sender:sender]; | 1418 [self createNewTabInBVC:self.otrBVC sender:sender]; |
| 1426 break; | 1419 break; |
| 1427 case IDC_OPEN_URL: | 1420 case IDC_OPEN_URL: |
| 1428 [self openUrl:base::mac::ObjCCast<OpenUrlCommand>(sender)]; | 1421 [self openUrl:base::mac::ObjCCast<OpenUrlCommand>(sender)]; |
| 1429 break; | 1422 break; |
| 1430 case IDC_OPTIONS: | 1423 case IDC_OPTIONS: |
| 1431 [self showSettings]; | 1424 [self showSettings]; |
| 1432 break; | 1425 break; |
| 1433 case IDC_REPORT_AN_ISSUE: | 1426 case IDC_REPORT_AN_ISSUE: { |
| 1434 dispatch_async(dispatch_get_main_queue(), ^{ | 1427 dispatch_async(dispatch_get_main_queue(), ^{ |
| 1435 [self showReportAnIssue]; | 1428 [self showReportAnIssue]; |
| 1436 }); | 1429 }); |
| 1437 break; | 1430 } break; |
|
gambard
2017/06/12 12:42:48
Is this cl format? Why is break outside of the bra
| |
| 1438 case IDC_SHOW_SIGNIN_IOS: { | 1431 case IDC_SHOW_SIGNIN_IOS: { |
| 1439 ShowSigninCommand* command = | 1432 ShowSigninCommand* command = |
| 1440 base::mac::ObjCCastStrict<ShowSigninCommand>(sender); | 1433 base::mac::ObjCCastStrict<ShowSigninCommand>(sender); |
| 1441 if (command.operation == AUTHENTICATION_OPERATION_DISMISS) { | 1434 if (command.operation == AUTHENTICATION_OPERATION_DISMISS) { |
| 1442 [self dismissSigninInteractionController]; | 1435 [self dismissSigninInteractionController]; |
| 1443 } else { | 1436 } else { |
| 1444 [self showSigninWithOperation:command.operation | 1437 [self showSigninWithOperation:command.operation |
| 1445 identity:command.identity | 1438 identity:command.identity |
| 1446 accessPoint:command.accessPoint | 1439 accessPoint:command.accessPoint |
| 1447 promoAction:command.promoAction | 1440 promoAction:command.promoAction |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1458 break; | 1451 break; |
| 1459 case IDC_SHOW_SYNC_PASSPHRASE_SETTINGS: | 1452 case IDC_SHOW_SYNC_PASSPHRASE_SETTINGS: |
| 1460 [self showSyncEncryptionPassphrase]; | 1453 [self showSyncEncryptionPassphrase]; |
| 1461 break; | 1454 break; |
| 1462 case IDC_SHOW_SAVE_PASSWORDS_SETTINGS: | 1455 case IDC_SHOW_SAVE_PASSWORDS_SETTINGS: |
| 1463 [self showSavePasswordsSettings]; | 1456 [self showSavePasswordsSettings]; |
| 1464 break; | 1457 break; |
| 1465 case IDC_SHOW_HISTORY: | 1458 case IDC_SHOW_HISTORY: |
| 1466 [self showHistory]; | 1459 [self showHistory]; |
| 1467 break; | 1460 break; |
| 1468 case IDC_TOGGLE_TAB_SWITCHER: | 1461 case IDC_TOGGLE_TAB_SWITCHER: { |
| 1469 DCHECK(!_tabSwitcherIsActive); | 1462 DCHECK(!_tabSwitcherIsActive); |
| 1470 if (!_isProcessingVoiceSearchCommand) { | 1463 if (!_isProcessingVoiceSearchCommand) { |
| 1471 [self showTabSwitcher]; | 1464 [self showTabSwitcher]; |
| 1472 _isProcessingTabSwitcherCommand = YES; | 1465 _isProcessingTabSwitcherCommand = YES; |
| 1473 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, | 1466 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, |
| 1474 kExpectedTransitionDurationInNanoSeconds), | 1467 kExpectedTransitionDurationInNanoSeconds), |
| 1475 dispatch_get_main_queue(), ^{ | 1468 dispatch_get_main_queue(), ^{ |
| 1476 _isProcessingTabSwitcherCommand = NO; | 1469 _isProcessingTabSwitcherCommand = NO; |
| 1477 }); | 1470 }); |
| 1478 } | 1471 } |
| 1479 break; | 1472 } break; |
| 1473 | |
| 1480 case IDC_PRELOAD_VOICE_SEARCH: | 1474 case IDC_PRELOAD_VOICE_SEARCH: |
| 1481 [self.currentBVC chromeExecuteCommand:sender]; | 1475 [self.currentBVC chromeExecuteCommand:sender]; |
| 1482 break; | 1476 break; |
| 1483 case IDC_VOICE_SEARCH: | 1477 case IDC_VOICE_SEARCH: { |
| 1484 if (!_isProcessingTabSwitcherCommand) { | 1478 if (!_isProcessingTabSwitcherCommand) { |
| 1485 [self startVoiceSearch]; | 1479 [self startVoiceSearch]; |
| 1486 _isProcessingVoiceSearchCommand = YES; | 1480 _isProcessingVoiceSearchCommand = YES; |
| 1487 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, | 1481 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, |
| 1488 kExpectedTransitionDurationInNanoSeconds), | 1482 kExpectedTransitionDurationInNanoSeconds), |
| 1489 dispatch_get_main_queue(), ^{ | 1483 dispatch_get_main_queue(), ^{ |
| 1490 _isProcessingVoiceSearchCommand = NO; | 1484 _isProcessingVoiceSearchCommand = NO; |
| 1491 }); | 1485 }); |
| 1492 } | 1486 } |
| 1493 break; | 1487 } break; |
| 1488 | |
| 1494 case IDC_CLEAR_BROWSING_DATA_IOS: { | 1489 case IDC_CLEAR_BROWSING_DATA_IOS: { |
| 1495 // Clear both the main browser state and the associated incognito | 1490 // Clear both the main browser state and the associated incognito |
| 1496 // browser state. | 1491 // browser state. |
| 1497 ClearBrowsingDataCommand* command = | 1492 ClearBrowsingDataCommand* command = |
| 1498 base::mac::ObjCCastStrict<ClearBrowsingDataCommand>(sender); | 1493 base::mac::ObjCCastStrict<ClearBrowsingDataCommand>(sender); |
| 1499 ios::ChromeBrowserState* browserState = | 1494 ios::ChromeBrowserState* browserState = |
| 1500 [command browserState]->GetOriginalChromeBrowserState(); | 1495 [command browserState]->GetOriginalChromeBrowserState(); |
| 1501 int mask = [command mask]; | 1496 int mask = [command mask]; |
| 1502 browsing_data::TimePeriod timePeriod = [command timePeriod]; | 1497 browsing_data::TimePeriod timePeriod = [command timePeriod]; |
| 1503 [self removeBrowsingDataFromBrowserState:browserState | 1498 [self removeBrowsingDataFromBrowserState:browserState |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1663 #pragma mark - Tab closure handlers | 1658 #pragma mark - Tab closure handlers |
| 1664 | 1659 |
| 1665 - (void)lastIncognitoTabClosed { | 1660 - (void)lastIncognitoTabClosed { |
| 1666 DCHECK(_mainBrowserState->HasOffTheRecordChromeBrowserState()); | 1661 DCHECK(_mainBrowserState->HasOffTheRecordChromeBrowserState()); |
| 1667 [self clearIOSSpecificIncognitoData]; | 1662 [self clearIOSSpecificIncognitoData]; |
| 1668 | 1663 |
| 1669 // OffTheRecordProfileIOData cannot be deleted before all the requests are | 1664 // OffTheRecordProfileIOData cannot be deleted before all the requests are |
| 1670 // deleted. All of the request trackers associated with the closed OTR tabs | 1665 // deleted. All of the request trackers associated with the closed OTR tabs |
| 1671 // will have posted CancelRequest calls to the IO thread by now; this just | 1666 // will have posted CancelRequest calls to the IO thread by now; this just |
| 1672 // waits for those calls to run before calling |deleteIncognitoBrowserState|. | 1667 // waits for those calls to run before calling |deleteIncognitoBrowserState|. |
| 1673 web::RequestTrackerImpl::RunAfterRequestsCancel(base::BindBlock(^{ | 1668 web::RequestTrackerImpl::RunAfterRequestsCancel(base::BindBlockArc(^{ |
| 1674 [self deleteIncognitoBrowserState]; | 1669 [self deleteIncognitoBrowserState]; |
| 1675 })); | 1670 })); |
| 1676 | 1671 |
| 1677 // a) The first condition can happen when the last incognito tab is closed | 1672 // a) The first condition can happen when the last incognito tab is closed |
| 1678 // from the tab switcher. | 1673 // from the tab switcher. |
| 1679 // b) The second condition can happen if some other code (like JS) triggers | 1674 // b) The second condition can happen if some other code (like JS) triggers |
| 1680 // closure of tabs from the otr tab model when it's not current. | 1675 // closure of tabs from the otr tab model when it's not current. |
| 1681 // Nothing to do here. The next user action (like clicking on an existing | 1676 // Nothing to do here. The next user action (like clicking on an existing |
| 1682 // regular tab or creating a new incognito tab from the settings menu) will | 1677 // regular tab or creating a new incognito tab from the settings menu) will |
| 1683 // take care of the logic to mode switch. | 1678 // take care of the logic to mode switch. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1755 BrowserViewController* currentBVC = self.currentBVC; | 1750 BrowserViewController* currentBVC = self.currentBVC; |
| 1756 Tab* currentTab = [[currentBVC tabModel] currentTab]; | 1751 Tab* currentTab = [[currentBVC tabModel] currentTab]; |
| 1757 | 1752 |
| 1758 // In order to generate the transition between the current browser view | 1753 // In order to generate the transition between the current browser view |
| 1759 // controller and the tab switcher controller it's possible that multiple | 1754 // controller and the tab switcher controller it's possible that multiple |
| 1760 // screenshots of the same tab are taken. Since taking a screenshot is | 1755 // screenshots of the same tab are taken. Since taking a screenshot is |
| 1761 // expensive we activate snapshot coalescing in the scope of this function | 1756 // expensive we activate snapshot coalescing in the scope of this function |
| 1762 // which will cache the first snapshot for the tab and reuse it instead of | 1757 // which will cache the first snapshot for the tab and reuse it instead of |
| 1763 // regenerating a new one each time. | 1758 // regenerating a new one each time. |
| 1764 [currentTab setSnapshotCoalescingEnabled:YES]; | 1759 [currentTab setSnapshotCoalescingEnabled:YES]; |
| 1765 base::ScopedClosureRunner runner(base::BindBlock(^{ | 1760 base::ScopedClosureRunner runner(base::BindBlockArc(^{ |
| 1766 [currentTab setSnapshotCoalescingEnabled:NO]; | 1761 [currentTab setSnapshotCoalescingEnabled:NO]; |
| 1767 })); | 1762 })); |
| 1768 | 1763 |
| 1769 [currentBVC prepareToEnterTabSwitcher:nil]; | 1764 [currentBVC prepareToEnterTabSwitcher:nil]; |
| 1770 | 1765 |
| 1771 if (!_tabSwitcherController.get()) { | 1766 if (!_tabSwitcherController) { |
| 1772 if (IsIPadIdiom()) { | 1767 if (IsIPadIdiom()) { |
| 1773 _tabSwitcherController.reset([[TabSwitcherController alloc] | 1768 _tabSwitcherController = [[TabSwitcherController alloc] |
| 1774 initWithBrowserState:_mainBrowserState | 1769 initWithBrowserState:_mainBrowserState |
| 1775 mainTabModel:self.mainTabModel | 1770 mainTabModel:self.mainTabModel |
| 1776 otrTabModel:self.otrTabModel | 1771 otrTabModel:self.otrTabModel |
| 1777 activeTabModel:self.currentTabModel]); | 1772 activeTabModel:self.currentTabModel]; |
| 1778 } else { | 1773 } else { |
| 1779 _tabSwitcherController.reset([[StackViewController alloc] | 1774 _tabSwitcherController = [[StackViewController alloc] |
| 1780 initWithMainTabModel:self.mainTabModel | 1775 initWithMainTabModel:self.mainTabModel |
| 1781 otrTabModel:self.otrTabModel | 1776 otrTabModel:self.otrTabModel |
| 1782 activeTabModel:self.currentTabModel]); | 1777 activeTabModel:self.currentTabModel]; |
| 1783 } | 1778 } |
| 1784 } else { | 1779 } else { |
| 1785 // The StackViewController is kept in memory to avoid the performance hit of | 1780 // The StackViewController is kept in memory to avoid the performance hit of |
| 1786 // loading from the nib on next showing, but clears out its card models to | 1781 // loading from the nib on next showing, but clears out its card models to |
| 1787 // release memory. The tab models are required to rebuild the card stacks. | 1782 // release memory. The tab models are required to rebuild the card stacks. |
| 1788 [_tabSwitcherController | 1783 [_tabSwitcherController |
| 1789 restoreInternalStateWithMainTabModel:self.mainTabModel | 1784 restoreInternalStateWithMainTabModel:self.mainTabModel |
| 1790 otrTabModel:self.otrTabModel | 1785 otrTabModel:self.otrTabModel |
| 1791 activeTabModel:self.currentTabModel]; | 1786 activeTabModel:self.currentTabModel]; |
| 1792 } | 1787 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1881 // Prevent wayward touches from wreaking havoc while the stack view is being | 1876 // Prevent wayward touches from wreaking havoc while the stack view is being |
| 1882 // dismissed. | 1877 // dismissed. |
| 1883 [[_tabSwitcherController view] setUserInteractionEnabled:NO]; | 1878 [[_tabSwitcherController view] setUserInteractionEnabled:NO]; |
| 1884 BrowserViewController* targetBVC = | 1879 BrowserViewController* targetBVC = |
| 1885 (tabModel == self.mainTabModel) ? self.mainBVC : self.otrBVC; | 1880 (tabModel == self.mainTabModel) ? self.mainBVC : self.otrBVC; |
| 1886 self.currentBVC = targetBVC; | 1881 self.currentBVC = targetBVC; |
| 1887 } | 1882 } |
| 1888 | 1883 |
| 1889 - (void)finishDismissingStackView { | 1884 - (void)finishDismissingStackView { |
| 1890 DCHECK_EQ(self.mainViewController.activeViewController, | 1885 DCHECK_EQ(self.mainViewController.activeViewController, |
| 1891 _tabSwitcherController.get()); | 1886 _tabSwitcherController); |
| 1892 | 1887 |
| 1893 if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { | 1888 if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { |
| 1894 self.currentBVC = self.mainBVC; | 1889 self.currentBVC = self.mainBVC; |
| 1895 } else if (_modeToDisplayOnStackViewDismissal == | 1890 } else if (_modeToDisplayOnStackViewDismissal == |
| 1896 StackViewDismissalMode::INCOGNITO) { | 1891 StackViewDismissalMode::INCOGNITO) { |
| 1897 self.currentBVC = self.otrBVC; | 1892 self.currentBVC = self.otrBVC; |
| 1898 } | 1893 } |
| 1899 | 1894 |
| 1900 _modeToDisplayOnStackViewDismissal = StackViewDismissalMode::NONE; | 1895 _modeToDisplayOnStackViewDismissal = StackViewDismissalMode::NONE; |
| 1901 | 1896 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1954 removeBrowsingDataFromBrowserState:browserState | 1949 removeBrowsingDataFromBrowserState:browserState |
| 1955 mask:mask | 1950 mask:mask |
| 1956 timePeriod:timePeriod | 1951 timePeriod:timePeriod |
| 1957 completionHandler:browsingDataRemoved]; | 1952 completionHandler:browsingDataRemoved]; |
| 1958 } | 1953 } |
| 1959 | 1954 |
| 1960 #pragma mark - Navigation Controllers | 1955 #pragma mark - Navigation Controllers |
| 1961 | 1956 |
| 1962 - (void)presentSignedInAccountsViewControllerForBrowserState: | 1957 - (void)presentSignedInAccountsViewControllerForBrowserState: |
| 1963 (ios::ChromeBrowserState*)browserState { | 1958 (ios::ChromeBrowserState*)browserState { |
| 1964 base::scoped_nsobject<UIViewController> accountsViewController( | 1959 UIViewController* accountsViewController = [ |
| 1965 [[SignedInAccountsViewController alloc] | 1960 [SignedInAccountsViewController alloc] initWithBrowserState:browserState]; |
| 1966 initWithBrowserState:browserState]); | |
| 1967 [[self topPresentedViewController] | 1961 [[self topPresentedViewController] |
| 1968 presentViewController:accountsViewController | 1962 presentViewController:accountsViewController |
| 1969 animated:YES | 1963 animated:YES |
| 1970 completion:nil]; | 1964 completion:nil]; |
| 1971 } | 1965 } |
| 1972 | 1966 |
| 1973 - (void)showSettings { | 1967 - (void)showSettings { |
| 1974 if (_settingsNavigationController) | 1968 if (_settingsNavigationController) |
| 1975 return; | 1969 return; |
| 1976 [[DeferredInitializationRunner sharedInstance] | 1970 [[DeferredInitializationRunner sharedInstance] |
| 1977 runBlockIfNecessary:kPrefObserverInit]; | 1971 runBlockIfNecessary:kPrefObserverInit]; |
| 1978 DCHECK(_localStatePrefObserverBridge); | 1972 DCHECK(_localStatePrefObserverBridge); |
| 1979 _settingsNavigationController.reset([SettingsNavigationController | 1973 _settingsNavigationController = [SettingsNavigationController |
| 1980 newSettingsMainControllerWithMainBrowserState:_mainBrowserState | 1974 newSettingsMainControllerWithMainBrowserState:_mainBrowserState |
| 1981 currentBrowserState:self.currentBrowserState | 1975 currentBrowserState:self.currentBrowserState |
| 1982 delegate:self]); | 1976 delegate:self]; |
| 1983 [[self topPresentedViewController] | 1977 [[self topPresentedViewController] |
| 1984 presentViewController:_settingsNavigationController | 1978 presentViewController:_settingsNavigationController |
| 1985 animated:YES | 1979 animated:YES |
| 1986 completion:nil]; | 1980 completion:nil]; |
| 1987 } | 1981 } |
| 1988 | 1982 |
| 1989 - (void)showAccountsSettings { | 1983 - (void)showAccountsSettings { |
| 1990 if (_settingsNavigationController) | 1984 if (_settingsNavigationController) |
| 1991 return; | 1985 return; |
| 1992 if ([self currentBrowserState]->IsOffTheRecord()) { | 1986 if ([self currentBrowserState]->IsOffTheRecord()) { |
| 1993 NOTREACHED(); | 1987 NOTREACHED(); |
| 1994 return; | 1988 return; |
| 1995 } | 1989 } |
| 1996 _settingsNavigationController.reset([SettingsNavigationController | 1990 _settingsNavigationController = [SettingsNavigationController |
| 1997 newAccountsController:self.currentBrowserState | 1991 newAccountsController:self.currentBrowserState |
| 1998 delegate:self]); | 1992 delegate:self]; |
| 1999 [[self topPresentedViewController] | 1993 [[self topPresentedViewController] |
| 2000 presentViewController:_settingsNavigationController | 1994 presentViewController:_settingsNavigationController |
| 2001 animated:YES | 1995 animated:YES |
| 2002 completion:nil]; | 1996 completion:nil]; |
| 2003 } | 1997 } |
| 2004 | 1998 |
| 2005 - (void)showSyncSettings { | 1999 - (void)showSyncSettings { |
| 2006 if (_settingsNavigationController) | 2000 if (_settingsNavigationController) |
| 2007 return; | 2001 return; |
| 2008 _settingsNavigationController.reset([SettingsNavigationController | 2002 _settingsNavigationController = |
| 2009 newSyncController:_mainBrowserState | 2003 [SettingsNavigationController newSyncController:_mainBrowserState |
| 2010 allowSwitchSyncAccount:YES | 2004 allowSwitchSyncAccount:YES |
| 2011 delegate:self]); | 2005 delegate:self]; |
| 2012 [[self topPresentedViewController] | 2006 [[self topPresentedViewController] |
| 2013 presentViewController:_settingsNavigationController | 2007 presentViewController:_settingsNavigationController |
| 2014 animated:YES | 2008 animated:YES |
| 2015 completion:nil]; | 2009 completion:nil]; |
| 2016 } | 2010 } |
| 2017 | 2011 |
| 2018 - (void)showSavePasswordsSettings { | 2012 - (void)showSavePasswordsSettings { |
| 2019 if (_settingsNavigationController) | 2013 if (_settingsNavigationController) |
| 2020 return; | 2014 return; |
| 2021 _settingsNavigationController.reset([SettingsNavigationController | 2015 _settingsNavigationController = |
| 2022 newSavePasswordsController:_mainBrowserState | 2016 [SettingsNavigationController newSavePasswordsController:_mainBrowserState |
| 2023 delegate:self]); | 2017 delegate:self]; |
| 2024 [[self topPresentedViewController] | 2018 [[self topPresentedViewController] |
| 2025 presentViewController:_settingsNavigationController | 2019 presentViewController:_settingsNavigationController |
| 2026 animated:YES | 2020 animated:YES |
| 2027 completion:nil]; | 2021 completion:nil]; |
| 2028 } | 2022 } |
| 2029 | 2023 |
| 2030 - (void)showAutofillSettings { | 2024 - (void)showAutofillSettings { |
| 2031 if (_settingsNavigationController) | 2025 if (_settingsNavigationController) |
| 2032 return; | 2026 return; |
| 2033 _settingsNavigationController.reset([SettingsNavigationController | 2027 _settingsNavigationController = |
| 2034 newAutofillController:_mainBrowserState | 2028 [SettingsNavigationController newAutofillController:_mainBrowserState |
| 2035 delegate:self]); | 2029 delegate:self]; |
| 2036 [[self topPresentedViewController] | 2030 [[self topPresentedViewController] |
| 2037 presentViewController:_settingsNavigationController | 2031 presentViewController:_settingsNavigationController |
| 2038 animated:YES | 2032 animated:YES |
| 2039 completion:nil]; | 2033 completion:nil]; |
| 2040 } | 2034 } |
| 2041 | 2035 |
| 2042 - (void)showReportAnIssue { | 2036 - (void)showReportAnIssue { |
| 2043 if (_settingsNavigationController) | 2037 if (_settingsNavigationController) |
| 2044 return; | 2038 return; |
| 2045 _settingsNavigationController.reset([SettingsNavigationController | 2039 _settingsNavigationController = |
| 2046 newUserFeedbackController:_mainBrowserState | 2040 [SettingsNavigationController newUserFeedbackController:_mainBrowserState |
| 2047 delegate:self | 2041 delegate:self |
| 2048 feedbackDataSource:self]); | 2042 feedbackDataSource:self]; |
| 2049 [[self topPresentedViewController] | 2043 [[self topPresentedViewController] |
| 2050 presentViewController:_settingsNavigationController | 2044 presentViewController:_settingsNavigationController |
| 2051 animated:YES | 2045 animated:YES |
| 2052 completion:nil]; | 2046 completion:nil]; |
| 2053 } | 2047 } |
| 2054 | 2048 |
| 2055 - (void)showSyncEncryptionPassphrase { | 2049 - (void)showSyncEncryptionPassphrase { |
| 2056 if (_settingsNavigationController) | 2050 if (_settingsNavigationController) |
| 2057 return; | 2051 return; |
| 2058 _settingsNavigationController.reset([SettingsNavigationController | 2052 _settingsNavigationController = [SettingsNavigationController |
| 2059 newSyncEncryptionPassphraseController:_mainBrowserState | 2053 newSyncEncryptionPassphraseController:_mainBrowserState |
| 2060 delegate:self]); | 2054 delegate:self]; |
| 2061 [[self topPresentedViewController] | 2055 [[self topPresentedViewController] |
| 2062 presentViewController:_settingsNavigationController | 2056 presentViewController:_settingsNavigationController |
| 2063 animated:YES | 2057 animated:YES |
| 2064 completion:nil]; | 2058 completion:nil]; |
| 2065 } | 2059 } |
| 2066 | 2060 |
| 2067 - (void)showClearBrowsingDataSettingsController { | 2061 - (void)showClearBrowsingDataSettingsController { |
| 2068 if (_settingsNavigationController) | 2062 if (_settingsNavigationController) |
| 2069 return; | 2063 return; |
| 2070 _settingsNavigationController.reset([SettingsNavigationController | 2064 _settingsNavigationController = [SettingsNavigationController |
| 2071 newClearBrowsingDataController:_mainBrowserState | 2065 newClearBrowsingDataController:_mainBrowserState |
| 2072 delegate:self]); | 2066 delegate:self]; |
| 2073 [[self topPresentedViewController] | 2067 [[self topPresentedViewController] |
| 2074 presentViewController:_settingsNavigationController | 2068 presentViewController:_settingsNavigationController |
| 2075 animated:YES | 2069 animated:YES |
| 2076 completion:nil]; | 2070 completion:nil]; |
| 2077 } | 2071 } |
| 2078 | 2072 |
| 2079 - (void)showContextualSearchSettingsController { | 2073 - (void)showContextualSearchSettingsController { |
| 2080 if (_settingsNavigationController) | 2074 if (_settingsNavigationController) |
| 2081 return; | 2075 return; |
| 2082 _settingsNavigationController.reset([SettingsNavigationController | 2076 _settingsNavigationController = [SettingsNavigationController |
| 2083 newContextualSearchController:_mainBrowserState | 2077 newContextualSearchController:_mainBrowserState |
| 2084 delegate:self]); | 2078 delegate:self]; |
| 2085 [[self topPresentedViewController] | 2079 [[self topPresentedViewController] |
| 2086 presentViewController:_settingsNavigationController | 2080 presentViewController:_settingsNavigationController |
| 2087 animated:YES | 2081 animated:YES |
| 2088 completion:nil]; | 2082 completion:nil]; |
| 2089 } | 2083 } |
| 2090 | 2084 |
| 2091 - (void)showSigninWithOperation:(AuthenticationOperation)operation | 2085 - (void)showSigninWithOperation:(AuthenticationOperation)operation |
| 2092 identity:(ChromeIdentity*)identity | 2086 identity:(ChromeIdentity*)identity |
| 2093 accessPoint:(signin_metrics::AccessPoint)accessPoint | 2087 accessPoint:(signin_metrics::AccessPoint)accessPoint |
| 2094 promoAction:(signin_metrics::PromoAction)promoAction | 2088 promoAction:(signin_metrics::PromoAction)promoAction |
| 2095 callback:(ShowSigninCommandCompletionCallback)callback { | 2089 callback:(ShowSigninCommandCompletionCallback)callback { |
| 2096 DCHECK_NE(AUTHENTICATION_OPERATION_DISMISS, operation); | 2090 DCHECK_NE(AUTHENTICATION_OPERATION_DISMISS, operation); |
| 2097 | 2091 |
| 2098 if (_signinInteractionController) { | 2092 if (_signinInteractionController) { |
| 2099 // Avoid showing the sign in screen if there is already a sign-in operation | 2093 // Avoid showing the sign in screen if there is already a sign-in operation |
| 2100 // in progress. | 2094 // in progress. |
| 2101 return; | 2095 return; |
| 2102 } | 2096 } |
| 2103 | 2097 |
| 2104 BOOL areSettingsPresented = _settingsNavigationController != NULL; | 2098 BOOL areSettingsPresented = _settingsNavigationController != NULL; |
| 2105 _signinInteractionController.reset([[SigninInteractionController alloc] | 2099 _signinInteractionController = [[SigninInteractionController alloc] |
| 2106 initWithBrowserState:_mainBrowserState | 2100 initWithBrowserState:_mainBrowserState |
| 2107 presentingViewController:[self topPresentedViewController] | 2101 presentingViewController:[self topPresentedViewController] |
| 2108 isPresentedOnSettings:areSettingsPresented | 2102 isPresentedOnSettings:areSettingsPresented |
| 2109 accessPoint:accessPoint | 2103 accessPoint:accessPoint |
| 2110 promoAction:promoAction]); | 2104 promoAction:promoAction]; |
| 2111 | 2105 |
| 2112 signin_ui::CompletionCallback completion = ^(BOOL success) { | 2106 signin_ui::CompletionCallback completion = ^(BOOL success) { |
| 2113 _signinInteractionController.reset(); | 2107 _signinInteractionController = nil; |
| 2114 if (callback) | 2108 if (callback) |
| 2115 callback(success); | 2109 callback(success); |
| 2116 }; | 2110 }; |
| 2117 | 2111 |
| 2118 switch (operation) { | 2112 switch (operation) { |
| 2119 case AUTHENTICATION_OPERATION_DISMISS: | 2113 case AUTHENTICATION_OPERATION_DISMISS: |
| 2120 // Special case handled above. | 2114 // Special case handled above. |
| 2121 NOTREACHED(); | 2115 NOTREACHED(); |
| 2122 break; | 2116 break; |
| 2123 case AUTHENTICATION_OPERATION_REAUTHENTICATE: | 2117 case AUTHENTICATION_OPERATION_REAUTHENTICATE: |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2135 } | 2129 } |
| 2136 | 2130 |
| 2137 - (void)showAddAccount { | 2131 - (void)showAddAccount { |
| 2138 if (_signinInteractionController) { | 2132 if (_signinInteractionController) { |
| 2139 // Avoid showing the sign in screen if there is already a sign-in operation | 2133 // Avoid showing the sign in screen if there is already a sign-in operation |
| 2140 // in progress. | 2134 // in progress. |
| 2141 return; | 2135 return; |
| 2142 } | 2136 } |
| 2143 | 2137 |
| 2144 BOOL areSettingsPresented = _settingsNavigationController != NULL; | 2138 BOOL areSettingsPresented = _settingsNavigationController != NULL; |
| 2145 _signinInteractionController.reset([[SigninInteractionController alloc] | 2139 _signinInteractionController = [[SigninInteractionController alloc] |
| 2146 initWithBrowserState:_mainBrowserState | 2140 initWithBrowserState:_mainBrowserState |
| 2147 presentingViewController:[self topPresentedViewController] | 2141 presentingViewController:[self topPresentedViewController] |
| 2148 isPresentedOnSettings:areSettingsPresented | 2142 isPresentedOnSettings:areSettingsPresented |
| 2149 accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN | 2143 accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN |
| 2150 promoAction:signin_metrics::PromoAction:: | 2144 promoAction:signin_metrics::PromoAction:: |
| 2151 PROMO_ACTION_NO_SIGNIN_PROMO]); | 2145 PROMO_ACTION_NO_SIGNIN_PROMO]; |
| 2152 | 2146 |
| 2153 [_signinInteractionController | 2147 [_signinInteractionController |
| 2154 addAccountWithCompletion:^(BOOL success) { | 2148 addAccountWithCompletion:^(BOOL success) { |
| 2155 _signinInteractionController.reset(); | 2149 _signinInteractionController = nil; |
| 2156 } | 2150 } |
| 2157 viewController:self.mainViewController]; | 2151 viewController:self.mainViewController]; |
| 2158 } | 2152 } |
| 2159 | 2153 |
| 2160 - (void)showHistory { | 2154 - (void)showHistory { |
| 2161 _historyPanelViewController.reset([[HistoryPanelViewController | 2155 _historyPanelViewController = [HistoryPanelViewController |
| 2162 controllerToPresentForBrowserState:_mainBrowserState | 2156 controllerToPresentForBrowserState:_mainBrowserState |
| 2163 loader:self.currentBVC] retain]); | 2157 loader:self.currentBVC]; |
| 2164 [self.currentBVC presentViewController:_historyPanelViewController | 2158 [self.currentBVC presentViewController:_historyPanelViewController |
| 2165 animated:YES | 2159 animated:YES |
| 2166 completion:nil]; | 2160 completion:nil]; |
| 2167 } | 2161 } |
| 2168 | 2162 |
| 2169 - (void)dismissSigninInteractionController { | 2163 - (void)dismissSigninInteractionController { |
| 2170 // The sign-in interaction controller is destroyed as a result of calling | 2164 // The sign-in interaction controller is destroyed as a result of calling |
| 2171 // |cancelAndDismiss|. Destroying it here may lead to a missing call of the | 2165 // |cancelAndDismiss|. Destroying it here may lead to a missing call of the |
| 2172 // |ShowSigninCommandCompletionCallback| passed when starting a show sign-in | 2166 // |ShowSigninCommandCompletionCallback| passed when starting a show sign-in |
| 2173 // operation. | 2167 // operation. |
| 2174 [_signinInteractionController cancelAndDismiss]; | 2168 [_signinInteractionController cancelAndDismiss]; |
| 2175 } | 2169 } |
| 2176 | 2170 |
| 2177 - (ShowSigninCommandCompletionCallback)successfulSigninCompletion: | 2171 - (ShowSigninCommandCompletionCallback)successfulSigninCompletion: |
| 2178 (ProceduralBlock)callback { | 2172 (ProceduralBlock)callback { |
| 2179 return [[^(BOOL successful) { | 2173 return [^(BOOL successful) { |
| 2180 ios::ChromeBrowserState* browserState = [self currentBrowserState]; | 2174 ios::ChromeBrowserState* browserState = [self currentBrowserState]; |
| 2181 if (browserState->IsOffTheRecord()) { | 2175 if (browserState->IsOffTheRecord()) { |
| 2182 NOTREACHED() | 2176 NOTREACHED() |
| 2183 << "Ignore call to |handleSignInFinished| when in incognito."; | 2177 << "Ignore call to |handleSignInFinished| when in incognito."; |
| 2184 return; | 2178 return; |
| 2185 } | 2179 } |
| 2186 DCHECK_EQ(self.mainBVC, self.currentBVC); | 2180 DCHECK_EQ(self.mainBVC, self.currentBVC); |
| 2187 SigninManager* signinManager = | 2181 SigninManager* signinManager = |
| 2188 ios::SigninManagerFactory::GetForBrowserState(browserState); | 2182 ios::SigninManagerFactory::GetForBrowserState(browserState); |
| 2189 if (signinManager->IsAuthenticated()) | 2183 if (signinManager->IsAuthenticated()) |
| 2190 callback(); | 2184 callback(); |
| 2191 } copy] autorelease]; | 2185 } copy]; |
| 2192 } | 2186 } |
| 2193 | 2187 |
| 2194 - (void)showNativeAppsSettings { | 2188 - (void)showNativeAppsSettings { |
| 2195 if (_settingsNavigationController) | 2189 if (_settingsNavigationController) |
| 2196 return; | 2190 return; |
| 2197 _settingsNavigationController.reset([SettingsNavigationController | 2191 _settingsNavigationController = |
| 2198 newNativeAppsController:_mainBrowserState | 2192 [SettingsNavigationController newNativeAppsController:_mainBrowserState |
| 2199 delegate:self]); | 2193 delegate:self]; |
| 2200 [[self topPresentedViewController] | 2194 [[self topPresentedViewController] |
| 2201 presentViewController:_settingsNavigationController | 2195 presentViewController:_settingsNavigationController |
| 2202 animated:YES | 2196 animated:YES |
| 2203 completion:nil]; | 2197 completion:nil]; |
| 2204 } | 2198 } |
| 2205 | 2199 |
| 2206 - (void)closeSettingsAnimated:(BOOL)animated | 2200 - (void)closeSettingsAnimated:(BOOL)animated |
| 2207 completion:(ProceduralBlock)completion { | 2201 completion:(ProceduralBlock)completion { |
| 2208 DCHECK(_settingsNavigationController); | 2202 DCHECK(_settingsNavigationController); |
| 2209 [_settingsNavigationController settingsWillBeDismissed]; | 2203 [_settingsNavigationController settingsWillBeDismissed]; |
| 2210 UIViewController* presentingViewController = | 2204 UIViewController* presentingViewController = |
| 2211 [_settingsNavigationController presentingViewController]; | 2205 [_settingsNavigationController presentingViewController]; |
| 2212 DCHECK(presentingViewController); | 2206 DCHECK(presentingViewController); |
| 2213 [presentingViewController dismissViewControllerAnimated:animated | 2207 [presentingViewController dismissViewControllerAnimated:animated |
| 2214 completion:^{ | 2208 completion:^{ |
| 2215 if (completion) | 2209 if (completion) |
| 2216 completion(); | 2210 completion(); |
| 2217 }]; | 2211 }]; |
| 2218 _settingsNavigationController.reset(); | 2212 _settingsNavigationController = nil; |
| 2219 } | 2213 } |
| 2220 | 2214 |
| 2221 #pragma mark - TabModelObserver | 2215 #pragma mark - TabModelObserver |
| 2222 | 2216 |
| 2223 // Called when the number of tabs changes. Triggers the switcher view when | 2217 // Called when the number of tabs changes. Triggers the switcher view when |
| 2224 // the last tab is closed on a device that uses the switcher. | 2218 // the last tab is closed on a device that uses the switcher. |
| 2225 - (void)tabModelDidChangeTabCount:(TabModel*)notifiedTabModel { | 2219 - (void)tabModelDidChangeTabCount:(TabModel*)notifiedTabModel { |
| 2226 TabModel* currentTabModel = [self currentTabModel]; | 2220 TabModel* currentTabModel = [self currentTabModel]; |
| 2227 // Do nothing on initialization. | 2221 // Do nothing on initialization. |
| 2228 if (!currentTabModel) | 2222 if (!currentTabModel) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2334 [self.currentBVC focusOmnibox]; | 2328 [self.currentBVC focusOmnibox]; |
| 2335 }); | 2329 }); |
| 2336 } | 2330 } |
| 2337 } | 2331 } |
| 2338 | 2332 |
| 2339 if (_restoreHelper) { | 2333 if (_restoreHelper) { |
| 2340 // Now that all the operations on the tabs have been done, display the | 2334 // Now that all the operations on the tabs have been done, display the |
| 2341 // restore infobar if needed. | 2335 // restore infobar if needed. |
| 2342 dispatch_async(dispatch_get_main_queue(), ^{ | 2336 dispatch_async(dispatch_get_main_queue(), ^{ |
| 2343 [_restoreHelper showRestoreIfNeeded:[self currentTabModel]]; | 2337 [_restoreHelper showRestoreIfNeeded:[self currentTabModel]]; |
| 2344 _restoreHelper.reset(); | 2338 _restoreHelper = nil; |
| 2345 }); | 2339 }); |
| 2346 } | 2340 } |
| 2347 | 2341 |
| 2348 return tab; | 2342 return tab; |
| 2349 } | 2343 } |
| 2350 | 2344 |
| 2351 - (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion { | 2345 - (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion { |
| 2352 // Immediately hide modals from the provider (alert views, action sheets, | 2346 // Immediately hide modals from the provider (alert views, action sheets, |
| 2353 // popovers). They will be ultimately dismissed by their owners, but at least, | 2347 // popovers). They will be ultimately dismissed by their owners, but at least, |
| 2354 // they are not visible. | 2348 // they are not visible. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2555 @end | 2549 @end |
| 2556 | 2550 |
| 2557 #pragma mark - TestingOnly | 2551 #pragma mark - TestingOnly |
| 2558 | 2552 |
| 2559 @implementation MainController (TestingOnly) | 2553 @implementation MainController (TestingOnly) |
| 2560 | 2554 |
| 2561 - (DeviceSharingManager*)deviceSharingManager { | 2555 - (DeviceSharingManager*)deviceSharingManager { |
| 2562 return [_browserViewWrangler deviceSharingManager]; | 2556 return [_browserViewWrangler deviceSharingManager]; |
| 2563 } | 2557 } |
| 2564 | 2558 |
| 2565 - (UIViewController<TabSwitcher>*)tabSwitcherController { | 2559 - (UIViewController<TabSwitcher>*)tabSwitcherController { |
|
gambard
2017/06/12 12:42:48
Synthesize?
marq (ping after 24h)
2017/06/12 14:25:09
These properties are only declared in the TestingO
gambard
2017/06/12 14:44:54
Acknowledged.
| |
| 2566 return _tabSwitcherController.get(); | 2560 return _tabSwitcherController; |
| 2567 } | 2561 } |
| 2568 | 2562 |
| 2569 - (void)setTabSwitcherController:(UIViewController<TabSwitcher>*)controller { | 2563 - (void)setTabSwitcherController:(UIViewController<TabSwitcher>*)controller { |
| 2570 _tabSwitcherController.reset([controller retain]); | 2564 _tabSwitcherController = controller; |
| 2571 } | 2565 } |
| 2572 | 2566 |
| 2573 - (SigninInteractionController*)signinInteractionController { | 2567 - (SigninInteractionController*)signinInteractionController { |
|
gambard
2017/06/12 12:42:48
Synthesize?
marq (ping after 24h)
2017/06/12 14:25:09
See above.
| |
| 2574 return _signinInteractionController.get(); | 2568 return _signinInteractionController; |
| 2575 } | 2569 } |
| 2576 | 2570 |
| 2577 - (UIViewController*)topPresentedViewController { | 2571 - (UIViewController*)topPresentedViewController { |
| 2578 return top_view_controller::TopPresentedViewControllerFrom( | 2572 return top_view_controller::TopPresentedViewControllerFrom( |
| 2579 self.mainViewController); | 2573 self.mainViewController); |
| 2580 } | 2574 } |
| 2581 | 2575 |
| 2582 - (void)setTabSwitcherActive:(BOOL)active { | 2576 - (void)setTabSwitcherActive:(BOOL)active { |
|
gambard
2017/06/12 12:42:48
Synthesize
marq (ping after 24h)
2017/06/12 14:25:09
Not for this CL, and also see above.
| |
| 2583 _tabSwitcherIsActive = active; | 2577 _tabSwitcherIsActive = active; |
| 2584 } | 2578 } |
| 2585 | 2579 |
| 2586 - (BOOL)dismissingTabSwitcher { | 2580 - (BOOL)dismissingTabSwitcher { |
|
gambard
2017/06/12 12:42:48
Synthesize
marq (ping after 24h)
2017/06/12 14:25:09
Not for this CL, and also see above.
| |
| 2587 return _dismissingStackView; | 2581 return _dismissingStackView; |
| 2588 } | 2582 } |
| 2589 | 2583 |
| 2590 - (void)setStartupParametersWithURL:(const GURL&)launchURL { | 2584 - (void)setStartupParametersWithURL:(const GURL&)launchURL { |
| 2591 NSString* sourceApplication = @"Fake App"; | 2585 NSString* sourceApplication = @"Fake App"; |
| 2592 _startupParameters.reset([[ChromeAppStartupParameters | 2586 _startupParameters = [ChromeAppStartupParameters |
| 2593 newChromeAppStartupParametersWithURL:net::NSURLWithGURL(launchURL) | 2587 newChromeAppStartupParametersWithURL:net::NSURLWithGURL(launchURL) |
| 2594 fromSourceApplication:sourceApplication] retain]); | 2588 fromSourceApplication:sourceApplication]; |
| 2595 } | 2589 } |
| 2596 | 2590 |
| 2597 - (void)setUpAsForegrounded { | 2591 - (void)setUpAsForegrounded { |
| 2598 _isColdStart = NO; | 2592 _isColdStart = NO; |
| 2599 _browserInitializationStage = INITIALIZATION_STAGE_FOREGROUND; | 2593 _browserInitializationStage = INITIALIZATION_STAGE_FOREGROUND; |
| 2600 // Create a BrowserViewWrangler with a null browser state. This will trigger | 2594 // Create a BrowserViewWrangler with a null browser state. This will trigger |
| 2601 // assertions if the BrowserViewWrangler is asked to create any BVC or | 2595 // assertions if the BrowserViewWrangler is asked to create any BVC or |
| 2602 // tabModel objects, but it will accept assignments to them. | 2596 // tabModel objects, but it will accept assignments to them. |
| 2603 _browserViewWrangler.reset([[BrowserViewWrangler alloc] | 2597 _browserViewWrangler = |
| 2604 initWithBrowserState:nullptr | 2598 [[BrowserViewWrangler alloc] initWithBrowserState:nullptr |
| 2605 tabModelObserver:self]); | 2599 tabModelObserver:self]; |
| 2606 // This is a test utility method that bypasses the ususal setup steps, so | 2600 // This is a test utility method that bypasses the ususal setup steps, so |
| 2607 // verify that the main coordinator hasn't been created yet, then start it | 2601 // verify that the main coordinator hasn't been created yet, then start it |
| 2608 // via lazy initialization. | 2602 // via lazy initialization. |
| 2609 DCHECK(!_mainCoordinator); | 2603 DCHECK(!_mainCoordinator); |
| 2610 [self.mainCoordinator start]; | 2604 [self.mainCoordinator start]; |
| 2611 } | 2605 } |
| 2612 | 2606 |
| 2613 - (void)setUpForTestingWithCompletionHandler: | 2607 - (void)setUpForTestingWithCompletionHandler: |
| 2614 (ProceduralBlock)completionHandler { | 2608 (ProceduralBlock)completionHandler { |
| 2615 self.currentBVC = self.mainBVC; | 2609 self.currentBVC = self.mainBVC; |
| 2616 | 2610 |
| 2617 int removeAllMask = ~0; | 2611 int removeAllMask = ~0; |
| 2618 scoped_refptr<CallbackCounter> callbackCounter = | 2612 scoped_refptr<CallbackCounter> callbackCounter = |
| 2619 new CallbackCounter(base::BindBlock(^{ | 2613 new CallbackCounter(base::BindBlockArc(^{ |
| 2620 [self setUpCurrentBVCForTesting]; | 2614 [self setUpCurrentBVCForTesting]; |
| 2621 if (completionHandler) { | 2615 if (completionHandler) { |
| 2622 completionHandler(); | 2616 completionHandler(); |
| 2623 } | 2617 } |
| 2624 })); | 2618 })); |
| 2625 id decrementCallbackCounterCount = ^{ | 2619 id decrementCallbackCounterCount = ^{ |
| 2626 callbackCounter->DecrementCount(); | 2620 callbackCounter->DecrementCount(); |
| 2627 }; | 2621 }; |
| 2628 | 2622 |
| 2629 callbackCounter->IncrementCount(); | 2623 callbackCounter->IncrementCount(); |
| 2630 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2624 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2631 mask:removeAllMask | 2625 mask:removeAllMask |
| 2632 timePeriod:browsing_data::TimePeriod::ALL_TIME | 2626 timePeriod:browsing_data::TimePeriod::ALL_TIME |
| 2633 completionHandler:decrementCallbackCounterCount]; | 2627 completionHandler:decrementCallbackCounterCount]; |
| 2634 } | 2628 } |
| 2635 | 2629 |
| 2636 @end | 2630 @end |
| OLD | NEW |