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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "content/public/browser/browser_thread.h" | 84 #include "content/public/browser/browser_thread.h" |
85 #include "content/public/browser/child_process_security_policy.h" | 85 #include "content/public/browser/child_process_security_policy.h" |
86 #include "content/public/browser/notification_details.h" | 86 #include "content/public/browser/notification_details.h" |
87 #include "content/public/browser/plugin_service.h" | 87 #include "content/public/browser/plugin_service.h" |
88 #include "content/public/browser/render_process_host.h" | 88 #include "content/public/browser/render_process_host.h" |
89 #include "content/public/browser/resource_dispatcher_host.h" | 89 #include "content/public/browser/resource_dispatcher_host.h" |
90 #include "content/public/browser/service_worker_context.h" | 90 #include "content/public/browser/service_worker_context.h" |
91 #include "content/public/browser/storage_partition.h" | 91 #include "content/public/browser/storage_partition.h" |
92 #include "extensions/common/constants.h" | 92 #include "extensions/common/constants.h" |
93 #include "extensions/common/extension_l10n_util.h" | 93 #include "extensions/common/extension_l10n_util.h" |
94 #include "google_apis/gaia/identity_provider.h" | |
95 #include "net/socket/client_socket_pool_manager.h" | 94 #include "net/socket/client_socket_pool_manager.h" |
96 #include "net/url_request/url_request_context_getter.h" | 95 #include "net/url_request/url_request_context_getter.h" |
97 #include "ui/base/l10n/l10n_util.h" | 96 #include "ui/base/l10n/l10n_util.h" |
98 #include "ui/message_center/message_center.h" | 97 #include "ui/message_center/message_center.h" |
99 | 98 |
100 #if defined(ENABLE_CONFIGURATION_POLICY) | 99 #if defined(ENABLE_CONFIGURATION_POLICY) |
101 #include "components/policy/core/browser/browser_policy_connector.h" | 100 #include "components/policy/core/browser/browser_policy_connector.h" |
102 #else | 101 #else |
103 #include "components/policy/core/common/policy_service_stub.h" | 102 #include "components/policy/core/common/policy_service_stub.h" |
104 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 103 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
(...skipping 15 matching lines...) Expand all Loading... |
120 #endif | 119 #endif |
121 | 120 |
122 #if defined(ENABLE_PLUGIN_INSTALLATION) | 121 #if defined(ENABLE_PLUGIN_INSTALLATION) |
123 #include "chrome/browser/plugins/plugins_resource_service.h" | 122 #include "chrome/browser/plugins/plugins_resource_service.h" |
124 #endif | 123 #endif |
125 | 124 |
126 #if defined(ENABLE_WEBRTC) | 125 #if defined(ENABLE_WEBRTC) |
127 #include "chrome/browser/media/webrtc_log_uploader.h" | 126 #include "chrome/browser/media/webrtc_log_uploader.h" |
128 #endif | 127 #endif |
129 | 128 |
130 #if defined(OS_CHROMEOS) | |
131 #include "chrome/browser/chromeos/settings/device_identity_provider.h" | |
132 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | |
133 #elif !defined(OS_ANDROID) | |
134 #include "google_apis/gaia/dummy_identity_provider.h" | |
135 #endif | |
136 | |
137 #if defined(OS_ANDROID) | 129 #if defined(OS_ANDROID) |
138 #include "components/gcm_driver/gcm_driver_android.h" | 130 #include "components/gcm_driver/gcm_driver_android.h" |
139 #else | 131 #else |
140 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" | 132 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" |
141 #include "components/gcm_driver/gcm_client_factory.h" | 133 #include "components/gcm_driver/gcm_client_factory.h" |
142 #endif | 134 #endif |
143 | 135 |
144 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 136 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
145 // How often to check if the persistent instance of Chrome needs to restart | 137 // How often to check if the persistent instance of Chrome needs to restart |
146 // to install an update. | 138 // to install an update. |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 void BrowserProcessImpl::CreateGCMDriver() { | 1008 void BrowserProcessImpl::CreateGCMDriver() { |
1017 DCHECK(!gcm_driver_); | 1009 DCHECK(!gcm_driver_); |
1018 | 1010 |
1019 #if defined(OS_ANDROID) | 1011 #if defined(OS_ANDROID) |
1020 gcm_driver_.reset(new gcm::GCMDriverAndroid); | 1012 gcm_driver_.reset(new gcm::GCMDriverAndroid); |
1021 #else | 1013 #else |
1022 base::FilePath store_path; | 1014 base::FilePath store_path; |
1023 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); | 1015 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); |
1024 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 1016 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
1025 make_scoped_ptr(new gcm::GCMClientFactory), | 1017 make_scoped_ptr(new gcm::GCMClientFactory), |
1026 #if defined(OS_CHROMEOS) | |
1027 scoped_ptr<IdentityProvider>(new chromeos::DeviceIdentityProvider( | |
1028 chromeos::DeviceOAuth2TokenServiceFactory::Get())), | |
1029 #else | |
1030 scoped_ptr<IdentityProvider>(new DummyIdentityProvider), | |
1031 #endif // defined(OS_CHROMEOS) | |
1032 store_path, | 1018 store_path, |
1033 system_request_context()); | 1019 system_request_context()); |
| 1020 // Sign-in is not required for device-level GCM usage. So we just call |
| 1021 // OnSignedIn to assume always signed-in. Note that GCM will not be started |
| 1022 // at this point since no one has asked for it yet. |
| 1023 // TODO(jianli): To be removed when sign-in enforcement is dropped. |
| 1024 gcm_driver_->OnSignedIn(); |
1034 #endif // defined(OS_ANDROID) | 1025 #endif // defined(OS_ANDROID) |
1035 } | 1026 } |
1036 | 1027 |
1037 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1028 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
1038 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1029 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
1039 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 1030 scoped_refptr<ShellIntegration::DefaultWebClientWorker> |
1040 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 1031 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); |
1041 set_browser_worker->StartSetAsDefault(); | 1032 set_browser_worker->StartSetAsDefault(); |
1042 } | 1033 } |
1043 } | 1034 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } | 1098 } |
1108 | 1099 |
1109 void BrowserProcessImpl::OnAutoupdateTimer() { | 1100 void BrowserProcessImpl::OnAutoupdateTimer() { |
1110 if (CanAutorestartForUpdate()) { | 1101 if (CanAutorestartForUpdate()) { |
1111 DLOG(WARNING) << "Detected update. Restarting browser."; | 1102 DLOG(WARNING) << "Detected update. Restarting browser."; |
1112 RestartBackgroundInstance(); | 1103 RestartBackgroundInstance(); |
1113 } | 1104 } |
1114 } | 1105 } |
1115 | 1106 |
1116 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1107 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |