OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/application_delegate/app_state.h" | 5 #import "ios/chrome/app/application_delegate/app_state.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/callback.h" |
7 #include "base/critical_closure.h" | 10 #include "base/critical_closure.h" |
8 #import "base/mac/bind_objc_block.h" | 11 #import "base/mac/bind_objc_block.h" |
9 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
10 #include "components/metrics/metrics_service.h" | 13 #include "components/metrics/metrics_service.h" |
11 #import "ios/chrome/app/main_application_delegate.h" | |
12 #import "ios/chrome/app/application_delegate/app_navigation.h" | 14 #import "ios/chrome/app/application_delegate/app_navigation.h" |
13 #import "ios/chrome/app/application_delegate/browser_launcher.h" | 15 #import "ios/chrome/app/application_delegate/browser_launcher.h" |
14 #import "ios/chrome/app/application_delegate/memory_warning_helper.h" | 16 #import "ios/chrome/app/application_delegate/memory_warning_helper.h" |
15 #import "ios/chrome/app/application_delegate/metrics_mediator.h" | 17 #import "ios/chrome/app/application_delegate/metrics_mediator.h" |
16 #import "ios/chrome/app/application_delegate/startup_information.h" | 18 #import "ios/chrome/app/application_delegate/startup_information.h" |
17 #import "ios/chrome/app/application_delegate/tab_opening.h" | 19 #import "ios/chrome/app/application_delegate/tab_opening.h" |
18 #import "ios/chrome/app/application_delegate/tab_switching.h" | 20 #import "ios/chrome/app/application_delegate/tab_switching.h" |
19 #import "ios/chrome/app/application_delegate/user_activity_handler.h" | 21 #import "ios/chrome/app/application_delegate/user_activity_handler.h" |
20 #import "ios/chrome/app/deferred_initialization_runner.h" | 22 #import "ios/chrome/app/deferred_initialization_runner.h" |
| 23 #import "ios/chrome/app/main_application_delegate.h" |
21 #import "ios/chrome/app/safe_mode/safe_mode_coordinator.h" | 24 #import "ios/chrome/app/safe_mode/safe_mode_coordinator.h" |
22 #import "ios/chrome/app/safe_mode_crashing_modules_config.h" | 25 #import "ios/chrome/app/safe_mode_crashing_modules_config.h" |
23 #include "ios/chrome/browser/application_context.h" | 26 #include "ios/chrome/browser/application_context.h" |
24 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 27 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
25 #include "ios/chrome/browser/chrome_constants.h" | 28 #include "ios/chrome/browser/chrome_constants.h" |
26 #include "ios/chrome/browser/crash_loop_detection_util.h" | 29 #include "ios/chrome/browser/crash_loop_detection_util.h" |
27 #include "ios/chrome/browser/crash_report/breakpad_helper.h" | 30 #include "ios/chrome/browser/crash_report/breakpad_helper.h" |
28 #import "ios/chrome/browser/crash_report/crash_report_background_uploader.h" | 31 #import "ios/chrome/browser/crash_report/crash_report_background_uploader.h" |
29 #import "ios/chrome/browser/device_sharing/device_sharing_manager.h" | 32 #import "ios/chrome/browser/device_sharing/device_sharing_manager.h" |
30 #import "ios/chrome/browser/geolocation/omnibox_geolocation_config.h" | 33 #import "ios/chrome/browser/geolocation/omnibox_geolocation_config.h" |
31 #import "ios/chrome/browser/metrics/previous_session_info.h" | 34 #import "ios/chrome/browser/metrics/previous_session_info.h" |
32 #import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller
.h" | 35 #import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller
.h" |
33 #include "ios/chrome/browser/ui/background_generator.h" | 36 #include "ios/chrome/browser/ui/background_generator.h" |
34 #import "ios/chrome/browser/ui/browser_view_controller.h" | 37 #import "ios/chrome/browser/ui/browser_view_controller.h" |
35 #import "ios/chrome/browser/ui/main/browser_view_information.h" | 38 #import "ios/chrome/browser/ui/main/browser_view_information.h" |
36 #include "ios/net/cookies/cookie_store_ios.h" | 39 #include "ios/net/cookies/cookie_store_ios.h" |
37 #include "ios/net/cookies/system_cookie_util.h" | 40 #include "ios/net/cookies/system_cookie_util.h" |
38 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 41 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
39 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" | 42 #include "ios/public/provider/chrome/browser/distribution/app_distribution_provi
der.h" |
40 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" | 43 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider
.h" |
41 #include "ios/web/net/request_tracker_impl.h" | 44 #include "ios/web/net/request_tracker_impl.h" |
42 #include "net/url_request/url_request_context.h" | 45 #include "net/url_request/url_request_context.h" |
43 | 46 |
44 #if !defined(__has_feature) || !__has_feature(objc_arc) | 47 #if !defined(__has_feature) || !__has_feature(objc_arc) |
45 #error "This file requires ARC support." | 48 #error "This file requires ARC support." |
46 #endif | 49 #endif |
47 | 50 |
48 namespace { | 51 namespace { |
49 // Helper method to post |closure| on the UI thread. | 52 // Helper method to post |closure| on the UI thread. |
50 void PostTaskOnUIThread(const base::Closure& closure) { | 53 void PostTaskOnUIThread(base::Closure closure) { |
51 web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, closure); | 54 web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, std::move(closure)); |
52 } | 55 } |
53 NSString* const kStartupAttemptReset = @"StartupAttempReset"; | 56 NSString* const kStartupAttemptReset = @"StartupAttempReset"; |
54 } // namespace | 57 } // namespace |
55 | 58 |
56 @interface AppState ()<SafeModeCoordinatorDelegate> { | 59 @interface AppState ()<SafeModeCoordinatorDelegate> { |
57 // Container for startup information. | 60 // Container for startup information. |
58 __weak id<StartupInformation> _startupInformation; | 61 __weak id<StartupInformation> _startupInformation; |
59 // Browser launcher to launch browser in different states. | 62 // Browser launcher to launch browser in different states. |
60 __weak id<BrowserLauncher> _browserLauncher; | 63 __weak id<BrowserLauncher> _browserLauncher; |
61 // UIApplicationDelegate for the application. | 64 // UIApplicationDelegate for the application. |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 self = [self initWithBrowserLauncher:browserLauncher | 500 self = [self initWithBrowserLauncher:browserLauncher |
498 startupInformation:startupInformation | 501 startupInformation:startupInformation |
499 applicationDelegate:applicationDelegate]; | 502 applicationDelegate:applicationDelegate]; |
500 if (self) { | 503 if (self) { |
501 _shouldOpenNTPTabOnActive = shouldOpenNTP; | 504 _shouldOpenNTPTabOnActive = shouldOpenNTP; |
502 } | 505 } |
503 return self; | 506 return self; |
504 } | 507 } |
505 | 508 |
506 @end | 509 @end |
OLD | NEW |