| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 #import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" | 125 #import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" |
| 126 #include "ios/chrome/browser/xcallback_parameters.h" | 126 #include "ios/chrome/browser/xcallback_parameters.h" |
| 127 #include "ios/net/cookies/cookie_store_ios.h" | 127 #include "ios/net/cookies/cookie_store_ios.h" |
| 128 #import "ios/net/crn_http_protocol_handler.h" | 128 #import "ios/net/crn_http_protocol_handler.h" |
| 129 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 129 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 130 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" | 130 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" |
| 131 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" | 131 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" |
| 132 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 132 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
| 133 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" | 133 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" |
| 134 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 134 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 135 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MDCTypographyAd
ditions/MDFRobotoFontLoader+MDCTypographyAdditions.h" |
| 135 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 136 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
| 136 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MDCTypographyAd
ditions/MDFRobotoFontLoader+MDCTypographyAdditions.h" | |
| 137 #include "ios/web/net/request_tracker_factory_impl.h" | 137 #include "ios/web/net/request_tracker_factory_impl.h" |
| 138 #include "ios/web/net/request_tracker_impl.h" | 138 #include "ios/web/net/request_tracker_impl.h" |
| 139 #include "ios/web/net/web_http_protocol_handler_delegate.h" | 139 #include "ios/web/net/web_http_protocol_handler_delegate.h" |
| 140 #import "ios/web/public/navigation_manager.h" | 140 #import "ios/web/public/navigation_manager.h" |
| 141 #include "ios/web/public/web_capabilities.h" | 141 #include "ios/web/public/web_capabilities.h" |
| 142 #include "ios/web/public/web_state/web_state.h" | 142 #include "ios/web/public/web_state/web_state.h" |
| 143 #import "ios/web/public/web_view_creation_util.h" | 143 #import "ios/web/public/web_view_creation_util.h" |
| 144 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" | 144 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" |
| 145 #include "mojo/edk/embedder/embedder.h" | 145 #include "mojo/edk/embedder/embedder.h" |
| 146 #import "net/base/mac/url_conversions.h" | 146 #import "net/base/mac/url_conversions.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 PrefChangeRegistrar _localStatePrefChangeRegistrar; | 324 PrefChangeRegistrar _localStatePrefChangeRegistrar; |
| 325 | 325 |
| 326 // Clears browsing data from ChromeBrowserStates. | 326 // Clears browsing data from ChromeBrowserStates. |
| 327 base::scoped_nsobject<BrowsingDataRemovalController> | 327 base::scoped_nsobject<BrowsingDataRemovalController> |
| 328 _browsingDataRemovalController; | 328 _browsingDataRemovalController; |
| 329 | 329 |
| 330 // The class in charge of showing/hiding the memory debugger when the | 330 // The class in charge of showing/hiding the memory debugger when the |
| 331 // appropriate pref changes. | 331 // appropriate pref changes. |
| 332 base::scoped_nsobject<MemoryDebuggerManager> _memoryDebuggerManager; | 332 base::scoped_nsobject<MemoryDebuggerManager> _memoryDebuggerManager; |
| 333 | 333 |
| 334 base::mac::ObjCPropertyReleaser _propertyReleaser_MainController; | |
| 335 | |
| 336 // Responsible for indexing chrome links (such as bookmarks, most likely...) | 334 // Responsible for indexing chrome links (such as bookmarks, most likely...) |
| 337 // in system Spotlight index. | 335 // in system Spotlight index. |
| 338 base::scoped_nsobject<SpotlightManager> _spotlightManager; | 336 base::scoped_nsobject<SpotlightManager> _spotlightManager; |
| 339 | 337 |
| 340 // Cached launchOptions from -didFinishLaunchingWithOptions. | 338 // Cached launchOptions from -didFinishLaunchingWithOptions. |
| 341 base::scoped_nsobject<NSDictionary> _launchOptions; | 339 base::scoped_nsobject<NSDictionary> _launchOptions; |
| 342 | 340 |
| 343 // View controller for displaying the history panel. | 341 // View controller for displaying the history panel. |
| 344 base::scoped_nsobject<UIViewController> _historyPanelViewController; | 342 base::scoped_nsobject<UIViewController> _historyPanelViewController; |
| 345 | 343 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 _startVoiceSearchAfterTabSwitcherDismissal; | 540 _startVoiceSearchAfterTabSwitcherDismissal; |
| 543 @synthesize startQRScannerAfterTabSwitcherDismissal = | 541 @synthesize startQRScannerAfterTabSwitcherDismissal = |
| 544 _startQRScannerAfterTabSwitcherDismissal; | 542 _startQRScannerAfterTabSwitcherDismissal; |
| 545 @synthesize startFocusOmniboxAfterTabSwitcherDismissal = | 543 @synthesize startFocusOmniboxAfterTabSwitcherDismissal = |
| 546 _startFocusOmniboxAfterTabSwitcherDismissal; | 544 _startFocusOmniboxAfterTabSwitcherDismissal; |
| 547 | 545 |
| 548 #pragma mark - Application lifecycle | 546 #pragma mark - Application lifecycle |
| 549 | 547 |
| 550 - (instancetype)init { | 548 - (instancetype)init { |
| 551 if ((self = [super init])) { | 549 if ((self = [super init])) { |
| 552 _propertyReleaser_MainController.Init(self, [MainController class]); | |
| 553 _startupTasks.reset([[StartupTasks alloc] init]); | 550 _startupTasks.reset([[StartupTasks alloc] init]); |
| 554 } | 551 } |
| 555 return self; | 552 return self; |
| 556 } | 553 } |
| 557 | 554 |
| 558 - (void)dealloc { | 555 - (void)dealloc { |
| 559 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 556 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 560 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); | 557 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); |
| 561 net::RequestTracker::SetRequestTrackerFactory(nullptr); | 558 net::RequestTracker::SetRequestTrackerFactory(nullptr); |
| 562 [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 559 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| 560 base::mac::ReleaseProperties(self); |
| 563 [super dealloc]; | 561 [super dealloc]; |
| 564 } | 562 } |
| 565 | 563 |
| 566 // This function starts up to only what is needed at each stage of the | 564 // This function starts up to only what is needed at each stage of the |
| 567 // initialization. It is possible to continue initialization later. | 565 // initialization. It is possible to continue initialization later. |
| 568 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { | 566 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { |
| 569 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && | 567 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && |
| 570 stage >= INITIALIZATION_STAGE_BASIC) { | 568 stage >= INITIALIZATION_STAGE_BASIC) { |
| 571 [self startUpBrowserBasicInitialization]; | 569 [self startUpBrowserBasicInitialization]; |
| 572 _browserInitializationStage = INITIALIZATION_STAGE_BASIC; | 570 _browserInitializationStage = INITIALIZATION_STAGE_BASIC; |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2624 }; | 2622 }; |
| 2625 | 2623 |
| 2626 callbackCounter->IncrementCount(); | 2624 callbackCounter->IncrementCount(); |
| 2627 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2625 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2628 mask:removeAllMask | 2626 mask:removeAllMask |
| 2629 timePeriod:browsing_data::TimePeriod::ALL_TIME | 2627 timePeriod:browsing_data::TimePeriod::ALL_TIME |
| 2630 completionHandler:decrementCallbackCounterCount]; | 2628 completionHandler:decrementCallbackCounterCount]; |
| 2631 } | 2629 } |
| 2632 | 2630 |
| 2633 @end | 2631 @end |
| OLD | NEW |