| 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" | 21 #include "base/mac/objc_release_properties.h" |
| 22 #import "base/mac/scoped_nsobject.h" | 22 #import "base/mac/scoped_nsobject.h" |
| 23 #include "base/macros.h" | 23 #include "base/macros.h" |
| 24 #include "base/path_service.h" | 24 #include "base/path_service.h" |
| 25 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
| 26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 27 #include "components/component_updater/component_updater_service.h" | 27 #include "components/component_updater/component_updater_service.h" |
| 28 #include "components/content_settings/core/browser/host_content_settings_map.h" | 28 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 29 #include "components/metrics/metrics_pref_names.h" | 29 #include "components/metrics/metrics_pref_names.h" |
| 30 #include "components/metrics/metrics_service.h" | 30 #include "components/metrics/metrics_service.h" |
| 31 #include "components/prefs/pref_change_registrar.h" | 31 #include "components/prefs/pref_change_registrar.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 PrefChangeRegistrar _localStatePrefChangeRegistrar; | 344 PrefChangeRegistrar _localStatePrefChangeRegistrar; |
| 345 | 345 |
| 346 // Clears browsing data from ChromeBrowserStates. | 346 // Clears browsing data from ChromeBrowserStates. |
| 347 base::scoped_nsobject<BrowsingDataRemovalController> | 347 base::scoped_nsobject<BrowsingDataRemovalController> |
| 348 _browsingDataRemovalController; | 348 _browsingDataRemovalController; |
| 349 | 349 |
| 350 // The class in charge of showing/hiding the memory debugger when the | 350 // The class in charge of showing/hiding the memory debugger when the |
| 351 // appropriate pref changes. | 351 // appropriate pref changes. |
| 352 base::scoped_nsobject<MemoryDebuggerManager> _memoryDebuggerManager; | 352 base::scoped_nsobject<MemoryDebuggerManager> _memoryDebuggerManager; |
| 353 | 353 |
| 354 base::mac::ObjCPropertyReleaser _propertyReleaser_MainController; | |
| 355 | |
| 356 // Responsible for indexing chrome links (such as bookmarks, most likely...) | 354 // Responsible for indexing chrome links (such as bookmarks, most likely...) |
| 357 // in system Spotlight index. | 355 // in system Spotlight index. |
| 358 base::scoped_nsobject<SpotlightManager> _spotlightManager; | 356 base::scoped_nsobject<SpotlightManager> _spotlightManager; |
| 359 | 357 |
| 360 // Cached launchOptions from -didFinishLaunchingWithOptions. | 358 // Cached launchOptions from -didFinishLaunchingWithOptions. |
| 361 base::scoped_nsobject<NSDictionary> _launchOptions; | 359 base::scoped_nsobject<NSDictionary> _launchOptions; |
| 362 | 360 |
| 363 // View controller for displaying the history panel. | 361 // View controller for displaying the history panel. |
| 364 base::scoped_nsobject<UIViewController> _historyPanelViewController; | 362 base::scoped_nsobject<UIViewController> _historyPanelViewController; |
| 365 | 363 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 @synthesize appLaunchTime = _appLaunchTime; | 554 @synthesize appLaunchTime = _appLaunchTime; |
| 557 @synthesize browserInitializationStage = _browserInitializationStage; | 555 @synthesize browserInitializationStage = _browserInitializationStage; |
| 558 @synthesize window = _window; | 556 @synthesize window = _window; |
| 559 @synthesize isPresentingFirstRunUI = _isPresentingFirstRunUI; | 557 @synthesize isPresentingFirstRunUI = _isPresentingFirstRunUI; |
| 560 @synthesize isColdStart = _isColdStart; | 558 @synthesize isColdStart = _isColdStart; |
| 561 | 559 |
| 562 #pragma mark - Application lifecycle | 560 #pragma mark - Application lifecycle |
| 563 | 561 |
| 564 - (instancetype)init { | 562 - (instancetype)init { |
| 565 if ((self = [super init])) { | 563 if ((self = [super init])) { |
| 566 _propertyReleaser_MainController.Init(self, [MainController class]); | |
| 567 _startupTasks.reset([[StartupTasks alloc] init]); | 564 _startupTasks.reset([[StartupTasks alloc] init]); |
| 568 } | 565 } |
| 569 return self; | 566 return self; |
| 570 } | 567 } |
| 571 | 568 |
| 572 - (void)dealloc { | 569 - (void)dealloc { |
| 573 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 570 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 574 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); | 571 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); |
| 575 net::RequestTracker::SetRequestTrackerFactory(nullptr); | 572 net::RequestTracker::SetRequestTrackerFactory(nullptr); |
| 576 [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 573 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| 574 base::mac::ReleaseProperties(self); |
| 577 [super dealloc]; | 575 [super dealloc]; |
| 578 } | 576 } |
| 579 | 577 |
| 580 // This function starts up to only what is needed at each stage of the | 578 // This function starts up to only what is needed at each stage of the |
| 581 // initialization. It is possible to continue initialization later. | 579 // initialization. It is possible to continue initialization later. |
| 582 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { | 580 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { |
| 583 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && | 581 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && |
| 584 stage >= INITIALIZATION_STAGE_BASIC) { | 582 stage >= INITIALIZATION_STAGE_BASIC) { |
| 585 [self startUpBrowserBasicInitialization]; | 583 [self startUpBrowserBasicInitialization]; |
| 586 _browserInitializationStage = INITIALIZATION_STAGE_BASIC; | 584 _browserInitializationStage = INITIALIZATION_STAGE_BASIC; |
| (...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 }; | 2701 }; |
| 2704 | 2702 |
| 2705 callbackCounter->IncrementCount(); | 2703 callbackCounter->IncrementCount(); |
| 2706 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2704 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2707 mask:removeAllMask | 2705 mask:removeAllMask |
| 2708 timePeriod:browsing_data::ALL_TIME | 2706 timePeriod:browsing_data::ALL_TIME |
| 2709 completionHandler:decrementCallbackCounterCount]; | 2707 completionHandler:decrementCallbackCounterCount]; |
| 2710 } | 2708 } |
| 2711 | 2709 |
| 2712 @end | 2710 @end |
| OLD | NEW |