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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 DCHECK(notification_ui_manager_.get() == NULL); | 701 DCHECK(notification_ui_manager_.get() == NULL); |
693 notification_ui_manager_.reset(NotificationUIManager::Create()); | 702 notification_ui_manager_.reset(NotificationUIManager::Create()); |
694 created_notification_ui_manager_ = true; | 703 created_notification_ui_manager_ = true; |
695 } | 704 } |
696 | 705 |
697 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { | 706 void BrowserProcessImpl::CreateTabCloseableStateWatcher() { |
698 DCHECK(tab_closeable_state_watcher_.get() == NULL); | 707 DCHECK(tab_closeable_state_watcher_.get() == NULL); |
699 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); | 708 tab_closeable_state_watcher_.reset(TabCloseableStateWatcher::Create()); |
700 } | 709 } |
701 | 710 |
| 711 void BrowserProcessImpl::CreatePrintPreviewTabController() { |
| 712 DCHECK(print_preview_tab_controller_.get() == NULL); |
| 713 print_preview_tab_controller_ = new printing::PrintPreviewTabController(); |
| 714 } |
| 715 |
702 // The BrowserProcess object must outlive the file thread so we use traits | 716 // The BrowserProcess object must outlive the file thread so we use traits |
703 // which don't do any management. | 717 // which don't do any management. |
704 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); | 718 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); |
705 | 719 |
706 #if defined(IPC_MESSAGE_LOG_ENABLED) | 720 #if defined(IPC_MESSAGE_LOG_ENABLED) |
707 | 721 |
708 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { | 722 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { |
709 // First enable myself. | 723 // First enable myself. |
710 if (enable) | 724 if (enable) |
711 IPC::Logging::current()->Enable(); | 725 IPC::Logging::current()->Enable(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } | 818 } |
805 | 819 |
806 void BrowserProcessImpl::OnAutoupdateTimer() { | 820 void BrowserProcessImpl::OnAutoupdateTimer() { |
807 if (CanAutorestartForUpdate()) { | 821 if (CanAutorestartForUpdate()) { |
808 DLOG(WARNING) << "Detected update. Restarting browser."; | 822 DLOG(WARNING) << "Detected update. Restarting browser."; |
809 RestartPersistentInstance(); | 823 RestartPersistentInstance(); |
810 } | 824 } |
811 } | 825 } |
812 | 826 |
813 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 827 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |