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 <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/alias.h" | 15 #include "base/debug/alias.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.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/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
24 #include "chrome/browser/automation/automation_provider_list.h" | 24 #include "chrome/browser/automation/automation_provider_list.h" |
25 #include "chrome/browser/background/background_mode_manager.h" | 25 #include "chrome/browser/background/background_mode_manager.h" |
26 #include "chrome/browser/chrome_browser_main.h" | 26 #include "chrome/browser/chrome_browser_main.h" |
27 #include "chrome/browser/chrome_content_browser_client.h" | 27 #include "chrome/browser/chrome_content_browser_client.h" |
28 #include "chrome/browser/component_updater/component_updater_configurator.h" | 28 #include "chrome/browser/component_updater/component_updater_configurator.h" |
29 #include "chrome/browser/component_updater/component_updater_service.h" | 29 #include "chrome/browser/component_updater/component_updater_service.h" |
| 30 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" |
30 #include "chrome/browser/defaults.h" | 31 #include "chrome/browser/defaults.h" |
31 #include "chrome/browser/devtools/remote_debugging_server.h" | 32 #include "chrome/browser/devtools/remote_debugging_server.h" |
32 #include "chrome/browser/download/download_request_limiter.h" | 33 #include "chrome/browser/download/download_request_limiter.h" |
33 #include "chrome/browser/download/download_status_updater.h" | 34 #include "chrome/browser/download/download_status_updater.h" |
34 #include "chrome/browser/extensions/event_router_forwarder.h" | 35 #include "chrome/browser/extensions/event_router_forwarder.h" |
35 #include "chrome/browser/extensions/extension_renderer_state.h" | 36 #include "chrome/browser/extensions/extension_renderer_state.h" |
36 #include "chrome/browser/first_run/upgrade_util.h" | 37 #include "chrome/browser/first_run/upgrade_util.h" |
37 #include "chrome/browser/gpu/gl_string_manager.h" | 38 #include "chrome/browser/gpu/gl_string_manager.h" |
38 #include "chrome/browser/gpu/gpu_mode_manager.h" | 39 #include "chrome/browser/gpu/gpu_mode_manager.h" |
39 #include "chrome/browser/icon_manager.h" | 40 #include "chrome/browser/icon_manager.h" |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 } | 741 } |
741 | 742 |
742 prerender::PrerenderTracker* BrowserProcessImpl::prerender_tracker() { | 743 prerender::PrerenderTracker* BrowserProcessImpl::prerender_tracker() { |
743 if (!prerender_tracker_.get()) | 744 if (!prerender_tracker_.get()) |
744 prerender_tracker_.reset(new prerender::PrerenderTracker); | 745 prerender_tracker_.reset(new prerender::PrerenderTracker); |
745 | 746 |
746 return prerender_tracker_.get(); | 747 return prerender_tracker_.get(); |
747 } | 748 } |
748 | 749 |
749 ComponentUpdateService* BrowserProcessImpl::component_updater() { | 750 ComponentUpdateService* BrowserProcessImpl::component_updater() { |
750 #if defined(OS_CHROMEOS) | |
751 return NULL; | |
752 #else | |
753 if (!component_updater_.get()) { | 751 if (!component_updater_.get()) { |
754 ComponentUpdateService::Configurator* configurator = | 752 ComponentUpdateService::Configurator* configurator = |
755 MakeChromeComponentUpdaterConfigurator( | 753 MakeChromeComponentUpdaterConfigurator( |
756 CommandLine::ForCurrentProcess(), | 754 CommandLine::ForCurrentProcess(), |
757 io_thread()->system_url_request_context_getter()); | 755 io_thread()->system_url_request_context_getter()); |
758 // Creating the component updater does not do anything, components | 756 // Creating the component updater does not do anything, components |
759 // need to be registered and Start() needs to be called. | 757 // need to be registered and Start() needs to be called. |
760 component_updater_.reset(ComponentUpdateServiceFactory(configurator)); | 758 component_updater_.reset(ComponentUpdateServiceFactory(configurator)); |
761 } | 759 } |
762 return component_updater_.get(); | 760 return component_updater_.get(); |
763 #endif | |
764 } | 761 } |
765 | 762 |
766 CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() { | 763 CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() { |
767 #if defined(OS_CHROMEOS) | |
768 // There's no component updater on ChromeOS so there can't be a CRLSetFetcher | |
769 // either. | |
770 return NULL; | |
771 #else | |
772 if (!crl_set_fetcher_.get()) | 764 if (!crl_set_fetcher_.get()) |
773 crl_set_fetcher_ = new CRLSetFetcher(); | 765 crl_set_fetcher_ = new CRLSetFetcher(); |
774 return crl_set_fetcher_.get(); | 766 return crl_set_fetcher_.get(); |
775 #endif | 767 } |
| 768 |
| 769 PnaclComponentInstaller* BrowserProcessImpl::pnacl_component_installer() { |
| 770 if (!pnacl_component_installer_.get()) |
| 771 pnacl_component_installer_.reset(new PnaclComponentInstaller()); |
| 772 return pnacl_component_installer_.get(); |
776 } | 773 } |
777 | 774 |
778 void BrowserProcessImpl::ResourceDispatcherHostCreated() { | 775 void BrowserProcessImpl::ResourceDispatcherHostCreated() { |
779 resource_dispatcher_host_delegate_.reset( | 776 resource_dispatcher_host_delegate_.reset( |
780 new ChromeResourceDispatcherHostDelegate(prerender_tracker())); | 777 new ChromeResourceDispatcherHostDelegate(prerender_tracker())); |
781 ResourceDispatcherHost::Get()->SetDelegate( | 778 ResourceDispatcherHost::Get()->SetDelegate( |
782 resource_dispatcher_host_delegate_.get()); | 779 resource_dispatcher_host_delegate_.get()); |
783 | 780 |
784 pref_change_registrar_.Add( | 781 pref_change_registrar_.Add( |
785 prefs::kAllowCrossOriginAuthPrompt, | 782 prefs::kAllowCrossOriginAuthPrompt, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 } | 1052 } |
1056 | 1053 |
1057 void BrowserProcessImpl::OnAutoupdateTimer() { | 1054 void BrowserProcessImpl::OnAutoupdateTimer() { |
1058 if (CanAutorestartForUpdate()) { | 1055 if (CanAutorestartForUpdate()) { |
1059 DLOG(WARNING) << "Detected update. Restarting browser."; | 1056 DLOG(WARNING) << "Detected update. Restarting browser."; |
1060 RestartBackgroundInstance(); | 1057 RestartBackgroundInstance(); |
1061 } | 1058 } |
1062 } | 1059 } |
1063 | 1060 |
1064 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1061 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |