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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
15 #include "base/debug/leak_annotations.h" | 15 #include "base/debug/leak_annotations.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/prefs/json_pref_store.h" | 18 #include "base/prefs/json_pref_store.h" |
19 #include "base/prefs/pref_registry_simple.h" | 19 #include "base/prefs/pref_registry_simple.h" |
20 #include "base/prefs/pref_service.h" | 20 #include "base/prefs/pref_service.h" |
21 #include "base/strings/string_util.h" | |
21 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
22 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
23 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
24 #include "base/time/default_tick_clock.h" | 25 #include "base/time/default_tick_clock.h" |
26 #include "base/version.h" | |
25 #include "chrome/browser/apps/chrome_apps_client.h" | 27 #include "chrome/browser/apps/chrome_apps_client.h" |
26 #include "chrome/browser/background/background_mode_manager.h" | 28 #include "chrome/browser/background/background_mode_manager.h" |
27 #include "chrome/browser/chrome_browser_main.h" | 29 #include "chrome/browser/chrome_browser_main.h" |
28 #include "chrome/browser/chrome_content_browser_client.h" | 30 #include "chrome/browser/chrome_content_browser_client.h" |
29 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
30 #include "chrome/browser/component_updater/component_updater_configurator.h" | 32 #include "chrome/browser/component_updater/component_updater_configurator.h" |
31 #include "chrome/browser/component_updater/component_updater_service.h" | 33 #include "chrome/browser/component_updater/component_updater_service.h" |
32 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" | 34 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
33 #include "chrome/browser/defaults.h" | 35 #include "chrome/browser/defaults.h" |
34 #include "chrome/browser/devtools/remote_debugging_server.h" | 36 #include "chrome/browser/devtools/remote_debugging_server.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
63 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 65 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
64 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 66 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
65 #include "chrome/browser/shell_integration.h" | 67 #include "chrome/browser/shell_integration.h" |
66 #include "chrome/browser/status_icons/status_tray.h" | 68 #include "chrome/browser/status_icons/status_tray.h" |
67 #include "chrome/browser/ui/browser_dialogs.h" | 69 #include "chrome/browser/ui/browser_dialogs.h" |
68 #include "chrome/browser/ui/browser_finder.h" | 70 #include "chrome/browser/ui/browser_finder.h" |
69 #include "chrome/browser/web_resource/promo_resource_service.h" | 71 #include "chrome/browser/web_resource/promo_resource_service.h" |
70 #include "chrome/common/chrome_constants.h" | 72 #include "chrome/common/chrome_constants.h" |
71 #include "chrome/common/chrome_paths.h" | 73 #include "chrome/common/chrome_paths.h" |
72 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
75 #include "chrome/common/chrome_version_info.h" | |
73 #include "chrome/common/extensions/chrome_extensions_client.h" | 76 #include "chrome/common/extensions/chrome_extensions_client.h" |
74 #include "chrome/common/pref_names.h" | 77 #include "chrome/common/pref_names.h" |
75 #include "chrome/common/switch_utils.h" | 78 #include "chrome/common/switch_utils.h" |
76 #include "chrome/common/url_constants.h" | 79 #include "chrome/common/url_constants.h" |
77 #include "chrome/installer/util/google_update_constants.h" | 80 #include "chrome/installer/util/google_update_constants.h" |
78 #include "chrome/installer/util/google_update_settings.h" | 81 #include "chrome/installer/util/google_update_settings.h" |
79 #include "components/gcm_driver/gcm_driver.h" | 82 #include "components/gcm_driver/gcm_driver.h" |
80 #include "components/metrics/metrics_service.h" | 83 #include "components/metrics/metrics_service.h" |
81 #include "components/network_time/network_time_tracker.h" | 84 #include "components/network_time/network_time_tracker.h" |
82 #include "components/policy/core/common/policy_service.h" | 85 #include "components/policy/core/common/policy_service.h" |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 prerender_tracker_.reset(new prerender::PrerenderTracker); | 790 prerender_tracker_.reset(new prerender::PrerenderTracker); |
788 | 791 |
789 return prerender_tracker_.get(); | 792 return prerender_tracker_.get(); |
790 } | 793 } |
791 | 794 |
792 component_updater::ComponentUpdateService* | 795 component_updater::ComponentUpdateService* |
793 BrowserProcessImpl::component_updater() { | 796 BrowserProcessImpl::component_updater() { |
794 if (!component_updater_.get()) { | 797 if (!component_updater_.get()) { |
795 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) | 798 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) |
796 return NULL; | 799 return NULL; |
800 // Parse comma-delimited debug flags. | |
801 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | |
802 std::vector<std::string> switch_values; | |
803 Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdater), | |
blundell
2014/06/17 17:26:42
is the reason that you moved this code because swi
tommycli
2014/06/17 19:01:57
Done.
| |
804 ",", | |
805 &switch_values); | |
797 component_updater::ComponentUpdateService::Configurator* configurator = | 806 component_updater::ComponentUpdateService::Configurator* configurator = |
798 component_updater::MakeChromeComponentUpdaterConfigurator( | 807 component_updater::MakeChromeComponentUpdaterConfigurator( |
799 CommandLine::ForCurrentProcess(), | 808 switch_values, |
800 io_thread()->system_url_request_context_getter()); | 809 io_thread()->system_url_request_context_getter()); |
801 // Creating the component updater does not do anything, components | 810 // Creating the component updater does not do anything, components |
802 // need to be registered and Start() needs to be called. | 811 // need to be registered and Start() needs to be called. |
803 component_updater_.reset(ComponentUpdateServiceFactory(configurator)); | 812 component_updater_.reset(ComponentUpdateServiceFactory( |
813 configurator, chrome::VersionInfo().Version(), | |
814 chrome::VersionInfo().OSType())); | |
804 } | 815 } |
805 return component_updater_.get(); | 816 return component_updater_.get(); |
806 } | 817 } |
807 | 818 |
808 CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() { | 819 CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() { |
809 if (!crl_set_fetcher_.get()) | 820 if (!crl_set_fetcher_.get()) |
810 crl_set_fetcher_ = new CRLSetFetcher(); | 821 crl_set_fetcher_ = new CRLSetFetcher(); |
811 return crl_set_fetcher_.get(); | 822 return crl_set_fetcher_.get(); |
812 } | 823 } |
813 | 824 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 } | 1126 } |
1116 | 1127 |
1117 void BrowserProcessImpl::OnAutoupdateTimer() { | 1128 void BrowserProcessImpl::OnAutoupdateTimer() { |
1118 if (CanAutorestartForUpdate()) { | 1129 if (CanAutorestartForUpdate()) { |
1119 DLOG(WARNING) << "Detected update. Restarting browser."; | 1130 DLOG(WARNING) << "Detected update. Restarting browser."; |
1120 RestartBackgroundInstance(); | 1131 RestartBackgroundInstance(); |
1121 } | 1132 } |
1122 } | 1133 } |
1123 | 1134 |
1124 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1135 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |