| 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> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #import "ios/chrome/browser/ui/stack_view/stack_view_controller.h" | 120 #import "ios/chrome/browser/ui/stack_view/stack_view_controller.h" |
| 121 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.h" | 121 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.h" |
| 122 #import "ios/chrome/browser/ui/tabs/tab_strip_controller+tab_switcher_animation.
h" | 122 #import "ios/chrome/browser/ui/tabs/tab_strip_controller+tab_switcher_animation.
h" |
| 123 #include "ios/chrome/browser/ui/ui_util.h" | 123 #include "ios/chrome/browser/ui/ui_util.h" |
| 124 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 124 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 125 #import "ios/chrome/browser/ui/util/top_view_controller.h" | 125 #import "ios/chrome/browser/ui/util/top_view_controller.h" |
| 126 #import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" | 126 #import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" |
| 127 #include "ios/chrome/browser/xcallback_parameters.h" | 127 #include "ios/chrome/browser/xcallback_parameters.h" |
| 128 #include "ios/chrome/grit/ios_strings.h" | 128 #include "ios/chrome/grit/ios_strings.h" |
| 129 #include "ios/net/cookies/cookie_store_ios.h" | 129 #include "ios/net/cookies/cookie_store_ios.h" |
| 130 #import "ios/net/crn_http_protocol_handler.h" | |
| 131 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 130 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 132 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" | 131 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" |
| 133 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" | 132 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" |
| 134 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" | 133 #include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" |
| 135 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" | 134 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" |
| 136 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 135 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 137 #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" |
| 138 #include "ios/web/net/request_tracker_factory_impl.h" | 137 #include "ios/web/net/request_tracker_factory_impl.h" |
| 139 #include "ios/web/net/request_tracker_impl.h" | 138 #include "ios/web/net/request_tracker_impl.h" |
| 140 #include "ios/web/net/web_http_protocol_handler_delegate.h" | |
| 141 #import "ios/web/public/navigation_manager.h" | 139 #import "ios/web/public/navigation_manager.h" |
| 142 #include "ios/web/public/web_capabilities.h" | 140 #include "ios/web/public/web_capabilities.h" |
| 143 #include "ios/web/public/web_state/web_state.h" | 141 #include "ios/web/public/web_state/web_state.h" |
| 144 #import "ios/web/public/web_view_creation_util.h" | 142 #import "ios/web/public/web_view_creation_util.h" |
| 145 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" | 143 #include "ios/web/public/webui/web_ui_ios_controller_factory.h" |
| 146 #include "mojo/edk/embedder/embedder.h" | 144 #include "mojo/edk/embedder/embedder.h" |
| 147 #import "net/base/mac/url_conversions.h" | 145 #import "net/base/mac/url_conversions.h" |
| 148 #include "net/url_request/url_request_context.h" | 146 #include "net/url_request/url_request_context.h" |
| 149 #include "ui/base/l10n/l10n_util.h" | 147 #include "ui/base/l10n/l10n_util.h" |
| 150 | 148 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 308 |
| 311 // Keeps track of the restore state during startup. | 309 // Keeps track of the restore state during startup. |
| 312 base::scoped_nsobject<CrashRestoreHelper> _restoreHelper; | 310 base::scoped_nsobject<CrashRestoreHelper> _restoreHelper; |
| 313 | 311 |
| 314 // An object to record metrics related to the user's first action. | 312 // An object to record metrics related to the user's first action. |
| 315 std::unique_ptr<FirstUserActionRecorder> _firstUserActionRecorder; | 313 std::unique_ptr<FirstUserActionRecorder> _firstUserActionRecorder; |
| 316 | 314 |
| 317 // RequestTrackerFactory to customize the behavior of the network stack. | 315 // RequestTrackerFactory to customize the behavior of the network stack. |
| 318 std::unique_ptr<web::RequestTrackerFactoryImpl> _requestTrackerFactory; | 316 std::unique_ptr<web::RequestTrackerFactoryImpl> _requestTrackerFactory; |
| 319 | 317 |
| 320 // Configuration for the HTTP protocol handler. | |
| 321 std::unique_ptr<web::WebHTTPProtocolHandlerDelegate> | |
| 322 _httpProtocolHandlerDelegate; | |
| 323 | |
| 324 // True if First Run UI (terms of service & sync sign-in) is being presented | 318 // True if First Run UI (terms of service & sync sign-in) is being presented |
| 325 // in a modal dialog. | 319 // in a modal dialog. |
| 326 BOOL _isPresentingFirstRunUI; | 320 BOOL _isPresentingFirstRunUI; |
| 327 | 321 |
| 328 // The tab switcher command and the voice search commands can be sent by views | 322 // The tab switcher command and the voice search commands can be sent by views |
| 329 // that reside in a different UIWindow leading to the fact that the exclusive | 323 // that reside in a different UIWindow leading to the fact that the exclusive |
| 330 // touch property will be ineffective and a command for processing both | 324 // touch property will be ineffective and a command for processing both |
| 331 // commands may be sent in the same run of the runloop leading to | 325 // commands may be sent in the same run of the runloop leading to |
| 332 // inconsistencies. Those two boolean indicate if one of those commands have | 326 // inconsistencies. Those two boolean indicate if one of those commands have |
| 333 // been processed in the last 200ms in order to only allow processing one at | 327 // been processed in the last 200ms in order to only allow processing one at |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 - (instancetype)init { | 558 - (instancetype)init { |
| 565 if ((self = [super init])) { | 559 if ((self = [super init])) { |
| 566 _propertyReleaser_MainController.Init(self, [MainController class]); | 560 _propertyReleaser_MainController.Init(self, [MainController class]); |
| 567 _startupTasks.reset([[StartupTasks alloc] init]); | 561 _startupTasks.reset([[StartupTasks alloc] init]); |
| 568 } | 562 } |
| 569 return self; | 563 return self; |
| 570 } | 564 } |
| 571 | 565 |
| 572 - (void)dealloc { | 566 - (void)dealloc { |
| 573 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 567 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 574 net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); | |
| 575 net::RequestTracker::SetRequestTrackerFactory(nullptr); | 568 net::RequestTracker::SetRequestTrackerFactory(nullptr); |
| 576 [NSObject cancelPreviousPerformRequestsWithTarget:self]; | 569 [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| 577 [super dealloc]; | 570 [super dealloc]; |
| 578 } | 571 } |
| 579 | 572 |
| 580 // This function starts up to only what is needed at each stage of the | 573 // This function starts up to only what is needed at each stage of the |
| 581 // initialization. It is possible to continue initialization later. | 574 // initialization. It is possible to continue initialization later. |
| 582 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { | 575 - (void)startUpBrowserToStage:(BrowserInitializationStageType)stage { |
| 583 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && | 576 if (_browserInitializationStage < INITIALIZATION_STAGE_BASIC && |
| 584 stage >= INITIALIZATION_STAGE_BASIC) { | 577 stage >= INITIALIZATION_STAGE_BASIC) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 // TODO(crbug.com/507633): Call this even sooner. | 633 // TODO(crbug.com/507633): Call this even sooner. |
| 641 if (_appState.userInteracted) | 634 if (_appState.userInteracted) |
| 642 GetApplicationContext()->GetMetricsService()->OnAppEnterForeground(); | 635 GetApplicationContext()->GetMetricsService()->OnAppEnterForeground(); |
| 643 | 636 |
| 644 web::WebUIIOSControllerFactory::RegisterFactory( | 637 web::WebUIIOSControllerFactory::RegisterFactory( |
| 645 ChromeWebUIIOSControllerFactory::GetInstance()); | 638 ChromeWebUIIOSControllerFactory::GetInstance()); |
| 646 | 639 |
| 647 // TODO(crbug.com/546171): Audit all the following code to see if some of it | 640 // TODO(crbug.com/546171): Audit all the following code to see if some of it |
| 648 // should move into BrowserMainParts or BrowserProcess. | 641 // should move into BrowserMainParts or BrowserProcess. |
| 649 | 642 |
| 650 [NetworkStackSetup setUpChromeNetworkStack:&_requestTrackerFactory | 643 _requestTrackerFactory = [NetworkStackSetup setUpChromeNetworkStack]; |
| 651 httpProtocolHandlerDelegate:&_httpProtocolHandlerDelegate]; | |
| 652 } | 644 } |
| 653 | 645 |
| 654 - (void)startUpBrowserForegroundInitialization { | 646 - (void)startUpBrowserForegroundInitialization { |
| 655 // Give tests a chance to prepare for testing. | 647 // Give tests a chance to prepare for testing. |
| 656 tests_hook::SetUpTestsIfPresent(); | 648 tests_hook::SetUpTestsIfPresent(); |
| 657 | 649 |
| 658 GetApplicationContext()->OnAppEnterForeground(); | 650 GetApplicationContext()->OnAppEnterForeground(); |
| 659 | 651 |
| 660 // TODO(crbug.com/546171): Audit all the following code to see if some of it | 652 // TODO(crbug.com/546171): Audit all the following code to see if some of it |
| 661 // should move into BrowserMainParts or BrowserProcess. | 653 // should move into BrowserMainParts or BrowserProcess. |
| (...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2697 }; | 2689 }; |
| 2698 | 2690 |
| 2699 callbackCounter->IncrementCount(); | 2691 callbackCounter->IncrementCount(); |
| 2700 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2692 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2701 mask:removeAllMask | 2693 mask:removeAllMask |
| 2702 timePeriod:browsing_data::ALL_TIME | 2694 timePeriod:browsing_data::ALL_TIME |
| 2703 completionHandler:decrementCallbackCounterCount]; | 2695 completionHandler:decrementCallbackCounterCount]; |
| 2704 } | 2696 } |
| 2705 | 2697 |
| 2706 @end | 2698 @end |
| OLD | NEW |