OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 #include "content/public/browser/browser_thread.h" | 85 #include "content/public/browser/browser_thread.h" |
86 #include "content/public/browser/child_process_security_policy.h" | 86 #include "content/public/browser/child_process_security_policy.h" |
87 #include "content/public/browser/notification_details.h" | 87 #include "content/public/browser/notification_details.h" |
88 #include "content/public/browser/plugin_service.h" | 88 #include "content/public/browser/plugin_service.h" |
89 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
90 #include "content/public/browser/resource_dispatcher_host.h" | 90 #include "content/public/browser/resource_dispatcher_host.h" |
91 #include "content/public/browser/service_worker_context.h" | 91 #include "content/public/browser/service_worker_context.h" |
92 #include "content/public/browser/storage_partition.h" | 92 #include "content/public/browser/storage_partition.h" |
93 #include "extensions/common/constants.h" | 93 #include "extensions/common/constants.h" |
94 #include "extensions/common/extension_l10n_util.h" | 94 #include "extensions/common/extension_l10n_util.h" |
95 #include "google_apis/gaia/identity_provider.h" | 95 #include "google_apis/gaia/identity_provider.h" |
bartfab (slow)
2014/06/13 11:27:21
Nit: No longer used.
jianli
2014/06/13 18:04:48
Done.
| |
96 #include "net/socket/client_socket_pool_manager.h" | 96 #include "net/socket/client_socket_pool_manager.h" |
97 #include "net/url_request/url_request_context_getter.h" | 97 #include "net/url_request/url_request_context_getter.h" |
98 #include "ui/base/l10n/l10n_util.h" | 98 #include "ui/base/l10n/l10n_util.h" |
99 #include "ui/message_center/message_center.h" | 99 #include "ui/message_center/message_center.h" |
100 | 100 |
101 #if defined(ENABLE_CONFIGURATION_POLICY) | 101 #if defined(ENABLE_CONFIGURATION_POLICY) |
102 #include "components/policy/core/browser/browser_policy_connector.h" | 102 #include "components/policy/core/browser/browser_policy_connector.h" |
103 #else | 103 #else |
104 #include "components/policy/core/common/policy_service_stub.h" | 104 #include "components/policy/core/common/policy_service_stub.h" |
105 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 105 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
(...skipping 15 matching lines...) Expand all Loading... | |
121 #endif | 121 #endif |
122 | 122 |
123 #if defined(ENABLE_PLUGIN_INSTALLATION) | 123 #if defined(ENABLE_PLUGIN_INSTALLATION) |
124 #include "chrome/browser/plugins/plugins_resource_service.h" | 124 #include "chrome/browser/plugins/plugins_resource_service.h" |
125 #endif | 125 #endif |
126 | 126 |
127 #if defined(ENABLE_WEBRTC) | 127 #if defined(ENABLE_WEBRTC) |
128 #include "chrome/browser/media/webrtc_log_uploader.h" | 128 #include "chrome/browser/media/webrtc_log_uploader.h" |
129 #endif | 129 #endif |
130 | 130 |
131 #if defined(OS_CHROMEOS) | |
132 #include "chrome/browser/chromeos/settings/device_identity_provider.h" | |
133 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " | |
134 #elif !defined(OS_ANDROID) | |
135 #include "google_apis/gaia/dummy_identity_provider.h" | |
136 #endif | |
137 | |
138 #if defined(OS_ANDROID) | 131 #if defined(OS_ANDROID) |
139 #include "components/gcm_driver/gcm_driver_android.h" | 132 #include "components/gcm_driver/gcm_driver_android.h" |
140 #else | 133 #else |
141 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" | 134 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" |
142 #include "components/gcm_driver/gcm_client_factory.h" | 135 #include "components/gcm_driver/gcm_client_factory.h" |
143 #endif | 136 #endif |
144 | 137 |
145 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 138 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
146 // How often to check if the persistent instance of Chrome needs to restart | 139 // How often to check if the persistent instance of Chrome needs to restart |
147 // to install an update. | 140 // to install an update. |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 void BrowserProcessImpl::CreateGCMDriver() { | 1017 void BrowserProcessImpl::CreateGCMDriver() { |
1025 DCHECK(!gcm_driver_); | 1018 DCHECK(!gcm_driver_); |
1026 | 1019 |
1027 #if defined(OS_ANDROID) | 1020 #if defined(OS_ANDROID) |
1028 gcm_driver_.reset(new gcm::GCMDriverAndroid); | 1021 gcm_driver_.reset(new gcm::GCMDriverAndroid); |
1029 #else | 1022 #else |
1030 base::FilePath store_path; | 1023 base::FilePath store_path; |
1031 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); | 1024 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); |
1032 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 1025 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
1033 make_scoped_ptr(new gcm::GCMClientFactory), | 1026 make_scoped_ptr(new gcm::GCMClientFactory), |
1034 #if defined(OS_CHROMEOS) | |
1035 scoped_ptr<IdentityProvider>(new chromeos::DeviceIdentityProvider( | |
1036 chromeos::DeviceOAuth2TokenServiceFactory::Get())), | |
1037 #else | |
1038 scoped_ptr<IdentityProvider>(new DummyIdentityProvider), | |
1039 #endif // defined(OS_CHROMEOS) | |
1040 store_path, | 1027 store_path, |
1041 system_request_context()); | 1028 system_request_context()); |
1029 // TODO(jianli): to be removed when sign-in enforcement is dropped. | |
bartfab (slow)
2014/06/13 11:27:21
Nit: s/to/To/
jianli
2014/06/13 18:04:48
Done.
| |
1030 gcm_driver_->SignIn(); | |
1042 #endif // defined(OS_ANDROID) | 1031 #endif // defined(OS_ANDROID) |
1043 } | 1032 } |
1044 | 1033 |
1045 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1034 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
1046 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1035 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
1047 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 1036 scoped_refptr<ShellIntegration::DefaultWebClientWorker> |
1048 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 1037 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); |
1049 set_browser_worker->StartSetAsDefault(); | 1038 set_browser_worker->StartSetAsDefault(); |
1050 } | 1039 } |
1051 } | 1040 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 } | 1104 } |
1116 | 1105 |
1117 void BrowserProcessImpl::OnAutoupdateTimer() { | 1106 void BrowserProcessImpl::OnAutoupdateTimer() { |
1118 if (CanAutorestartForUpdate()) { | 1107 if (CanAutorestartForUpdate()) { |
1119 DLOG(WARNING) << "Detected update. Restarting browser."; | 1108 DLOG(WARNING) << "Detected update. Restarting browser."; |
1120 RestartBackgroundInstance(); | 1109 RestartBackgroundInstance(); |
1121 } | 1110 } |
1122 } | 1111 } |
1123 | 1112 |
1124 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1113 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |