| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
| 62 #include "chrome/common/extensions/extension_l10n_util.h" | 62 #include "chrome/common/extensions/extension_l10n_util.h" |
| 63 #include "chrome/common/extensions/extension_resource.h" | 63 #include "chrome/common/extensions/extension_resource.h" |
| 64 #include "chrome/common/json_pref_store.h" | 64 #include "chrome/common/json_pref_store.h" |
| 65 #include "chrome/common/pref_names.h" | 65 #include "chrome/common/pref_names.h" |
| 66 #include "chrome/common/switch_utils.h" | 66 #include "chrome/common/switch_utils.h" |
| 67 #include "chrome/common/url_constants.h" | 67 #include "chrome/common/url_constants.h" |
| 68 #include "chrome/installer/util/google_update_constants.h" | 68 #include "chrome/installer/util/google_update_constants.h" |
| 69 #include "content/browser/browser_child_process_host.h" | 69 #include "content/browser/browser_child_process_host.h" |
| 70 #include "content/browser/child_process_security_policy.h" | 70 #include "content/browser/child_process_security_policy.h" |
| 71 #include "content/browser/download/download_file_manager.h" | |
| 72 #include "content/browser/download/download_status_updater.h" | 71 #include "content/browser/download/download_status_updater.h" |
| 73 #include "content/browser/download/mhtml_generation_manager.h" | 72 #include "content/browser/download/mhtml_generation_manager.h" |
| 74 #include "content/browser/download/save_file_manager.h" | |
| 75 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 73 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 76 #include "content/browser/net/browser_online_state_observer.h" | 74 #include "content/browser/net/browser_online_state_observer.h" |
| 77 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 75 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 78 #include "content/public/browser/browser_thread.h" | 76 #include "content/public/browser/browser_thread.h" |
| 79 #include "content/public/browser/notification_details.h" | 77 #include "content/public/browser/notification_details.h" |
| 80 #include "content/public/browser/plugin_service.h" | 78 #include "content/public/browser/plugin_service.h" |
| 81 #include "content/public/browser/render_process_host.h" | 79 #include "content/public/browser/render_process_host.h" |
| 82 #include "content/public/common/url_fetcher.h" | 80 #include "content/public/common/url_fetcher.h" |
| 83 #include "media/audio/audio_manager.h" | 81 #include "media/audio/audio_manager.h" |
| 84 #include "net/socket/client_socket_pool_manager.h" | 82 #include "net/socket/client_socket_pool_manager.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 114 // How long to wait for the File thread to complete during EndSession, on | 112 // How long to wait for the File thread to complete during EndSession, on |
| 115 // Linux. We have a timeout here because we're unable to run the UI messageloop | 113 // Linux. We have a timeout here because we're unable to run the UI messageloop |
| 116 // and there's some deadlock risk. Our only option is to exit anyway. | 114 // and there's some deadlock risk. Our only option is to exit anyway. |
| 117 static const int kEndSessionTimeoutSeconds = 10; | 115 static const int kEndSessionTimeoutSeconds = 10; |
| 118 #endif | 116 #endif |
| 119 | 117 |
| 120 using content::BrowserThread; | 118 using content::BrowserThread; |
| 121 using content::PluginService; | 119 using content::PluginService; |
| 122 | 120 |
| 123 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) | 121 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) |
| 124 : created_resource_dispatcher_host_(false), | 122 : created_metrics_service_(false), |
| 125 created_metrics_service_(false), | |
| 126 created_watchdog_thread_(false), | 123 created_watchdog_thread_(false), |
| 127 created_profile_manager_(false), | 124 created_profile_manager_(false), |
| 128 created_local_state_(false), | 125 created_local_state_(false), |
| 129 created_icon_manager_(false), | 126 created_icon_manager_(false), |
| 130 created_browser_policy_connector_(false), | 127 created_browser_policy_connector_(false), |
| 131 created_notification_ui_manager_(false), | 128 created_notification_ui_manager_(false), |
| 132 created_safe_browsing_service_(false), | 129 created_safe_browsing_service_(false), |
| 133 module_ref_count_(0), | 130 module_ref_count_(0), |
| 134 did_start_(false), | 131 did_start_(false), |
| 135 checked_for_new_frames_(false), | 132 checked_for_new_frames_(false), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 148 chrome::kExtensionScheme); | 145 chrome::kExtensionScheme); |
| 149 | 146 |
| 150 extension_event_router_forwarder_ = new ExtensionEventRouterForwarder; | 147 extension_event_router_forwarder_ = new ExtensionEventRouterForwarder; |
| 151 | 148 |
| 152 ExtensionTabIdMap::GetInstance()->Init(); | 149 ExtensionTabIdMap::GetInstance()->Init(); |
| 153 | 150 |
| 154 online_state_observer_.reset(new BrowserOnlineStateObserver); | 151 online_state_observer_.reset(new BrowserOnlineStateObserver); |
| 155 } | 152 } |
| 156 | 153 |
| 157 BrowserProcessImpl::~BrowserProcessImpl() { | 154 BrowserProcessImpl::~BrowserProcessImpl() { |
| 158 // See StartTearDown and PreStopThread functions below, this is where | |
| 159 // most destruction happens so that it can be interleaved with threads | |
| 160 // going away. | |
| 161 | |
| 162 // Wait for the pending print jobs to finish. | 155 // Wait for the pending print jobs to finish. |
| 163 print_job_manager_->OnQuit(); | 156 print_job_manager_->OnQuit(); |
| 164 print_job_manager_.reset(); | 157 print_job_manager_.reset(); |
| 165 | 158 |
| 166 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); | 159 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); |
| 167 | 160 |
| 168 g_browser_process = NULL; | 161 g_browser_process = NULL; |
| 169 } | 162 } |
| 170 | 163 |
| 171 void BrowserProcessImpl::StartTearDown() { | 164 void BrowserProcessImpl::StartTearDown() { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // to be cancelled too. Remove this when DefaultRequestContext goes away. | 205 // to be cancelled too. Remove this when DefaultRequestContext goes away. |
| 213 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 206 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 214 base::Bind(&content::URLFetcher::CancelAll)); | 207 base::Bind(&content::URLFetcher::CancelAll)); |
| 215 | 208 |
| 216 // Need to clear profiles (download managers) before the io_thread_. | 209 // Need to clear profiles (download managers) before the io_thread_. |
| 217 profile_manager_.reset(); | 210 profile_manager_.reset(); |
| 218 | 211 |
| 219 // Debugger must be cleaned up before IO thread and NotificationService. | 212 // Debugger must be cleaned up before IO thread and NotificationService. |
| 220 remote_debugging_server_.reset(); | 213 remote_debugging_server_.reset(); |
| 221 | 214 |
| 222 if (resource_dispatcher_host_.get()) { | |
| 223 // Cancel pending requests and prevent new requests. | |
| 224 resource_dispatcher_host()->Shutdown(); | |
| 225 } | |
| 226 | |
| 227 ExtensionTabIdMap::GetInstance()->Shutdown(); | 215 ExtensionTabIdMap::GetInstance()->Shutdown(); |
| 228 | 216 |
| 229 // The policy providers managed by |browser_policy_connector_| need to shut | 217 // The policy providers managed by |browser_policy_connector_| need to shut |
| 230 // down while the IO and FILE threads are still alive. | 218 // down while the IO and FILE threads are still alive. |
| 231 browser_policy_connector_.reset(); | 219 browser_policy_connector_.reset(); |
| 232 | 220 |
| 233 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 221 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| 234 // delete related objects on the GPU thread. This must be done before | 222 // delete related objects on the GPU thread. This must be done before |
| 235 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 223 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| 236 // processes so this has to happen before stopping the IO thread. | 224 // processes so this has to happen before stopping the IO thread. |
| 237 GpuProcessHostUIShim::DestroyAll(); | 225 GpuProcessHostUIShim::DestroyAll(); |
| 238 | 226 |
| 239 // Stop the watchdog thread before stopping other threads. | 227 // Stop the watchdog thread before stopping other threads. |
| 240 watchdog_thread_.reset(); | 228 watchdog_thread_.reset(); |
| 241 } | 229 } |
| 242 | 230 |
| 243 void BrowserProcessImpl::PreStartThread(BrowserThread::ID thread_id) { | 231 void BrowserProcessImpl::PostDestroyThreads() { |
| 244 switch (thread_id) { | 232 // With the file_thread_ flushed, we can release any icon resources. |
| 245 case BrowserThread::IO: | 233 icon_manager_.reset(); |
| 246 CreateIOThreadState(); | |
| 247 break; | |
| 248 | 234 |
| 249 default: | 235 // Reset associated state right after actual thread is stopped, |
| 250 break; | 236 // as io_thread_.global_ cleanup happens in CleanUp on the IO |
| 251 } | 237 // thread, i.e. as the thread exits its message loop. |
| 252 } | 238 // |
| 253 | 239 // This is important also because in various places, the |
| 254 void BrowserProcessImpl::PostStartThread(BrowserThread::ID thread_id) { | 240 // IOThread object being NULL is considered synonymous with the |
| 255 } | 241 // IO thread having stopped. |
| 256 | 242 io_thread_.reset(); |
| 257 void BrowserProcessImpl::PreStopThread(BrowserThread::ID thread_id) { | |
| 258 switch (thread_id) { | |
| 259 case BrowserThread::FILE: | |
| 260 // Clean up state that lives on or uses the file_thread_ before | |
| 261 // it goes away. | |
| 262 if (resource_dispatcher_host_.get()) { | |
| 263 resource_dispatcher_host()->download_file_manager()->Shutdown(); | |
| 264 resource_dispatcher_host()->save_file_manager()->Shutdown(); | |
| 265 } | |
| 266 break; | |
| 267 case BrowserThread::WEBKIT_DEPRECATED: | |
| 268 // Need to destroy ResourceDispatcherHost before PluginService | |
| 269 // and SafeBrowsingService, since it caches a pointer to | |
| 270 // it. | |
| 271 resource_dispatcher_host_.reset(); | |
| 272 break; | |
| 273 default: | |
| 274 break; | |
| 275 } | |
| 276 } | |
| 277 | |
| 278 void BrowserProcessImpl::PostStopThread(BrowserThread::ID thread_id) { | |
| 279 switch (thread_id) { | |
| 280 case BrowserThread::FILE: | |
| 281 // With the file_thread_ flushed, we can release any icon resources. | |
| 282 icon_manager_.reset(); | |
| 283 break; | |
| 284 case BrowserThread::IO: | |
| 285 // Reset associated state right after actual thread is stopped, | |
| 286 // as io_thread_.global_ cleanup happens in CleanUp on the IO | |
| 287 // thread, i.e. as the thread exits its message loop. | |
| 288 // | |
| 289 // This is important also because in various places, the | |
| 290 // IOThread object being NULL is considered synonymous with the | |
| 291 // IO thread having stopped. | |
| 292 io_thread_.reset(); | |
| 293 break; | |
| 294 default: | |
| 295 break; | |
| 296 } | |
| 297 } | 243 } |
| 298 | 244 |
| 299 #if defined(OS_WIN) | 245 #if defined(OS_WIN) |
| 300 // Send a QuitTask to the given MessageLoop when the (file) thread has processed | 246 // Send a QuitTask to the given MessageLoop when the (file) thread has processed |
| 301 // our (other) recent requests (to save preferences). | 247 // our (other) recent requests (to save preferences). |
| 302 // Change the boolean so that the receiving thread will know that we did indeed | 248 // Change the boolean so that the receiving thread will know that we did indeed |
| 303 // send the QuitTask that terminated the message loop. | 249 // send the QuitTask that terminated the message loop. |
| 304 static void PostQuit(MessageLoop* message_loop) { | 250 static void PostQuit(MessageLoop* message_loop) { |
| 305 g_end_session_file_thread_has_completed = true; | 251 g_end_session_file_thread_has_completed = true; |
| 306 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 252 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 ++quits_received; | 331 ++quits_received; |
| 386 } while (!g_end_session_file_thread_has_completed); | 332 } while (!g_end_session_file_thread_has_completed); |
| 387 // If we did get extra quits, then we should re-post them to the message loop. | 333 // If we did get extra quits, then we should re-post them to the message loop. |
| 388 while (--quits_received > 0) | 334 while (--quits_received > 0) |
| 389 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 335 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 390 #else | 336 #else |
| 391 NOTIMPLEMENTED(); | 337 NOTIMPLEMENTED(); |
| 392 #endif | 338 #endif |
| 393 } | 339 } |
| 394 | 340 |
| 395 ResourceDispatcherHost* BrowserProcessImpl::resource_dispatcher_host() { | |
| 396 DCHECK(CalledOnValidThread()); | |
| 397 if (!created_resource_dispatcher_host_) | |
| 398 CreateResourceDispatcherHost(); | |
| 399 return resource_dispatcher_host_.get(); | |
| 400 } | |
| 401 | |
| 402 MetricsService* BrowserProcessImpl::metrics_service() { | 341 MetricsService* BrowserProcessImpl::metrics_service() { |
| 403 DCHECK(CalledOnValidThread()); | 342 DCHECK(CalledOnValidThread()); |
| 404 if (!created_metrics_service_) | 343 if (!created_metrics_service_) |
| 405 CreateMetricsService(); | 344 CreateMetricsService(); |
| 406 return metrics_service_.get(); | 345 return metrics_service_.get(); |
| 407 } | 346 } |
| 408 | 347 |
| 409 IOThread* BrowserProcessImpl::io_thread() { | 348 IOThread* BrowserProcessImpl::io_thread() { |
| 410 DCHECK(CalledOnValidThread()); | 349 DCHECK(CalledOnValidThread()); |
| 411 DCHECK(io_thread_.get()); | 350 DCHECK(io_thread_.get()); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 } | 629 } |
| 691 | 630 |
| 692 AudioManager* BrowserProcessImpl::audio_manager() { | 631 AudioManager* BrowserProcessImpl::audio_manager() { |
| 693 DCHECK(CalledOnValidThread()); | 632 DCHECK(CalledOnValidThread()); |
| 694 if (!audio_manager_) | 633 if (!audio_manager_) |
| 695 audio_manager_ = AudioManager::Create(); | 634 audio_manager_ = AudioManager::Create(); |
| 696 | 635 |
| 697 return audio_manager_; | 636 return audio_manager_; |
| 698 } | 637 } |
| 699 | 638 |
| 700 void BrowserProcessImpl::CreateResourceDispatcherHost() { | 639 void BrowserProcessImpl::ResourceDispatcherHostCreated() { |
| 701 DCHECK(!created_resource_dispatcher_host_ && | |
| 702 resource_dispatcher_host_.get() == NULL); | |
| 703 created_resource_dispatcher_host_ = true; | |
| 704 | |
| 705 // UserScriptListener and NetworkDelayListener will delete themselves. | 640 // UserScriptListener and NetworkDelayListener will delete themselves. |
| 706 ResourceQueue::DelegateSet resource_queue_delegates; | 641 ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get(); |
| 707 resource_queue_delegates.insert(new UserScriptListener()); | 642 rdh->AddResourceQueueDelegate(new UserScriptListener()); |
| 708 resource_queue_delegates.insert(new NetworkDelayListener()); | 643 rdh->AddResourceQueueDelegate(new NetworkDelayListener()); |
| 709 | |
| 710 resource_dispatcher_host_.reset( | |
| 711 new ResourceDispatcherHost(resource_queue_delegates)); | |
| 712 resource_dispatcher_host_->Initialize(); | |
| 713 | 644 |
| 714 resource_dispatcher_host_delegate_.reset( | 645 resource_dispatcher_host_delegate_.reset( |
| 715 new ChromeResourceDispatcherHostDelegate(resource_dispatcher_host_.get(), | 646 new ChromeResourceDispatcherHostDelegate(rdh, prerender_tracker())); |
| 716 prerender_tracker())); | 647 rdh->set_delegate(resource_dispatcher_host_delegate_.get()); |
| 717 resource_dispatcher_host_->set_delegate( | |
| 718 resource_dispatcher_host_delegate_.get()); | |
| 719 | 648 |
| 720 pref_change_registrar_.Add(prefs::kAllowCrossOriginAuthPrompt, this); | 649 pref_change_registrar_.Add(prefs::kAllowCrossOriginAuthPrompt, this); |
| 721 ApplyAllowCrossOriginAuthPromptPolicy(); | 650 ApplyAllowCrossOriginAuthPromptPolicy(); |
| 722 } | 651 } |
| 723 | 652 |
| 724 void BrowserProcessImpl::CreateMetricsService() { | 653 void BrowserProcessImpl::CreateMetricsService() { |
| 725 DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); | 654 DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); |
| 726 created_metrics_service_ = true; | 655 created_metrics_service_ = true; |
| 727 | 656 |
| 728 metrics_service_.reset(new MetricsService); | 657 metrics_service_.reset(new MetricsService); |
| 729 } | 658 } |
| 730 | 659 |
| 731 void BrowserProcessImpl::CreateIOThreadState() { | |
| 732 // Prior to any processing happening on the io thread, we create the | |
| 733 // plugin service as it is predominantly used from the io thread, | |
| 734 // but must be created on the main thread. The service ctor is | |
| 735 // inexpensive and does not invoke the io_thread() accessor. | |
| 736 PluginService* plugin_service = PluginService::GetInstance(); | |
| 737 plugin_service->Init(); | |
| 738 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); | |
| 739 plugin_service->StartWatchingPlugins(); | |
| 740 | |
| 741 // Register the internal Flash if available. | |
| 742 FilePath path; | |
| 743 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
| 744 switches::kDisableInternalFlash) && | |
| 745 PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { | |
| 746 plugin_service->AddExtraPluginPath(path); | |
| 747 } | |
| 748 | |
| 749 #if defined(OS_POSIX) | |
| 750 // Also find plugins in a user-specific plugins dir, | |
| 751 // e.g. ~/.config/chromium/Plugins. | |
| 752 FilePath user_data_dir; | |
| 753 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | |
| 754 plugin_service->AddExtraPluginPath(user_data_dir.Append("Plugins")); | |
| 755 } | |
| 756 #endif | |
| 757 | |
| 758 scoped_ptr<IOThread> thread(new IOThread( | |
| 759 local_state(), net_log_.get(), extension_event_router_forwarder_.get())); | |
| 760 io_thread_.swap(thread); | |
| 761 } | |
| 762 | |
| 763 void BrowserProcessImpl::CreateWatchdogThread() { | 660 void BrowserProcessImpl::CreateWatchdogThread() { |
| 764 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); | 661 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); |
| 765 created_watchdog_thread_ = true; | 662 created_watchdog_thread_ = true; |
| 766 | 663 |
| 767 scoped_ptr<WatchDogThread> thread(new WatchDogThread()); | 664 scoped_ptr<WatchDogThread> thread(new WatchDogThread()); |
| 768 if (!thread->Start()) | 665 if (!thread->Start()) |
| 769 return; | 666 return; |
| 770 watchdog_thread_.swap(thread); | 667 watchdog_thread_.swap(thread); |
| 771 } | 668 } |
| 772 | 669 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 | 716 |
| 820 // This is observed by ChildProcessSecurityPolicy, which lives in content/ | 717 // This is observed by ChildProcessSecurityPolicy, which lives in content/ |
| 821 // though, so it can't register itself. | 718 // though, so it can't register itself. |
| 822 local_state_->RegisterListPref(prefs::kDisabledSchemes); | 719 local_state_->RegisterListPref(prefs::kDisabledSchemes); |
| 823 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); | 720 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); |
| 824 ApplyDisabledSchemesPolicy(); | 721 ApplyDisabledSchemesPolicy(); |
| 825 | 722 |
| 826 local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); | 723 local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); |
| 827 } | 724 } |
| 828 | 725 |
| 726 void BrowserProcessImpl::PreCreateThreads() { |
| 727 io_thread_.reset(new IOThread( |
| 728 local_state(), net_log_.get(), extension_event_router_forwarder_.get())); |
| 729 } |
| 730 |
| 829 void BrowserProcessImpl::PreMainMessageLoopRun() { | 731 void BrowserProcessImpl::PreMainMessageLoopRun() { |
| 732 PluginService* plugin_service = PluginService::GetInstance(); |
| 733 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); |
| 734 plugin_service->StartWatchingPlugins(); |
| 735 |
| 736 // Register the internal Flash if available. |
| 737 FilePath path; |
| 738 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 739 switches::kDisableInternalFlash) && |
| 740 PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) { |
| 741 plugin_service->AddExtraPluginPath(path); |
| 742 } |
| 743 |
| 744 #if defined(OS_POSIX) |
| 745 // Also find plugins in a user-specific plugins dir, |
| 746 // e.g. ~/.config/chromium/Plugins. |
| 747 FilePath user_data_dir; |
| 748 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
| 749 plugin_service->AddExtraPluginPath(user_data_dir.Append("Plugins")); |
| 750 } |
| 751 #endif |
| 752 |
| 830 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) | 753 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) |
| 831 ApplyDefaultBrowserPolicy(); | 754 ApplyDefaultBrowserPolicy(); |
| 832 } | 755 } |
| 833 | 756 |
| 834 void BrowserProcessImpl::CreateIconManager() { | 757 void BrowserProcessImpl::CreateIconManager() { |
| 835 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 758 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
| 836 created_icon_manager_ = true; | 759 created_icon_manager_ = true; |
| 837 icon_manager_.reset(new IconManager); | 760 icon_manager_.reset(new IconManager); |
| 838 } | 761 } |
| 839 | 762 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 832 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
| 910 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 833 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
| 911 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 834 scoped_refptr<ShellIntegration::DefaultWebClientWorker> |
| 912 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 835 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); |
| 913 set_browser_worker->StartSetAsDefault(); | 836 set_browser_worker->StartSetAsDefault(); |
| 914 } | 837 } |
| 915 } | 838 } |
| 916 | 839 |
| 917 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | 840 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { |
| 918 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | 841 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
| 919 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value); | 842 ResourceDispatcherHost::Get()->set_allow_cross_origin_auth_prompt(value); |
| 920 } | 843 } |
| 921 | 844 |
| 922 // Mac is currently not supported. | 845 // Mac is currently not supported. |
| 923 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 846 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| 924 | 847 |
| 925 bool BrowserProcessImpl::CanAutorestartForUpdate() const { | 848 bool BrowserProcessImpl::CanAutorestartForUpdate() const { |
| 926 // Check if browser is in the background and if it needs to be restarted to | 849 // Check if browser is in the background and if it needs to be restarted to |
| 927 // apply a pending update. | 850 // apply a pending update. |
| 928 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() && | 851 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() && |
| 929 upgrade_util::IsUpdatePendingRestart(); | 852 upgrade_util::IsUpdatePendingRestart(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 } | 892 } |
| 970 | 893 |
| 971 void BrowserProcessImpl::OnAutoupdateTimer() { | 894 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 972 if (CanAutorestartForUpdate()) { | 895 if (CanAutorestartForUpdate()) { |
| 973 DLOG(WARNING) << "Detected update. Restarting browser."; | 896 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 974 RestartBackgroundInstance(); | 897 RestartBackgroundInstance(); |
| 975 } | 898 } |
| 976 } | 899 } |
| 977 | 900 |
| 978 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 901 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |