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