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 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/metrics/thread_watcher.h" | 38 #include "chrome/browser/metrics/thread_watcher.h" |
39 #include "chrome/browser/net/chrome_net_log.h" | 39 #include "chrome/browser/net/chrome_net_log.h" |
40 #include "chrome/browser/net/predictor_api.h" | 40 #include "chrome/browser/net/predictor_api.h" |
41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
42 #include "chrome/browser/notifications/notification_ui_manager.h" | 42 #include "chrome/browser/notifications/notification_ui_manager.h" |
43 #include "chrome/browser/platform_util.h" | 43 #include "chrome/browser/platform_util.h" |
44 #include "chrome/browser/plugin_data_remover.h" | 44 #include "chrome/browser/plugin_data_remover.h" |
45 #include "chrome/browser/policy/browser_policy_connector.h" | 45 #include "chrome/browser/policy/browser_policy_connector.h" |
46 #include "chrome/browser/prefs/browser_prefs.h" | 46 #include "chrome/browser/prefs/browser_prefs.h" |
47 #include "chrome/browser/prefs/pref_service.h" | 47 #include "chrome/browser/prefs/pref_service.h" |
| 48 #include "chrome/browser/prerender/prerender_tracker.h" |
48 #include "chrome/browser/printing/background_printing_manager.h" | 49 #include "chrome/browser/printing/background_printing_manager.h" |
49 #include "chrome/browser/printing/print_job_manager.h" | 50 #include "chrome/browser/printing/print_job_manager.h" |
50 #include "chrome/browser/printing/print_preview_tab_controller.h" | 51 #include "chrome/browser/printing/print_preview_tab_controller.h" |
51 #include "chrome/browser/profiles/profile_manager.h" | 52 #include "chrome/browser/profiles/profile_manager.h" |
| 53 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_observer.
h" |
52 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 54 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
53 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 55 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
54 #include "chrome/browser/shell_integration.h" | 56 #include "chrome/browser/shell_integration.h" |
55 #include "chrome/browser/sidebar/sidebar_manager.h" | 57 #include "chrome/browser/sidebar/sidebar_manager.h" |
56 #include "chrome/browser/tab_closeable_state_watcher.h" | 58 #include "chrome/browser/tab_closeable_state_watcher.h" |
57 #include "chrome/browser/ui/browser_list.h" | 59 #include "chrome/browser/ui/browser_list.h" |
58 #include "chrome/common/chrome_constants.h" | 60 #include "chrome/common/chrome_constants.h" |
59 #include "chrome/common/chrome_paths.h" | 61 #include "chrome/common/chrome_paths.h" |
60 #include "chrome/common/chrome_switches.h" | 62 #include "chrome/common/chrome_switches.h" |
61 #include "chrome/common/default_plugin.h" | 63 #include "chrome/common/default_plugin.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 base::TimeDelta::FromHours(kUpdateCheckIntervalHours), | 689 base::TimeDelta::FromHours(kUpdateCheckIntervalHours), |
688 this, | 690 this, |
689 &BrowserProcessImpl::OnAutoupdateTimer); | 691 &BrowserProcessImpl::OnAutoupdateTimer); |
690 } | 692 } |
691 #endif | 693 #endif |
692 | 694 |
693 ChromeNetLog* BrowserProcessImpl::net_log() { | 695 ChromeNetLog* BrowserProcessImpl::net_log() { |
694 return net_log_.get(); | 696 return net_log_.get(); |
695 } | 697 } |
696 | 698 |
| 699 prerender::PrerenderTracker* BrowserProcessImpl::prerender_tracker() { |
| 700 if (!prerender_tracker_.get()) |
| 701 prerender_tracker_.reset(new prerender::PrerenderTracker); |
| 702 |
| 703 return prerender_tracker_.get(); |
| 704 } |
| 705 |
697 void BrowserProcessImpl::ClearLocalState(const FilePath& profile_path) { | 706 void BrowserProcessImpl::ClearLocalState(const FilePath& profile_path) { |
698 webkit_database::DatabaseTracker::ClearLocalState(profile_path); | 707 webkit_database::DatabaseTracker::ClearLocalState(profile_path); |
699 BrowsingDataRemover::ClearGearsData(profile_path); | 708 BrowsingDataRemover::ClearGearsData(profile_path); |
700 } | 709 } |
701 | 710 |
702 bool BrowserProcessImpl::ShouldClearLocalState(FilePath* profile_path) { | 711 bool BrowserProcessImpl::ShouldClearLocalState(FilePath* profile_path) { |
703 FilePath user_data_dir; | 712 FilePath user_data_dir; |
704 Profile* profile; | 713 Profile* profile; |
705 | 714 |
706 // Check for the existence of a profile manager. When quitting early, | 715 // Check for the existence of a profile manager. When quitting early, |
(...skipping 16 matching lines...) Expand all Loading... |
723 resource_dispatcher_host_.get() == NULL); | 732 resource_dispatcher_host_.get() == NULL); |
724 created_resource_dispatcher_host_ = true; | 733 created_resource_dispatcher_host_ = true; |
725 | 734 |
726 // UserScriptListener will delete itself. | 735 // UserScriptListener will delete itself. |
727 ResourceQueue::DelegateSet resource_queue_delegates; | 736 ResourceQueue::DelegateSet resource_queue_delegates; |
728 resource_queue_delegates.insert(new UserScriptListener()); | 737 resource_queue_delegates.insert(new UserScriptListener()); |
729 | 738 |
730 resource_dispatcher_host_.reset( | 739 resource_dispatcher_host_.reset( |
731 new ResourceDispatcherHost(resource_queue_delegates)); | 740 new ResourceDispatcherHost(resource_queue_delegates)); |
732 resource_dispatcher_host_->Initialize(); | 741 resource_dispatcher_host_->Initialize(); |
| 742 |
| 743 resource_dispatcher_host_observer_.reset( |
| 744 new ChromeResourceDispatcherHostObserver(prerender_tracker())); |
| 745 resource_dispatcher_host_->set_observer( |
| 746 resource_dispatcher_host_observer_.get()); |
733 } | 747 } |
734 | 748 |
735 void BrowserProcessImpl::CreateMetricsService() { | 749 void BrowserProcessImpl::CreateMetricsService() { |
736 DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); | 750 DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); |
737 created_metrics_service_ = true; | 751 created_metrics_service_ = true; |
738 | 752 |
739 metrics_service_.reset(new MetricsService); | 753 metrics_service_.reset(new MetricsService); |
740 } | 754 } |
741 | 755 |
742 void BrowserProcessImpl::CreateIOThread() { | 756 void BrowserProcessImpl::CreateIOThread() { |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 } | 1139 } |
1126 | 1140 |
1127 void BrowserProcessImpl::OnAutoupdateTimer() { | 1141 void BrowserProcessImpl::OnAutoupdateTimer() { |
1128 if (CanAutorestartForUpdate()) { | 1142 if (CanAutorestartForUpdate()) { |
1129 DLOG(WARNING) << "Detected update. Restarting browser."; | 1143 DLOG(WARNING) << "Detected update. Restarting browser."; |
1130 RestartPersistentInstance(); | 1144 RestartPersistentInstance(); |
1131 } | 1145 } |
1132 } | 1146 } |
1133 | 1147 |
1134 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1148 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |