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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 created_local_state_(false), | 160 created_local_state_(false), |
161 created_icon_manager_(false), | 161 created_icon_manager_(false), |
162 created_notification_ui_manager_(false), | 162 created_notification_ui_manager_(false), |
163 created_safe_browsing_service_(false), | 163 created_safe_browsing_service_(false), |
164 module_ref_count_(0), | 164 module_ref_count_(0), |
165 did_start_(false), | 165 did_start_(false), |
166 checked_for_new_frames_(false), | 166 checked_for_new_frames_(false), |
167 using_new_frames_(false), | 167 using_new_frames_(false), |
168 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), | 168 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), |
169 download_status_updater_(new DownloadStatusUpdater), | 169 download_status_updater_(new DownloadStatusUpdater), |
170 local_state_task_runner_(local_state_task_runner) { | 170 local_state_task_runner_(local_state_task_runner), |
| 171 command_line_(command_line) { |
171 g_browser_process = this; | 172 g_browser_process = this; |
172 platform_part_.reset(new BrowserProcessPlatformPart()); | 173 platform_part_.reset(new BrowserProcessPlatformPart()); |
173 | 174 |
174 #if defined(ENABLE_PRINTING) | 175 #if defined(ENABLE_PRINTING) |
175 // Must be created after the NotificationService. | 176 // Must be created after the NotificationService. |
176 print_job_manager_.reset(new printing::PrintJobManager); | 177 print_job_manager_.reset(new printing::PrintJobManager); |
177 #endif | 178 #endif |
178 | 179 |
179 net_log_.reset(new ChromeNetLog); | 180 net_log_.reset(new ChromeNetLog); |
180 | 181 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 ApplyDefaultBrowserPolicy(); | 878 ApplyDefaultBrowserPolicy(); |
878 | 879 |
879 #if defined(ENABLE_PLUGINS) | 880 #if defined(ENABLE_PLUGINS) |
880 PluginService* plugin_service = PluginService::GetInstance(); | 881 PluginService* plugin_service = PluginService::GetInstance(); |
881 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); | 882 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); |
882 plugin_service->StartWatchingPlugins(); | 883 plugin_service->StartWatchingPlugins(); |
883 | 884 |
884 #if defined(OS_POSIX) | 885 #if defined(OS_POSIX) |
885 // Also find plugins in a user-specific plugins dir, | 886 // Also find plugins in a user-specific plugins dir, |
886 // e.g. ~/.config/chromium/Plugins. | 887 // e.g. ~/.config/chromium/Plugins. |
887 base::FilePath user_data_dir; | 888 if (!command_line_.HasSwitch(switches::kDisablePluginsDiscovery)) { |
888 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) | 889 base::FilePath user_data_dir; |
889 plugin_service->AddExtraPluginDir(user_data_dir.Append("Plugins")); | 890 if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) |
| 891 plugin_service->AddExtraPluginDir(user_data_dir.Append("Plugins")); |
| 892 } |
890 #endif | 893 #endif |
891 | 894 |
892 // Triggers initialization of the singleton instance on UI thread. | 895 // Triggers initialization of the singleton instance on UI thread. |
893 PluginFinder::GetInstance()->Init(); | 896 PluginFinder::GetInstance()->Init(); |
894 | 897 |
895 #if defined(ENABLE_PLUGIN_INSTALLATION) | 898 #if defined(ENABLE_PLUGIN_INSTALLATION) |
896 DCHECK(!plugins_resource_service_.get()); | 899 DCHECK(!plugins_resource_service_.get()); |
897 plugins_resource_service_ = new PluginsResourceService(local_state()); | 900 plugins_resource_service_ = new PluginsResourceService(local_state()); |
898 plugins_resource_service_->Init(); | 901 plugins_resource_service_->Init(); |
899 #endif | 902 #endif |
900 #endif // defined(ENABLE_PLUGINS) | 903 #endif // defined(ENABLE_PLUGINS) |
901 | 904 |
902 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 905 if (!command_line_.HasSwitch(switches::kDisableWebResources)) { |
903 if (!command_line.HasSwitch(switches::kDisableWebResources)) { | |
904 DCHECK(!promo_resource_service_.get()); | 906 DCHECK(!promo_resource_service_.get()); |
905 promo_resource_service_ = new PromoResourceService; | 907 promo_resource_service_ = new PromoResourceService; |
906 promo_resource_service_->StartAfterDelay(); | 908 promo_resource_service_->StartAfterDelay(); |
907 } | 909 } |
908 | 910 |
909 #if !defined(OS_ANDROID) | 911 #if !defined(OS_ANDROID) |
910 if (browser_defaults::bookmarks_enabled && | 912 if (browser_defaults::bookmarks_enabled && |
911 BookmarkPromptController::IsEnabled()) { | 913 BookmarkPromptController::IsEnabled()) { |
912 bookmark_prompt_controller_.reset(new BookmarkPromptController()); | 914 bookmark_prompt_controller_.reset(new BookmarkPromptController()); |
913 } | 915 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 } | 1060 } |
1059 | 1061 |
1060 void BrowserProcessImpl::OnAutoupdateTimer() { | 1062 void BrowserProcessImpl::OnAutoupdateTimer() { |
1061 if (CanAutorestartForUpdate()) { | 1063 if (CanAutorestartForUpdate()) { |
1062 DLOG(WARNING) << "Detected update. Restarting browser."; | 1064 DLOG(WARNING) << "Detected update. Restarting browser."; |
1063 RestartBackgroundInstance(); | 1065 RestartBackgroundInstance(); |
1064 } | 1066 } |
1065 } | 1067 } |
1066 | 1068 |
1067 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1069 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |