OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/io_thread.h" | 34 #include "chrome/browser/io_thread.h" |
35 #include "chrome/browser/metrics/metrics_service.h" | 35 #include "chrome/browser/metrics/metrics_service.h" |
36 #include "chrome/browser/net/predictor_api.h" | 36 #include "chrome/browser/net/predictor_api.h" |
37 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 37 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
38 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" | 38 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
39 #include "chrome/browser/notifications/notification_ui_manager.h" | 39 #include "chrome/browser/notifications/notification_ui_manager.h" |
40 #include "chrome/browser/plugin_service.h" | 40 #include "chrome/browser/plugin_service.h" |
41 #include "chrome/browser/plugin_updater.h" | 41 #include "chrome/browser/plugin_updater.h" |
42 #include "chrome/browser/prefs/pref_service.h" | 42 #include "chrome/browser/prefs/pref_service.h" |
43 #include "chrome/browser/printing/print_job_manager.h" | 43 #include "chrome/browser/printing/print_job_manager.h" |
| 44 #include "chrome/browser/printing/print_preview_tab_controller.h" |
44 #include "chrome/browser/profile_manager.h" | 45 #include "chrome/browser/profile_manager.h" |
45 #include "chrome/browser/renderer_host/render_process_host.h" | 46 #include "chrome/browser/renderer_host/render_process_host.h" |
46 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 47 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
47 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 48 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
48 #include "chrome/browser/sidebar/sidebar_manager.h" | 49 #include "chrome/browser/sidebar/sidebar_manager.h" |
49 #include "chrome/browser/tab_closeable_state_watcher.h" | 50 #include "chrome/browser/tab_closeable_state_watcher.h" |
50 #include "chrome/common/chrome_constants.h" | 51 #include "chrome/common/chrome_constants.h" |
51 #include "chrome/common/chrome_paths.h" | 52 #include "chrome/common/chrome_paths.h" |
52 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
53 #include "chrome/common/extensions/extension_resource.h" | 54 #include "chrome/common/extensions/extension_resource.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 428 |
428 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { | 429 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { |
429 // TODO(abarth): DCHECK(CalledOnValidThread()); | 430 // TODO(abarth): DCHECK(CalledOnValidThread()); |
430 // http://code.google.com/p/chromium/issues/detail?id=6828 | 431 // http://code.google.com/p/chromium/issues/detail?id=6828 |
431 // print_job_manager_ is initialized in the constructor and destroyed in the | 432 // print_job_manager_ is initialized in the constructor and destroyed in the |
432 // destructor, so it should always be valid. | 433 // destructor, so it should always be valid. |
433 DCHECK(print_job_manager_.get()); | 434 DCHECK(print_job_manager_.get()); |
434 return print_job_manager_.get(); | 435 return print_job_manager_.get(); |
435 } | 436 } |
436 | 437 |
| 438 printing::PrintPreviewTabController* |
| 439 BrowserProcessImpl::print_preview_tab_controller() { |
| 440 DCHECK(CalledOnValidThread()); |
| 441 if (!print_preview_tab_controller_.get()) |
| 442 CreatePrintPreviewTabController(); |
| 443 return print_preview_tab_controller_.get(); |
| 444 } |
| 445 |
437 GoogleURLTracker* BrowserProcessImpl::google_url_tracker() { | 446 GoogleURLTracker* BrowserProcessImpl::google_url_tracker() { |
438 DCHECK(CalledOnValidThread()); | 447 DCHECK(CalledOnValidThread()); |
439 if (!google_url_tracker_.get()) | 448 if (!google_url_tracker_.get()) |
440 CreateGoogleURLTracker(); | 449 CreateGoogleURLTracker(); |
441 return google_url_tracker_.get(); | 450 return google_url_tracker_.get(); |
442 } | 451 } |
443 | 452 |
444 IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() { | 453 IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() { |
445 DCHECK(CalledOnValidThread()); | 454 DCHECK(CalledOnValidThread()); |
446 if (!intranet_redirect_detector_.get()) | 455 if (!intranet_redirect_detector_.get()) |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 DCHECK(notification_ui_manager_.get() == NULL); | 707 DCHECK(notification_ui_manager_.get() == NULL); |
699 notification_ui_manager_.reset(NotificationUIManager::Create()); | 708 notification_ui_manager_.reset(NotificationUIManager::Create()); |
700 created_notification_ui_manager_ = true; | 709 created_notification_ui_manager_ = true; |
701 } | 710 } |
702 | 711 |
703 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { | 712 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { |
704 DCHECK(tab_closeable_state_watcher_.get() == NULL); | 713 DCHECK(tab_closeable_state_watcher_.get() == NULL); |
705 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); | 714 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); |
706 } | 715 } |
707 | 716 |
| 717 void BrowserProcessImpl::CreatePrintPreviewTabController() { |
| 718 DCHECK(print_preview_tab_controller_.get() == NULL); |
| 719 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); |
| 720 } |
| 721 |
708 // The BrowserProcess object must outlive the file thread so we use traits | 722 // The BrowserProcess object must outlive the file thread so we use traits |
709 // which don't do any management. | 723 // which don't do any management. |
710 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); | 724 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); |
711 | 725 |
712 #if defined(IPC_MESSAGE_LOG_ENABLED) | 726 #if defined(IPC_MESSAGE_LOG_ENABLED) |
713 | 727 |
714 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { | 728 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { |
715 // First enable myself. | 729 // First enable myself. |
716 if (enable) | 730 if (enable) |
717 IPC::Logging::current()->Enable(); | 731 IPC::Logging::current()->Enable(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } | 824 } |
811 | 825 |
812 void BrowserProcessImpl::OnAutoupdateTimer() { | 826 void BrowserProcessImpl::OnAutoupdateTimer() { |
813 if (CanAutorestartForUpdate()) { | 827 if (CanAutorestartForUpdate()) { |
814 DLOG(WARNING) << "Detected update. Restarting browser."; | 828 DLOG(WARNING) << "Detected update. Restarting browser."; |
815 RestartPersistentInstance(); | 829 RestartPersistentInstance(); |
816 } | 830 } |
817 } | 831 } |
818 | 832 |
819 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 833 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |