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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
85 #include "chrome/installer/util/google_update_constants.h" | 85 #include "chrome/installer/util/google_update_constants.h" |
86 #include "chrome/installer/util/google_update_settings.h" | 86 #include "chrome/installer/util/google_update_settings.h" |
87 #include "components/component_updater/component_updater_service.h" | 87 #include "components/component_updater/component_updater_service.h" |
88 #include "components/gcm_driver/gcm_driver.h" | 88 #include "components/gcm_driver/gcm_driver.h" |
89 #include "components/metrics/metrics_pref_names.h" | 89 #include "components/metrics/metrics_pref_names.h" |
90 #include "components/metrics/metrics_service.h" | 90 #include "components/metrics/metrics_service.h" |
91 #include "components/metrics_services_manager/metrics_services_manager.h" | 91 #include "components/metrics_services_manager/metrics_services_manager.h" |
92 #include "components/net_log/chrome_net_log.h" | 92 #include "components/net_log/chrome_net_log.h" |
93 #include "components/network_time/network_time_tracker.h" | 93 #include "components/network_time/network_time_tracker.h" |
| 94 #include "components/physical_web/data_source/physical_web_data_source.h" |
94 #include "components/policy/core/browser/browser_policy_connector.h" | 95 #include "components/policy/core/browser/browser_policy_connector.h" |
95 #include "components/policy/core/common/policy_service.h" | 96 #include "components/policy/core/common/policy_service.h" |
96 #include "components/prefs/json_pref_store.h" | 97 #include "components/prefs/json_pref_store.h" |
97 #include "components/prefs/pref_registry_simple.h" | 98 #include "components/prefs/pref_registry_simple.h" |
98 #include "components/prefs/pref_service.h" | 99 #include "components/prefs/pref_service.h" |
99 #include "components/safe_json/safe_json_parser.h" | 100 #include "components/safe_json/safe_json_parser.h" |
100 #include "components/signin/core/common/profile_management_switches.h" | 101 #include "components/signin/core/common/profile_management_switches.h" |
101 #include "components/subresource_filter/content/browser/content_ruleset_distribu
tor.h" | 102 #include "components/subresource_filter/content/browser/content_ruleset_distribu
tor.h" |
102 #include "components/subresource_filter/core/browser/ruleset_service.h" | 103 #include "components/subresource_filter/core/browser/ruleset_service.h" |
103 #include "components/subresource_filter/core/browser/subresource_filter_constant
s.h" | 104 #include "components/subresource_filter/core/browser/subresource_filter_constant
s.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 #endif | 163 #endif |
163 | 164 |
164 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 165 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
165 #include "chrome/browser/memory/tab_manager.h" | 166 #include "chrome/browser/memory/tab_manager.h" |
166 #endif | 167 #endif |
167 | 168 |
168 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 169 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
169 #include "chrome/browser/first_run/upgrade_util.h" | 170 #include "chrome/browser/first_run/upgrade_util.h" |
170 #endif | 171 #endif |
171 | 172 |
| 173 #if defined(OS_ANDROID) |
| 174 #include "chrome/browser/android/physical_web/physical_web_data_source_android.h
" |
| 175 #endif |
| 176 |
172 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 177 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
173 // How often to check if the persistent instance of Chrome needs to restart | 178 // How often to check if the persistent instance of Chrome needs to restart |
174 // to install an update. | 179 // to install an update. |
175 static const int kUpdateCheckIntervalHours = 6; | 180 static const int kUpdateCheckIntervalHours = 6; |
176 #endif | 181 #endif |
177 | 182 |
178 #if defined(USE_X11) || defined(OS_WIN) || defined(USE_OZONE) | 183 #if defined(USE_X11) || defined(OS_WIN) || defined(USE_OZONE) |
179 // How long to wait for the File thread to complete during EndSession, on Linux | 184 // How long to wait for the File thread to complete during EndSession, on Linux |
180 // and Windows. We have a timeout here because we're unable to run the UI | 185 // and Windows. We have a timeout here because we're unable to run the UI |
181 // messageloop and there's some deadlock risk. Our only option is to exit | 186 // messageloop and there's some deadlock risk. Our only option is to exit |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 #else | 778 #else |
774 return nullptr; | 779 return nullptr; |
775 #endif | 780 #endif |
776 } | 781 } |
777 | 782 |
778 shell_integration::DefaultWebClientState | 783 shell_integration::DefaultWebClientState |
779 BrowserProcessImpl::CachedDefaultWebClientState() { | 784 BrowserProcessImpl::CachedDefaultWebClientState() { |
780 return cached_default_web_client_state_; | 785 return cached_default_web_client_state_; |
781 } | 786 } |
782 | 787 |
| 788 PhysicalWebDataSource* BrowserProcessImpl::GetPhysicalWebDataSource() { |
| 789 DCHECK(CalledOnValidThread()); |
| 790 #if defined(OS_ANDROID) |
| 791 if (!physical_web_data_source_) { |
| 792 CreatePhysicalWebDataSource(); |
| 793 DCHECK(physical_web_data_source_); |
| 794 } |
| 795 return physical_web_data_source_.get(); |
| 796 #else |
| 797 return nullptr; |
| 798 #endif |
| 799 } |
| 800 |
783 // static | 801 // static |
784 void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 802 void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
785 registry->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 803 registry->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
786 false); | 804 false); |
787 // This policy needs to be defined before the net subsystem is initialized, | 805 // This policy needs to be defined before the net subsystem is initialized, |
788 // so we do it here. | 806 // so we do it here. |
789 registry->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy, | 807 registry->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy, |
790 net::kDefaultMaxSocketsPerProxyServer); | 808 net::kDefaultMaxSocketsPerProxyServer); |
791 | 809 |
792 registry->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); | 810 registry->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 system_request_context(), chrome::GetChannel(), | 1214 system_request_context(), chrome::GetChannel(), |
1197 gcm::GetProductCategoryForSubtypes(local_state()), | 1215 gcm::GetProductCategoryForSubtypes(local_state()), |
1198 content::BrowserThread::GetTaskRunnerForThread( | 1216 content::BrowserThread::GetTaskRunnerForThread( |
1199 content::BrowserThread::UI), | 1217 content::BrowserThread::UI), |
1200 content::BrowserThread::GetTaskRunnerForThread( | 1218 content::BrowserThread::GetTaskRunnerForThread( |
1201 content::BrowserThread::IO), | 1219 content::BrowserThread::IO), |
1202 blocking_task_runner); | 1220 blocking_task_runner); |
1203 #endif // defined(OS_ANDROID) | 1221 #endif // defined(OS_ANDROID) |
1204 } | 1222 } |
1205 | 1223 |
| 1224 void BrowserProcessImpl::CreatePhysicalWebDataSource() { |
| 1225 DCHECK(!physical_web_data_source_); |
| 1226 |
| 1227 #if defined(OS_ANDROID) |
| 1228 physical_web_data_source_ = base::MakeUnique<PhysicalWebDataSourceAndroid>(); |
| 1229 #else |
| 1230 NOTIMPLEMENTED(); |
| 1231 #endif |
| 1232 } |
| 1233 |
1206 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1234 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
1207 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1235 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
1208 // The worker pointer is reference counted. While it is running, the | 1236 // The worker pointer is reference counted. While it is running, the |
1209 // message loops of the FILE and UI thread will hold references to it | 1237 // message loops of the FILE and UI thread will hold references to it |
1210 // and it will be automatically freed once all its tasks have finished. | 1238 // and it will be automatically freed once all its tasks have finished. |
1211 scoped_refptr<shell_integration::DefaultBrowserWorker> set_browser_worker = | 1239 scoped_refptr<shell_integration::DefaultBrowserWorker> set_browser_worker = |
1212 new shell_integration::DefaultBrowserWorker( | 1240 new shell_integration::DefaultBrowserWorker( |
1213 shell_integration::DefaultWebClientWorkerCallback()); | 1241 shell_integration::DefaultWebClientWorkerCallback()); |
1214 // The user interaction must always be disabled when applying the default | 1242 // The user interaction must always be disabled when applying the default |
1215 // browser policy since it is done at each browser startup and the result | 1243 // browser policy since it is done at each browser startup and the result |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 } | 1373 } |
1346 | 1374 |
1347 void BrowserProcessImpl::OnAutoupdateTimer() { | 1375 void BrowserProcessImpl::OnAutoupdateTimer() { |
1348 if (CanAutorestartForUpdate()) { | 1376 if (CanAutorestartForUpdate()) { |
1349 DLOG(WARNING) << "Detected update. Restarting browser."; | 1377 DLOG(WARNING) << "Detected update. Restarting browser."; |
1350 RestartBackgroundInstance(); | 1378 RestartBackgroundInstance(); |
1351 } | 1379 } |
1352 } | 1380 } |
1353 | 1381 |
1354 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1382 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |