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" | |
96 #include "net/socket/client_socket_pool_manager.h" | 95 #include "net/socket/client_socket_pool_manager.h" |
97 #include "net/url_request/url_request_context_getter.h" | 96 #include "net/url_request/url_request_context_getter.h" |
98 #include "ui/base/l10n/l10n_util.h" | 97 #include "ui/base/l10n/l10n_util.h" |
99 #include "ui/message_center/message_center.h" | 98 #include "ui/message_center/message_center.h" |
100 | 99 |
101 #if defined(ENABLE_CONFIGURATION_POLICY) | 100 #if defined(ENABLE_CONFIGURATION_POLICY) |
102 #include "components/policy/core/browser/browser_policy_connector.h" | 101 #include "components/policy/core/browser/browser_policy_connector.h" |
103 #else | 102 #else |
104 #include "components/policy/core/common/policy_service_stub.h" | 103 #include "components/policy/core/common/policy_service_stub.h" |
105 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 104 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
(...skipping 15 matching lines...) Expand all Loading... | |
121 #endif | 120 #endif |
122 | 121 |
123 #if defined(ENABLE_PLUGIN_INSTALLATION) | 122 #if defined(ENABLE_PLUGIN_INSTALLATION) |
124 #include "chrome/browser/plugins/plugins_resource_service.h" | 123 #include "chrome/browser/plugins/plugins_resource_service.h" |
125 #endif | 124 #endif |
126 | 125 |
127 #if defined(ENABLE_WEBRTC) | 126 #if defined(ENABLE_WEBRTC) |
128 #include "chrome/browser/media/webrtc_log_uploader.h" | 127 #include "chrome/browser/media/webrtc_log_uploader.h" |
129 #endif | 128 #endif |
130 | 129 |
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) | 130 #if defined(OS_ANDROID) |
139 #include "components/gcm_driver/gcm_driver_android.h" | 131 #include "components/gcm_driver/gcm_driver_android.h" |
140 #else | 132 #else |
141 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" | 133 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" |
142 #include "components/gcm_driver/gcm_client_factory.h" | 134 #include "components/gcm_driver/gcm_client_factory.h" |
143 #endif | 135 #endif |
144 | 136 |
145 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 137 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
146 // How often to check if the persistent instance of Chrome needs to restart | 138 // How often to check if the persistent instance of Chrome needs to restart |
147 // to install an update. | 139 // to install an update. |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 void BrowserProcessImpl::CreateGCMDriver() { | 1016 void BrowserProcessImpl::CreateGCMDriver() { |
1025 DCHECK(!gcm_driver_); | 1017 DCHECK(!gcm_driver_); |
1026 | 1018 |
1027 #if defined(OS_ANDROID) | 1019 #if defined(OS_ANDROID) |
1028 gcm_driver_.reset(new gcm::GCMDriverAndroid); | 1020 gcm_driver_.reset(new gcm::GCMDriverAndroid); |
1029 #else | 1021 #else |
1030 base::FilePath store_path; | 1022 base::FilePath store_path; |
1031 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); | 1023 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); |
1032 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 1024 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
1033 make_scoped_ptr(new gcm::GCMClientFactory), | 1025 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, | 1026 store_path, |
1041 system_request_context()); | 1027 system_request_context()); |
1028 // TODO(jianli): To be removed when sign-in enforcement is dropped. | |
1029 gcm_driver_->SignIn(); | |
Nicolas Zea
2014/06/13 19:50:24
Why is this here? Isn't signin getting called by t
jianli
2014/06/13 21:58:04
For device-level GCM usage, we don't have sign-in
| |
1042 #endif // defined(OS_ANDROID) | 1030 #endif // defined(OS_ANDROID) |
1043 } | 1031 } |
1044 | 1032 |
1045 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1033 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
1046 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1034 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
1047 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 1035 scoped_refptr<ShellIntegration::DefaultWebClientWorker> |
1048 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 1036 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); |
1049 set_browser_worker->StartSetAsDefault(); | 1037 set_browser_worker->StartSetAsDefault(); |
1050 } | 1038 } |
1051 } | 1039 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 } | 1103 } |
1116 | 1104 |
1117 void BrowserProcessImpl::OnAutoupdateTimer() { | 1105 void BrowserProcessImpl::OnAutoupdateTimer() { |
1118 if (CanAutorestartForUpdate()) { | 1106 if (CanAutorestartForUpdate()) { |
1119 DLOG(WARNING) << "Detected update. Restarting browser."; | 1107 DLOG(WARNING) << "Detected update. Restarting browser."; |
1120 RestartBackgroundInstance(); | 1108 RestartBackgroundInstance(); |
1121 } | 1109 } |
1122 } | 1110 } |
1123 | 1111 |
1124 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1112 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |