| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 #include "components/metrics/metrics_service.h" | 91 #include "components/metrics/metrics_service.h" |
| 92 #include "components/metrics_services_manager/metrics_services_manager.h" | 92 #include "components/metrics_services_manager/metrics_services_manager.h" |
| 93 #include "components/net_log/chrome_net_log.h" | 93 #include "components/net_log/chrome_net_log.h" |
| 94 #include "components/network_time/network_time_tracker.h" | 94 #include "components/network_time/network_time_tracker.h" |
| 95 #include "components/physical_web/data_source/physical_web_data_source.h" | 95 #include "components/physical_web/data_source/physical_web_data_source.h" |
| 96 #include "components/policy/core/browser/browser_policy_connector.h" | 96 #include "components/policy/core/browser/browser_policy_connector.h" |
| 97 #include "components/policy/core/common/policy_service.h" | 97 #include "components/policy/core/common/policy_service.h" |
| 98 #include "components/prefs/json_pref_store.h" | 98 #include "components/prefs/json_pref_store.h" |
| 99 #include "components/prefs/pref_registry_simple.h" | 99 #include "components/prefs/pref_registry_simple.h" |
| 100 #include "components/prefs/pref_service.h" | 100 #include "components/prefs/pref_service.h" |
| 101 #include "components/rappor/rappor_utils.h" |
| 101 #include "components/safe_json/safe_json_parser.h" | 102 #include "components/safe_json/safe_json_parser.h" |
| 102 #include "components/signin/core/common/profile_management_switches.h" | 103 #include "components/signin/core/common/profile_management_switches.h" |
| 103 #include "components/subresource_filter/content/browser/content_ruleset_service_
delegate.h" | 104 #include "components/subresource_filter/content/browser/content_ruleset_service_
delegate.h" |
| 104 #include "components/subresource_filter/core/browser/ruleset_service.h" | 105 #include "components/subresource_filter/core/browser/ruleset_service.h" |
| 105 #include "components/subresource_filter/core/browser/subresource_filter_constant
s.h" | 106 #include "components/subresource_filter/core/browser/subresource_filter_constant
s.h" |
| 106 #include "components/subresource_filter/core/browser/subresource_filter_features
.h" | 107 #include "components/subresource_filter/core/browser/subresource_filter_features
.h" |
| 107 #include "components/translate/core/browser/translate_download_manager.h" | 108 #include "components/translate/core/browser/translate_download_manager.h" |
| 108 #include "components/update_client/update_query_params.h" | 109 #include "components/update_client/update_query_params.h" |
| 109 #include "components/web_resource/web_resource_pref_names.h" | 110 #include "components/web_resource/web_resource_pref_names.h" |
| 110 #include "content/public/browser/browser_thread.h" | 111 #include "content/public/browser/browser_thread.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // messageloop and there's some deadlock risk. Our only option is to exit | 192 // messageloop and there's some deadlock risk. Our only option is to exit |
| 192 // anyway. | 193 // anyway. |
| 193 static const int kEndSessionTimeoutSeconds = 10; | 194 static const int kEndSessionTimeoutSeconds = 10; |
| 194 #endif | 195 #endif |
| 195 | 196 |
| 196 using content::BrowserThread; | 197 using content::BrowserThread; |
| 197 using content::ChildProcessSecurityPolicy; | 198 using content::ChildProcessSecurityPolicy; |
| 198 using content::PluginService; | 199 using content::PluginService; |
| 199 using content::ResourceDispatcherHost; | 200 using content::ResourceDispatcherHost; |
| 200 | 201 |
| 202 rappor::RapporService* GetBrowserRapporService() { |
| 203 if (g_browser_process != nullptr) |
| 204 return g_browser_process->rappor_service(); |
| 205 return nullptr; |
| 206 } |
| 207 |
| 201 BrowserProcessImpl::BrowserProcessImpl( | 208 BrowserProcessImpl::BrowserProcessImpl( |
| 202 base::SequencedTaskRunner* local_state_task_runner, | 209 base::SequencedTaskRunner* local_state_task_runner, |
| 203 const base::CommandLine& command_line) | 210 const base::CommandLine& command_line) |
| 204 : created_watchdog_thread_(false), | 211 : created_watchdog_thread_(false), |
| 205 created_browser_policy_connector_(false), | 212 created_browser_policy_connector_(false), |
| 206 created_profile_manager_(false), | 213 created_profile_manager_(false), |
| 207 created_local_state_(false), | 214 created_local_state_(false), |
| 208 created_icon_manager_(false), | 215 created_icon_manager_(false), |
| 209 created_notification_ui_manager_(false), | 216 created_notification_ui_manager_(false), |
| 210 created_notification_bridge_(false), | 217 created_notification_bridge_(false), |
| 211 created_safe_browsing_service_(false), | 218 created_safe_browsing_service_(false), |
| 212 created_subresource_filter_ruleset_service_(false), | 219 created_subresource_filter_ruleset_service_(false), |
| 213 shutting_down_(false), | 220 shutting_down_(false), |
| 214 tearing_down_(false), | 221 tearing_down_(false), |
| 215 download_status_updater_(new DownloadStatusUpdater), | 222 download_status_updater_(new DownloadStatusUpdater), |
| 216 local_state_task_runner_(local_state_task_runner), | 223 local_state_task_runner_(local_state_task_runner), |
| 217 cached_default_web_client_state_(shell_integration::UNKNOWN_DEFAULT) { | 224 cached_default_web_client_state_(shell_integration::UNKNOWN_DEFAULT) { |
| 218 g_browser_process = this; | 225 g_browser_process = this; |
| 226 rappor::SetDefaultServiceAccessor(&GetBrowserRapporService); |
| 219 platform_part_.reset(new BrowserProcessPlatformPart()); | 227 platform_part_.reset(new BrowserProcessPlatformPart()); |
| 220 | 228 |
| 221 #if BUILDFLAG(ENABLE_PRINTING) | 229 #if BUILDFLAG(ENABLE_PRINTING) |
| 222 // Must be created after the NotificationService. | 230 // Must be created after the NotificationService. |
| 223 print_job_manager_.reset(new printing::PrintJobManager); | 231 print_job_manager_.reset(new printing::PrintJobManager); |
| 224 #endif | 232 #endif |
| 225 | 233 |
| 226 base::FilePath net_log_path; | 234 base::FilePath net_log_path; |
| 227 if (command_line.HasSwitch(switches::kLogNetLog)) | 235 if (command_line.HasSwitch(switches::kLogNetLog)) |
| 228 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); | 236 net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog); |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 } | 1410 } |
| 1403 | 1411 |
| 1404 void BrowserProcessImpl::OnAutoupdateTimer() { | 1412 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1405 if (CanAutorestartForUpdate()) { | 1413 if (CanAutorestartForUpdate()) { |
| 1406 DLOG(WARNING) << "Detected update. Restarting browser."; | 1414 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1407 RestartBackgroundInstance(); | 1415 RestartBackgroundInstance(); |
| 1408 } | 1416 } |
| 1409 } | 1417 } |
| 1410 | 1418 |
| 1411 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1419 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |