blob: 40aa7f45d18ad348b924834d461c94633727b274 [file] [log] [blame]
[email protected]3a80ea332012-01-09 19:53:291// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
5#include "chrome/browser/browser_process_impl.h"
6
[email protected]3cdacd42010-04-30 18:55:537#include <map>
[email protected]68f88b992011-05-07 02:01:398#include <set>
9#include <vector>
[email protected]3cdacd42010-04-30 18:55:5310
[email protected]b3cc05442011-11-19 22:43:4411#include "base/bind.h"
12#include "base/bind_helpers.h"
initial.commit09911bf2008-07-26 23:55:2913#include "base/command_line.h"
[email protected]6641bf662009-08-21 00:34:0914#include "base/file_util.h"
initial.commit09911bf2008-07-26 23:55:2915#include "base/path_service.h"
[email protected]985655a2011-02-23 09:54:2516#include "base/synchronization/waitable_event.h"
[email protected]34b99632011-01-01 01:01:0617#include "base/threading/thread.h"
18#include "base/threading/thread_restrictions.h"
[email protected]e13ad79b2010-07-22 21:36:5019#include "chrome/browser/automation/automation_provider_list.h"
[email protected]a07676b22011-06-17 16:36:5320#include "chrome/browser/background/background_mode_manager.h"
[email protected]ac262c9f2008-10-19 17:45:2121#include "chrome/browser/browser_trial.h"
[email protected]c38831a12011-10-28 12:44:4922#include "chrome/browser/chrome_browser_main.h"
[email protected]dfba8762011-09-02 12:49:5423#include "chrome/browser/chrome_plugin_service_filter.h"
[email protected]c1adf5a2011-08-03 22:11:3724#include "chrome/browser/component_updater/component_updater_configurator.h"
25#include "chrome/browser/component_updater/component_updater_service.h"
[email protected]4475d232011-07-27 15:29:2026#include "chrome/browser/debugger/remote_debugging_server.h"
[email protected]254ed742011-08-16 18:45:2727#include "chrome/browser/download/download_request_limiter.h"
[email protected]75e51b52012-02-04 16:57:5428#include "chrome/browser/download/download_status_updater.h"
[email protected]3ce02412011-03-01 12:01:1529#include "chrome/browser/extensions/extension_event_router_forwarder.h"
[email protected]fc4facd2011-03-22 23:18:5030#include "chrome/browser/extensions/extension_tab_id_map.h"
[email protected]b6cf240f2011-10-15 22:09:5331#include "chrome/browser/extensions/network_delay_listener.h"
[email protected]214538842011-04-01 18:47:2432#include "chrome/browser/extensions/user_script_listener.h"
[email protected]815856722011-04-13 17:19:1933#include "chrome/browser/first_run/upgrade_util.h"
[email protected]f7578f52010-08-30 22:22:4934#include "chrome/browser/google/google_url_tracker.h"
[email protected]dcefa302009-05-20 00:24:3935#include "chrome/browser/icon_manager.h"
[email protected]c4ff4952010-01-08 19:12:4736#include "chrome/browser/intranet_redirect_detector.h"
[email protected]0ac83682010-01-22 17:46:2737#include "chrome/browser/io_thread.h"
[email protected]dc6f4962009-02-13 01:25:5038#include "chrome/browser/metrics/metrics_service.h"
[email protected]0b565182011-03-02 18:11:1539#include "chrome/browser/metrics/thread_watcher.h"
[email protected]b2fcd0e2010-12-01 15:19:4040#include "chrome/browser/net/chrome_net_log.h"
[email protected]ca167a32011-09-30 15:19:1141#include "chrome/browser/net/crl_set_fetcher.h"
[email protected]d393a0fd2009-05-13 23:32:0142#include "chrome/browser/net/sdch_dictionary_fetcher.h"
[email protected]29672ab2009-10-30 03:44:0343#include "chrome/browser/notifications/notification_ui_manager.h"
[email protected]985655a2011-02-23 09:54:2544#include "chrome/browser/policy/browser_policy_connector.h"
[email protected]caf63aea2011-04-26 11:04:1045#include "chrome/browser/prefs/browser_prefs.h"
[email protected]37858e52010-08-26 00:22:0246#include "chrome/browser/prefs/pref_service.h"
[email protected]1459fb62011-05-25 19:03:2747#include "chrome/browser/prerender/prerender_tracker.h"
[email protected]68f88b992011-05-07 02:01:3948#include "chrome/browser/printing/background_printing_manager.h"
[email protected]e06131d2010-02-10 18:40:3349#include "chrome/browser/printing/print_job_manager.h"
[email protected]dbeebd52010-11-16 20:34:1650#include "chrome/browser/printing/print_preview_tab_controller.h"
[email protected]8ecad5e2010-12-02 21:18:3351#include "chrome/browser/profiles/profile_manager.h"
[email protected]8bcdf072011-06-03 16:52:1552#include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h"
[email protected]81218f42009-02-05 18:48:0853#include "chrome/browser/safe_browsing/safe_browsing_service.h"
[email protected]e450fa62011-02-01 12:52:5654#include "chrome/browser/shell_integration.h"
[email protected]9e7f015f2011-05-28 00:24:2555#include "chrome/browser/status_icons/status_tray.h"
[email protected]0b4d3382010-07-14 16:13:0456#include "chrome/browser/tab_closeable_state_watcher.h"
[email protected]7a0e72f2011-09-20 19:59:1157#include "chrome/browser/tab_contents/thumbnail_generator.h"
[email protected]71b73f02011-04-06 15:57:2958#include "chrome/browser/ui/browser_list.h"
[email protected]4ef795df2010-02-03 02:35:0859#include "chrome/common/chrome_constants.h"
[email protected]432115822011-07-10 15:52:2760#include "chrome/common/chrome_notification_types.h"
initial.commit09911bf2008-07-26 23:55:2961#include "chrome/common/chrome_paths.h"
62#include "chrome/common/chrome_switches.h"
[email protected]f1b6de22010-03-06 12:13:4763#include "chrome/common/extensions/extension_l10n_util.h"
[email protected]985655a2011-02-23 09:54:2564#include "chrome/common/extensions/extension_resource.h"
[email protected]ea587b02010-05-21 15:01:3565#include "chrome/common/json_pref_store.h"
initial.commit09911bf2008-07-26 23:55:2966#include "chrome/common/pref_names.h"
[email protected]5c08f222010-09-22 09:37:2167#include "chrome/common/switch_utils.h"
[email protected]985655a2011-02-23 09:54:2568#include "chrome/common/url_constants.h"
[email protected]bd48c2b02010-04-09 20:32:4269#include "chrome/installer/util/google_update_constants.h"
[email protected]8f6a3b852011-07-19 16:48:5670#include "content/browser/download/mhtml_generation_manager.h"
[email protected]6eac57a2011-07-12 21:15:0971#include "content/browser/net/browser_online_state_observer.h"
[email protected]a01efd22011-03-01 00:38:3272#include "content/browser/renderer_host/resource_dispatcher_host.h"
[email protected]c38831a12011-10-28 12:44:4973#include "content/public/browser/browser_thread.h"
[email protected]b9535422012-02-09 01:47:5974#include "content/public/browser/child_process_security_policy.h"
[email protected]ad50def52011-10-19 23:17:0775#include "content/public/browser/notification_details.h"
[email protected]3a5180ae2011-12-21 02:39:3876#include "content/public/browser/plugin_service.h"
[email protected]f3b1a082011-11-18 00:34:3077#include "content/public/browser/render_process_host.h"
[email protected]2e77cb32011-12-12 21:50:0078#include "media/audio/audio_manager.h"
[email protected]12c84e22011-07-11 09:35:4579#include "net/socket/client_socket_pool_manager.h"
[email protected]abe2c032011-03-31 18:49:3480#include "net/url_request/url_request_context_getter.h"
[email protected]2dfeaf92011-01-10 21:08:2181#include "ui/base/clipboard/clipboard.h"
[email protected]c051a1b2011-01-21 23:30:1782#include "ui/base/l10n/l10n_util.h"
[email protected]b112a4c2009-02-01 20:24:0183
84#if defined(OS_WIN)
[email protected]477ae052011-11-18 23:53:5785#include "ui/views/focus/view_storage.h"
[email protected]03d8d3e92011-09-20 06:07:1186#elif defined(OS_MACOSX)
87#include "chrome/browser/chrome_browser_main_mac.h"
[email protected]86230b92009-11-23 20:38:3888#endif
89
[email protected]db0e86dd2011-03-16 14:47:2190#if defined(OS_CHROMEOS)
[email protected]5b869962011-09-20 19:49:3391#include "chrome/browser/oom_priority_manager.h"
[email protected]db0e86dd2011-03-16 14:47:2192#endif // defined(OS_CHROMEOS)
93
[email protected]3cdacd42010-04-30 18:55:5394#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
95// How often to check if the persistent instance of Chrome needs to restart
96// to install an update.
97static const int kUpdateCheckIntervalHours = 6;
98#endif
99
[email protected]af391f02011-09-15 06:13:35100#if defined(OS_WIN)
101// Attest to the fact that the call to the file thread to save preferences has
102// run, and it is safe to terminate. This avoids the potential of some other
103// task prematurely terminating our waiting message loop by posting a
104// QuitTask().
105static bool g_end_session_file_thread_has_completed = false;
106#endif
107
[email protected]c6032e82010-09-13 20:06:05108#if defined(USE_X11)
109// How long to wait for the File thread to complete during EndSession, on
110// Linux. We have a timeout here because we're unable to run the UI messageloop
111// and there's some deadlock risk. Our only option is to exit anyway.
112static const int kEndSessionTimeoutSeconds = 10;
113#endif
114
[email protected]631bb742011-11-02 11:29:39115using content::BrowserThread;
[email protected]b9535422012-02-09 01:47:59116using content::ChildProcessSecurityPolicy;
[email protected]3a5180ae2011-12-21 02:39:38117using content::PluginService;
[email protected]631bb742011-11-02 11:29:39118
[email protected]bb975362009-01-21 01:00:22119BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
[email protected]99907362012-01-11 05:41:40120 : created_metrics_service_(false),
[email protected]0b565182011-03-02 18:11:15121 created_watchdog_thread_(false),
initial.commit09911bf2008-07-26 23:55:29122 created_profile_manager_(false),
123 created_local_state_(false),
[email protected]b112a4c2009-02-01 20:24:01124 created_icon_manager_(false),
[email protected]985655a2011-02-23 09:54:25125 created_browser_policy_connector_(false),
[email protected]29672ab2009-10-30 03:44:03126 created_notification_ui_manager_(false),
[email protected]462a0ff2011-06-02 17:15:34127 created_safe_browsing_service_(false),
initial.commit09911bf2008-07-26 23:55:29128 module_ref_count_(0),
[email protected]afd20c022010-06-10 00:48:20129 did_start_(false),
[email protected]1b2db1a2008-08-08 17:46:13130 checked_for_new_frames_(false),
[email protected]7a0e72f2011-09-20 19:59:11131 using_new_frames_(false),
132 thumbnail_generator_(new ThumbnailGenerator),
133 download_status_updater_(new DownloadStatusUpdater) {
initial.commit09911bf2008-07-26 23:55:29134 g_browser_process = this;
[email protected]2dfeaf92011-01-10 21:08:21135 clipboard_.reset(new ui::Clipboard);
initial.commit09911bf2008-07-26 23:55:29136
137 // Must be created after the NotificationService.
138 print_job_manager_.reset(new printing::PrintJobManager);
139
[email protected]b2fcd0e2010-12-01 15:19:40140 net_log_.reset(new ChromeNetLog);
[email protected]3ce02412011-03-01 12:01:15141
[email protected]8add5412011-10-01 21:02:14142 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme(
143 chrome::kExtensionScheme);
144
[email protected]3ce02412011-03-01 12:01:15145 extension_event_router_forwarder_ = new ExtensionEventRouterForwarder;
[email protected]fc4facd2011-03-22 23:18:50146
147 ExtensionTabIdMap::GetInstance()->Init();
[email protected]6eac57a2011-07-12 21:15:09148
149 online_state_observer_.reset(new BrowserOnlineStateObserver);
initial.commit09911bf2008-07-26 23:55:29150}
151
152BrowserProcessImpl::~BrowserProcessImpl() {
[email protected]2e5b60a22011-11-28 15:56:41153 // Wait for the pending print jobs to finish.
154 print_job_manager_->OnQuit();
155 print_job_manager_.reset();
156
157 tracked_objects::ThreadData::EnsureCleanupWasCalled(4);
158
159 g_browser_process = NULL;
160}
161
162void BrowserProcessImpl::StartTearDown() {
initial.commit09911bf2008-07-26 23:55:29163 // Delete the AutomationProviderList before NotificationService,
164 // since it may try to unregister notifications
165 // Both NotificationService and AutomationProvider are singleton instances in
166 // the BrowserProcess. Since AutomationProvider may have some active
167 // notification observers, it is essential that it gets destroyed before the
168 // NotificationService. NotificationService won't be destroyed until after
169 // this destructor is run.
170 automation_provider_list_.reset();
171
[email protected]d393a0fd2009-05-13 23:32:01172 // We need to shutdown the SdchDictionaryFetcher as it regularly holds
173 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do
174 // a PostDelayedTask onto the IO thread. This shutdown call will both discard
175 // any pending URLFetchers, and avoid creating any more.
[email protected]cf956b982011-12-02 12:00:45176 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
177 base::Bind(&SdchDictionaryFetcher::Shutdown));
[email protected]d393a0fd2009-05-13 23:32:01178
[email protected]51ac040762011-01-20 02:01:04179 // We need to destroy the MetricsService, GoogleURLTracker,
180 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService
[email protected]9efb46692011-08-23 12:56:05181 // (owned by the SafeBrowsingService) before the io_thread_ gets destroyed,
182 // since their destructors can call the URLFetcher destructor, which does a
183 // PostDelayedTask operation on the IO thread.
184 // (The IO thread will handle that URLFetcher operation before going away.)
initial.commit09911bf2008-07-26 23:55:29185 metrics_service_.reset();
186 google_url_tracker_.reset();
[email protected]c4ff4952010-01-08 19:12:47187 intranet_redirect_detector_.reset();
[email protected]9efb46692011-08-23 12:56:05188#if defined(ENABLE_SAFE_BROWSING)
189 if (safe_browsing_service_.get()) {
190 safe_browsing_service()->ShutDown();
191 }
192#endif
initial.commit09911bf2008-07-26 23:55:29193
[email protected]d8a899c2010-09-21 04:50:33194 // Need to clear the desktop notification balloons before the io_thread_ and
195 // before the profiles, since if there are any still showing we will access
196 // those things during teardown.
197 notification_ui_manager_.reset();
198
initial.commit09911bf2008-07-26 23:55:29199 // Need to clear profiles (download managers) before the io_thread_.
200 profile_manager_.reset();
201
202 // Debugger must be cleaned up before IO thread and NotificationService.
[email protected]4475d232011-07-27 15:29:20203 remote_debugging_server_.reset();
204
[email protected]fc4facd2011-03-22 23:18:50205 ExtensionTabIdMap::GetInstance()->Shutdown();
206
[email protected]985655a2011-02-23 09:54:25207 // The policy providers managed by |browser_policy_connector_| need to shut
208 // down while the IO and FILE threads are still alive.
209 browser_policy_connector_.reset();
[email protected]f2a893c2011-01-05 09:38:07210
[email protected]8fd11832011-07-14 20:01:13211 // Stop the watchdog thread before stopping other threads.
212 watchdog_thread_.reset();
[email protected]2e5b60a22011-11-28 15:56:41213}
[email protected]8fd11832011-07-14 20:01:13214
[email protected]99907362012-01-11 05:41:40215void BrowserProcessImpl::PostDestroyThreads() {
216 // With the file_thread_ flushed, we can release any icon resources.
217 icon_manager_.reset();
initial.commit09911bf2008-07-26 23:55:29218
[email protected]99907362012-01-11 05:41:40219 // Reset associated state right after actual thread is stopped,
220 // as io_thread_.global_ cleanup happens in CleanUp on the IO
221 // thread, i.e. as the thread exits its message loop.
222 //
223 // This is important also because in various places, the
224 // IOThread object being NULL is considered synonymous with the
225 // IO thread having stopped.
226 io_thread_.reset();
initial.commit09911bf2008-07-26 23:55:29227}
228
[email protected]c6032e82010-09-13 20:06:05229#if defined(OS_WIN)
[email protected]af391f02011-09-15 06:13:35230// Send a QuitTask to the given MessageLoop when the (file) thread has processed
231// our (other) recent requests (to save preferences).
232// Change the boolean so that the receiving thread will know that we did indeed
233// send the QuitTask that terminated the message loop.
[email protected]295039bd2008-08-15 04:32:57234static void PostQuit(MessageLoop* message_loop) {
[email protected]af391f02011-09-15 06:13:35235 g_end_session_file_thread_has_completed = true;
[email protected]a778709f2011-12-10 00:28:17236 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
[email protected]295039bd2008-08-15 04:32:57237}
[email protected]c6032e82010-09-13 20:06:05238#elif defined(USE_X11)
239static void Signal(base::WaitableEvent* event) {
240 event->Signal();
241}
242#endif
initial.commit09911bf2008-07-26 23:55:29243
[email protected]b443cb042009-12-15 22:05:09244unsigned int BrowserProcessImpl::AddRefModule() {
245 DCHECK(CalledOnValidThread());
[email protected]63b9d962011-09-14 20:32:31246 CHECK(!IsShuttingDown());
[email protected]afd20c022010-06-10 00:48:20247 did_start_ = true;
[email protected]b443cb042009-12-15 22:05:09248 module_ref_count_++;
249 return module_ref_count_;
250}
251
252unsigned int BrowserProcessImpl::ReleaseModule() {
253 DCHECK(CalledOnValidThread());
[email protected]760d970a2010-05-18 00:39:18254 DCHECK_NE(0u, module_ref_count_);
[email protected]b443cb042009-12-15 22:05:09255 module_ref_count_--;
256 if (0 == module_ref_count_) {
[email protected]e6244c182011-11-01 22:06:58257 CHECK(MessageLoop::current()->is_running());
[email protected]7d038c32010-12-14 00:40:00258 // Allow UI and IO threads to do blocking IO on shutdown, since we do a lot
259 // of it on shutdown for valid reasons.
260 base::ThreadRestrictions::SetIOAllowed(true);
[email protected]0a53082e2011-09-16 09:31:25261 CHECK(!BrowserList::GetLastActive());
[email protected]dd483702011-12-02 14:47:42262 BrowserThread::PostTask(
263 BrowserThread::IO,
[email protected]7d038c32010-12-14 00:40:00264 FROM_HERE,
[email protected]dcde7672012-01-06 02:37:17265 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
266 true));
[email protected]03d8d3e92011-09-20 06:07:11267
268#if defined(OS_MACOSX)
[email protected]8d2f91e2011-09-15 22:38:04269 MessageLoop::current()->PostTask(
[email protected]03d8d3e92011-09-20 06:07:11270 FROM_HERE,
[email protected]b3cc05442011-11-19 22:43:44271 base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop));
[email protected]03d8d3e92011-09-20 06:07:11272#endif
[email protected]b443cb042009-12-15 22:05:09273 MessageLoop::current()->Quit();
274 }
275 return module_ref_count_;
276}
277
initial.commit09911bf2008-07-26 23:55:29278void BrowserProcessImpl::EndSession() {
initial.commit09911bf2008-07-26 23:55:29279 // Mark all the profiles as clean.
280 ProfileManager* pm = profile_manager();
[email protected]844a1002011-04-19 11:37:21281 std::vector<Profile*> profiles(pm->GetLoadedProfiles());
282 for (size_t i = 0; i < profiles.size(); ++i)
283 profiles[i]->MarkAsCleanShutdown();
initial.commit09911bf2008-07-26 23:55:29284
285 // Tell the metrics service it was cleanly shutdown.
286 MetricsService* metrics = g_browser_process->metrics_service();
287 if (metrics && local_state()) {
initial.commit09911bf2008-07-26 23:55:29288 metrics->RecordStartOfSessionEnd();
289
290 // MetricsService lazily writes to prefs, force it to write now.
[email protected]fbe17c8a2011-12-27 16:41:48291 local_state()->CommitPendingWrite();
initial.commit09911bf2008-07-26 23:55:29292 }
293
294 // We must write that the profile and metrics service shutdown cleanly,
295 // otherwise on startup we'll think we crashed. So we block until done and
296 // then proceed with normal shutdown.
[email protected]c6032e82010-09-13 20:06:05297#if defined(USE_X11)
298 // Can't run a local loop on linux. Instead create a waitable event.
[email protected]0bfbcdb2011-09-15 21:28:04299 scoped_ptr<base::WaitableEvent> done_writing(
300 new base::WaitableEvent(false, false));
[email protected]d04e7662010-10-10 22:24:48301 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
[email protected]b3cc05442011-11-19 22:43:44302 base::Bind(Signal, done_writing.get()));
[email protected]0bfbcdb2011-09-15 21:28:04303 // If all file writes haven't cleared in the timeout, leak the WaitableEvent
304 // so that there's no race to reference it in Signal().
305 if (!done_writing->TimedWait(
306 base::TimeDelta::FromSeconds(kEndSessionTimeoutSeconds)))
307 ignore_result(done_writing.release());
308
[email protected]c6032e82010-09-13 20:06:05309#elif defined(OS_WIN)
[email protected]d04e7662010-10-10 22:24:48310 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
[email protected]b3cc05442011-11-19 22:43:44311 base::Bind(PostQuit, MessageLoop::current()));
[email protected]af391f02011-09-15 06:13:35312 int quits_received = 0;
313 do {
314 MessageLoop::current()->Run();
315 ++quits_received;
316 } while (!g_end_session_file_thread_has_completed);
317 // If we did get extra quits, then we should re-post them to the message loop.
318 while (--quits_received > 0)
[email protected]a778709f2011-12-10 00:28:17319 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
[email protected]c6032e82010-09-13 20:06:05320#else
321 NOTIMPLEMENTED();
322#endif
initial.commit09911bf2008-07-26 23:55:29323}
324
[email protected]e13ad79b2010-07-22 21:36:50325MetricsService* BrowserProcessImpl::metrics_service() {
326 DCHECK(CalledOnValidThread());
327 if (!created_metrics_service_)
328 CreateMetricsService();
329 return metrics_service_.get();
330}
331
332IOThread* BrowserProcessImpl::io_thread() {
333 DCHECK(CalledOnValidThread());
[email protected]2e5b60a22011-11-28 15:56:41334 DCHECK(io_thread_.get());
[email protected]e13ad79b2010-07-22 21:36:50335 return io_thread_.get();
336}
337
[email protected]0b565182011-03-02 18:11:15338WatchDogThread* BrowserProcessImpl::watchdog_thread() {
339 DCHECK(CalledOnValidThread());
340 if (!created_watchdog_thread_)
341 CreateWatchdogThread();
342 DCHECK(watchdog_thread_.get() != NULL);
343 return watchdog_thread_.get();
344}
345
[email protected]e13ad79b2010-07-22 21:36:50346ProfileManager* BrowserProcessImpl::profile_manager() {
347 DCHECK(CalledOnValidThread());
348 if (!created_profile_manager_)
349 CreateProfileManager();
350 return profile_manager_.get();
351}
352
353PrefService* BrowserProcessImpl::local_state() {
354 DCHECK(CalledOnValidThread());
355 if (!created_local_state_)
356 CreateLocalState();
357 return local_state_.get();
358}
359
[email protected]2dfeaf92011-01-10 21:08:21360ui::Clipboard* BrowserProcessImpl::clipboard() {
[email protected]e13ad79b2010-07-22 21:36:50361 DCHECK(CalledOnValidThread());
362 return clipboard_.get();
363}
364
[email protected]abe2c032011-03-31 18:49:34365net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() {
[email protected]db0e86dd2011-03-16 14:47:21366 DCHECK(CalledOnValidThread());
367 return io_thread()->system_url_request_context_getter();
368}
369
370#if defined(OS_CHROMEOS)
[email protected]5b869962011-09-20 19:49:33371browser::OomPriorityManager* BrowserProcessImpl::oom_priority_manager() {
372 DCHECK(CalledOnValidThread());
373 if (!oom_priority_manager_.get())
374 oom_priority_manager_.reset(new browser::OomPriorityManager());
375 return oom_priority_manager_.get();
376}
[email protected]db0e86dd2011-03-16 14:47:21377#endif // defined(OS_CHROMEOS)
378
[email protected]3ce02412011-03-01 12:01:15379ExtensionEventRouterForwarder*
380BrowserProcessImpl::extension_event_router_forwarder() {
381 return extension_event_router_forwarder_.get();
382}
383
[email protected]e13ad79b2010-07-22 21:36:50384NotificationUIManager* BrowserProcessImpl::notification_ui_manager() {
385 DCHECK(CalledOnValidThread());
386 if (!created_notification_ui_manager_)
387 CreateNotificationUIManager();
388 return notification_ui_manager_.get();
389}
390
[email protected]985655a2011-02-23 09:54:25391policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() {
[email protected]f2a893c2011-01-05 09:38:07392 DCHECK(CalledOnValidThread());
[email protected]985655a2011-02-23 09:54:25393 if (!created_browser_policy_connector_) {
394 DCHECK(browser_policy_connector_.get() == NULL);
395 created_browser_policy_connector_ = true;
[email protected]f31e2e52011-07-14 16:01:19396#if defined(ENABLE_CONFIGURATION_POLICY)
[email protected]5fe04582011-11-21 19:25:57397 browser_policy_connector_.reset(new policy::BrowserPolicyConnector());
398 browser_policy_connector_->Init();
[email protected]f31e2e52011-07-14 16:01:19399#endif
[email protected]f2a893c2011-01-05 09:38:07400 }
[email protected]985655a2011-02-23 09:54:25