OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "base/task.h" | 13 #include "base/task.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "chrome/browser/automation/automation_provider_list.h" | 16 #include "chrome/browser/automation/automation_provider_list.h" |
17 #include "chrome/browser/browser_list.h" | 17 #include "chrome/browser/browser_list.h" |
18 #include "chrome/browser/browser_main.h" | 18 #include "chrome/browser/browser_main.h" |
19 #include "chrome/browser/browser_process_sub_thread.h" | 19 #include "chrome/browser/browser_process_sub_thread.h" |
20 #include "chrome/browser/browser_trial.h" | 20 #include "chrome/browser/browser_trial.h" |
21 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" | 21 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" |
22 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" | 22 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" |
23 #include "chrome/browser/debugger/devtools_manager.h" | 23 #include "chrome/browser/debugger/devtools_manager.h" |
24 #include "chrome/browser/debugger/devtools_protocol_handler.h" | 24 #include "chrome/browser/debugger/devtools_protocol_handler.h" |
25 #include "chrome/browser/download/download_file_manager.h" | 25 #include "chrome/browser/download/download_file_manager.h" |
26 #include "chrome/browser/download/save_file_manager.h" | 26 #include "chrome/browser/download/save_file_manager.h" |
| 27 #include "chrome/browser/extensions/extension_event_router_forwarder.h" |
27 #include "chrome/browser/first_run/first_run.h" | 28 #include "chrome/browser/first_run/first_run.h" |
28 #include "chrome/browser/google/google_url_tracker.h" | 29 #include "chrome/browser/google/google_url_tracker.h" |
29 #include "chrome/browser/icon_manager.h" | 30 #include "chrome/browser/icon_manager.h" |
30 #include "chrome/browser/intranet_redirect_detector.h" | 31 #include "chrome/browser/intranet_redirect_detector.h" |
31 #include "chrome/browser/io_thread.h" | 32 #include "chrome/browser/io_thread.h" |
32 #include "chrome/browser/metrics/metrics_service.h" | 33 #include "chrome/browser/metrics/metrics_service.h" |
33 #include "chrome/browser/net/chrome_net_log.h" | 34 #include "chrome/browser/net/chrome_net_log.h" |
34 #include "chrome/browser/net/predictor_api.h" | 35 #include "chrome/browser/net/predictor_api.h" |
35 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 36 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
36 #include "chrome/browser/notifications/notification_ui_manager.h" | 37 #include "chrome/browser/notifications/notification_ui_manager.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 notification_registrar_.Add(this, | 118 notification_registrar_.Add(this, |
118 NotificationType::APP_TERMINATING, | 119 NotificationType::APP_TERMINATING, |
119 NotificationService::AllSources()); | 120 NotificationService::AllSources()); |
120 | 121 |
121 // Must be created after the NotificationService. | 122 // Must be created after the NotificationService. |
122 print_job_manager_.reset(new printing::PrintJobManager); | 123 print_job_manager_.reset(new printing::PrintJobManager); |
123 | 124 |
124 shutdown_event_.reset(new base::WaitableEvent(true, false)); | 125 shutdown_event_.reset(new base::WaitableEvent(true, false)); |
125 | 126 |
126 net_log_.reset(new ChromeNetLog); | 127 net_log_.reset(new ChromeNetLog); |
| 128 |
| 129 extension_event_router_forwarder_ = new ExtensionEventRouterForwarder; |
127 } | 130 } |
128 | 131 |
129 BrowserProcessImpl::~BrowserProcessImpl() { | 132 BrowserProcessImpl::~BrowserProcessImpl() { |
130 FilePath profile_path; | 133 FilePath profile_path; |
131 bool clear_local_state_on_exit; | 134 bool clear_local_state_on_exit; |
132 | 135 |
133 // Store the profile path for clearing local state data on exit. | 136 // Store the profile path for clearing local state data on exit. |
134 clear_local_state_on_exit = ShouldClearLocalState(&profile_path); | 137 clear_local_state_on_exit = ShouldClearLocalState(&profile_path); |
135 | 138 |
136 // Delete the AutomationProviderList before NotificationService, | 139 // Delete the AutomationProviderList before NotificationService, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 if (!created_sidebar_manager_) | 419 if (!created_sidebar_manager_) |
417 CreateSidebarManager(); | 420 CreateSidebarManager(); |
418 return sidebar_manager_.get(); | 421 return sidebar_manager_.get(); |
419 } | 422 } |
420 | 423 |
421 ui::Clipboard* BrowserProcessImpl::clipboard() { | 424 ui::Clipboard* BrowserProcessImpl::clipboard() { |
422 DCHECK(CalledOnValidThread()); | 425 DCHECK(CalledOnValidThread()); |
423 return clipboard_.get(); | 426 return clipboard_.get(); |
424 } | 427 } |
425 | 428 |
| 429 ExtensionEventRouterForwarder* |
| 430 BrowserProcessImpl::extension_event_router_forwarder() { |
| 431 return extension_event_router_forwarder_.get(); |
| 432 } |
| 433 |
426 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { | 434 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |
427 DCHECK(CalledOnValidThread()); | 435 DCHECK(CalledOnValidThread()); |
428 if (!created_notification_ui_manager_) | 436 if (!created_notification_ui_manager_) |
429 CreateNotificationUIManager(); | 437 CreateNotificationUIManager(); |
430 return notification_ui_manager_.get(); | 438 return notification_ui_manager_.get(); |
431 } | 439 } |
432 | 440 |
433 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { | 441 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
434 DCHECK(CalledOnValidThread()); | 442 DCHECK(CalledOnValidThread()); |
435 if (!created_browser_policy_connector_) { | 443 if (!created_browser_policy_connector_) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 #if defined(USE_X11) | 664 #if defined(USE_X11) |
657 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so | 665 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so |
658 // we start it now. | 666 // we start it now. |
659 scoped_ptr<base::Thread> background_x11_thread( | 667 scoped_ptr<base::Thread> background_x11_thread( |
660 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11)); | 668 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11)); |
661 if (!background_x11_thread->Start()) | 669 if (!background_x11_thread->Start()) |
662 return; | 670 return; |
663 background_x11_thread_.swap(background_x11_thread); | 671 background_x11_thread_.swap(background_x11_thread); |
664 #endif | 672 #endif |
665 | 673 |
666 scoped_ptr<IOThread> thread(new IOThread(local_state(), net_log_.get())); | 674 scoped_ptr<IOThread> thread(new IOThread( |
| 675 local_state(), net_log_.get(), extension_event_router_forwarder_.get())); |
667 base::Thread::Options options; | 676 base::Thread::Options options; |
668 options.message_loop_type = MessageLoop::TYPE_IO; | 677 options.message_loop_type = MessageLoop::TYPE_IO; |
669 if (!thread->StartWithOptions(options)) | 678 if (!thread->StartWithOptions(options)) |
670 return; | 679 return; |
671 io_thread_.swap(thread); | 680 io_thread_.swap(thread); |
672 } | 681 } |
673 | 682 |
674 void BrowserProcessImpl::CreateFileThread() { | 683 void BrowserProcessImpl::CreateFileThread() { |
675 DCHECK(!created_file_thread_ && file_thread_.get() == NULL); | 684 DCHECK(!created_file_thread_ && file_thread_.get() == NULL); |
676 created_file_thread_ = true; | 685 created_file_thread_ = true; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 } | 965 } |
957 | 966 |
958 void BrowserProcessImpl::OnAutoupdateTimer() { | 967 void BrowserProcessImpl::OnAutoupdateTimer() { |
959 if (CanAutorestartForUpdate()) { | 968 if (CanAutorestartForUpdate()) { |
960 DLOG(WARNING) << "Detected update. Restarting browser."; | 969 DLOG(WARNING) << "Detected update. Restarting browser."; |
961 RestartPersistentInstance(); | 970 RestartPersistentInstance(); |
962 } | 971 } |
963 } | 972 } |
964 | 973 |
965 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 974 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |