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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 738 } |
738 | 739 |
739 prerender::PrerenderTracker* BrowserProcessImpl::prerender_tracker() { | 740 prerender::PrerenderTracker* BrowserProcessImpl::prerender_tracker() { |
740 if (!prerender_tracker_.get()) | 741 if (!prerender_tracker_.get()) |
741 prerender_tracker_.reset(new prerender::PrerenderTracker); | 742 prerender_tracker_.reset(new prerender::PrerenderTracker); |
742 | 743 |
743 return prerender_tracker_.get(); | 744 return prerender_tracker_.get(); |
744 } | 745 } |
745 | 746 |
746 ComponentUpdateService* BrowserProcessImpl::component_updater() { | 747 ComponentUpdateService* BrowserProcessImpl::component_updater() { |
747 #if defined(OS_CHROMEOS) | |
748 return NULL; | |
749 #else | |
750 if (!component_updater_.get()) { | 748 if (!component_updater_.get()) { |
751 ComponentUpdateService::Configurator* configurator = | 749 ComponentUpdateService::Configurator* configurator = |
752 MakeChromeComponentUpdaterConfigurator( | 750 MakeChromeComponentUpdaterConfigurator( |
753 CommandLine::ForCurrentProcess(), | 751 CommandLine::ForCurrentProcess(), |
754 io_thread()->system_url_request_context_getter()); | 752 io_thread()->system_url_request_context_getter()); |
755 // Creating the component updater does not do anything, components | 753 // Creating the component updater does not do anything, components |
756 // need to be registered and Start() needs to be called. | 754 // need to be registered and Start() needs to be called. |
757 component_updater_.reset(ComponentUpdateServiceFactory(configurator)); | 755 component_updater_.reset(ComponentUpdateServiceFactory(configurator)); |
758 } | 756 } |
759 return component_updater_.get(); | 757 return component_updater_.get(); |
760 #endif | |
761 } | 758 } |
762 | 759 |
763 CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() { | 760 CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() { |
764 #if defined(OS_CHROMEOS) | |
765 // There's no component updater on ChromeOS so there can't be a CRLSetFetcher | |
766 // either. | |
767 return NULL; | |
768 #else | |
769 if (!crl_set_fetcher_.get()) | 761 if (!crl_set_fetcher_.get()) |
770 crl_set_fetcher_ = new CRLSetFetcher(); | 762 crl_set_fetcher_ = new CRLSetFetcher(); |
771 return crl_set_fetcher_.get(); | 763 return crl_set_fetcher_.get(); |
772 #endif | 764 } |
| 765 |
| 766 PnaclComponentInstaller* BrowserProcessImpl::pnacl_component_installer() { |
| 767 if (!pnacl_component_installer_.get()) |
| 768 pnacl_component_installer_.reset(new PnaclComponentInstaller()); |
| 769 return pnacl_component_installer_.get(); |
773 } | 770 } |
774 | 771 |
775 void BrowserProcessImpl::ResourceDispatcherHostCreated() { | 772 void BrowserProcessImpl::ResourceDispatcherHostCreated() { |
776 resource_dispatcher_host_delegate_.reset( | 773 resource_dispatcher_host_delegate_.reset( |
777 new ChromeResourceDispatcherHostDelegate(prerender_tracker())); | 774 new ChromeResourceDispatcherHostDelegate(prerender_tracker())); |
778 ResourceDispatcherHost::Get()->SetDelegate( | 775 ResourceDispatcherHost::Get()->SetDelegate( |
779 resource_dispatcher_host_delegate_.get()); | 776 resource_dispatcher_host_delegate_.get()); |
780 | 777 |
781 pref_change_registrar_.Add( | 778 pref_change_registrar_.Add( |
782 prefs::kAllowCrossOriginAuthPrompt, | 779 prefs::kAllowCrossOriginAuthPrompt, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 } | 1049 } |
1053 | 1050 |
1054 void BrowserProcessImpl::OnAutoupdateTimer() { | 1051 void BrowserProcessImpl::OnAutoupdateTimer() { |
1055 if (CanAutorestartForUpdate()) { | 1052 if (CanAutorestartForUpdate()) { |
1056 DLOG(WARNING) << "Detected update. Restarting browser."; | 1053 DLOG(WARNING) << "Detected update. Restarting browser."; |
1057 RestartBackgroundInstance(); | 1054 RestartBackgroundInstance(); |
1058 } | 1055 } |
1059 } | 1056 } |
1060 | 1057 |
1061 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1058 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |