15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// When each service is created, we set a flag indicating this. At this point,
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the service initialization could fail or succeed. This allows us to remember
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// if we tried to create a service, and not try creating it over and over if
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the creation failed.
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/debug/stack_trace.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/ref_counted.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/prefs/pref_change_registrar.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/threading/non_thread_safe.h"
21eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/timer/timer.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/browser_process.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass ChromeDeviceClient;
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ChromeNetLog;
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ChromeResourceDispatcherHostDelegate;
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RemoteDebuggingServer;
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PrefRegistrySimple;
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PromoResourceService;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(ENABLE_PLUGIN_INSTALLATION)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PluginsResourceService;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace base {
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class CommandLine;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SequencedTaskRunner;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace extensions {
41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class ExtensionsBrowserClient;
42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
43f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
4446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)namespace gcm {
4546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)class GCMDriver;
4646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)}
4746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace policy {
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserPolicyConnector;
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PolicyService;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Real implementation of BrowserProcess that creates and returns the services.
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserProcessImpl : public BrowserProcess,
552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                           public base::NonThreadSafe {
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |local_state_task_runner| must be a shutdown-blocking task runner.
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserProcessImpl(base::SequencedTaskRunner* local_state_task_runner,
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                     const base::CommandLine& command_line);
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~BrowserProcessImpl();
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called before the browser threads are created.
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PreCreateThreads();
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called after the threads have been created but before the message loops
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // starts running. Allows the browser process to do any initialization that
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // requires all threads running.
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PreMainMessageLoopRun();
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Most cleanup is done by these functions, driven from
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ChromeBrowserMain based on notifications from the content
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // framework, rather than in the destructor, so that we can
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // interleave cleanup with threads being stopped.
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void StartTearDown();
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void PostDestroyThreads();
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // BrowserProcess implementation.
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ResourceDispatcherHostCreated() OVERRIDE;
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EndSession() OVERRIDE;
8046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual MetricsServicesManager* GetMetricsServicesManager() OVERRIDE;
811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual metrics::MetricsService* metrics_service() OVERRIDE;
82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual rappor::RapporService* rappor_service() OVERRIDE;
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual IOThread* io_thread() OVERRIDE;
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual WatchDogThread* watchdog_thread() OVERRIDE;
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ProfileManager* profile_manager() OVERRIDE;
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual PrefService* local_state() OVERRIDE;
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual net::URLRequestContextGetter* system_request_context() OVERRIDE;
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual chrome_variations::VariationsService* variations_service() OVERRIDE;
89c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual BrowserProcessPlatformPart* platform_part() OVERRIDE;
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual extensions::EventRouterForwarder*
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        extension_event_router_forwarder() OVERRIDE;
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual NotificationUIManager* notification_ui_manager() OVERRIDE;
932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual message_center::MessageCenter* message_center() OVERRIDE;
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE;
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual policy::PolicyService* policy_service() OVERRIDE;
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual IconManager* icon_manager() OVERRIDE;
972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual GLStringManager* gl_string_manager() OVERRIDE;
982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual GpuModeManager* gpu_mode_manager() OVERRIDE;
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void CreateDevToolsHttpProtocolHandler(
1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      chrome::HostDesktopType host_desktop_type,
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const std::string& ip,
102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      int port) OVERRIDE;
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual unsigned int AddRefModule() OVERRIDE;
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual unsigned int ReleaseModule() OVERRIDE;
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsShuttingDown() OVERRIDE;
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual printing::PrintJobManager* print_job_manager() OVERRIDE;
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual printing::PrintPreviewDialogController*
1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      print_preview_dialog_controller() OVERRIDE;
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual printing::BackgroundPrintingManager*
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      background_printing_manager() OVERRIDE;
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual IntranetRedirectDetector* intranet_redirect_detector() OVERRIDE;
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual const std::string& GetApplicationLocale() OVERRIDE;
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetApplicationLocale(const std::string& locale) OVERRIDE;
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual DownloadStatusUpdater* download_status_updater() OVERRIDE;
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual DownloadRequestLimiter* download_request_limiter() OVERRIDE;
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual BackgroundModeManager* background_mode_manager() OVERRIDE;
117eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual void set_background_mode_manager_for_test(
118eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      scoped_ptr<BackgroundModeManager> manager) OVERRIDE;
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual StatusTray* status_tray() OVERRIDE;
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual SafeBrowsingService* safe_browsing_service() OVERRIDE;
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual safe_browsing::ClientSideDetectionService*
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      safe_browsing_detection_service() OVERRIDE;
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void StartAutoupdateTimer() OVERRIDE;
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ChromeNetLog* net_log() OVERRIDE;
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE;
1305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual component_updater::ComponentUpdateService*
1315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      component_updater() OVERRIDE;
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE;
1335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual component_updater::PnaclComponentInstaller*
1345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      pnacl_component_installer() OVERRIDE;
135d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual MediaFileSystemRegistry* media_file_system_registry() OVERRIDE;
136c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual bool created_local_state() const OVERRIDE;
137868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#if defined(ENABLE_WEBRTC)
138868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual WebRtcLogUploader* webrtc_log_uploader() OVERRIDE;
139868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif
14046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual network_time::NetworkTimeTracker* network_time_tracker() OVERRIDE;
14146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual gcm::GCMDriver* gcm_driver() OVERRIDE;
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static void RegisterPrefs(PrefRegistrySimple* registry);
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateWatchdogThread();
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateProfileManager();
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateLocalState();
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateViewedPageTracker();
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateIconManager();
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateIntranetRedirectDetector();
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateNotificationUIManager();
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateStatusTrayManager();
1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void CreatePrintPreviewDialogController();
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateBackgroundPrintingManager();
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateSafeBrowsingService();
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateSafeBrowsingDetectionService();
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateStatusTray();
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateBackgroundModeManager();
16046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void CreateGCMDriver();
161010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ApplyAllowCrossOriginAuthPromptPolicy();
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ApplyDefaultBrowserPolicy();
164f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void ApplyMetricsReportingPolicy();
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
166010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  scoped_ptr<MetricsServicesManager> metrics_services_manager_;
167a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<IOThread> io_thread_;
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_watchdog_thread_;
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<WatchDogThread> watchdog_thread_;
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_browser_policy_connector_;
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(ENABLE_CONFIGURATION_POLICY)
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Must be destroyed after |local_state_|.
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_;
1775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#else
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Must be destroyed after |local_state_|.
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is a stub when policy is not enabled. Otherwise, the PolicyService
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // is owned by the |browser_policy_connector_| and this is not used.
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<policy::PolicyService> policy_service_;
1825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_profile_manager_;
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ProfileManager> profile_manager_;
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_local_state_;
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<PrefService> local_state_;
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_icon_manager_;
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<IconManager> icon_manager_;
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<GLStringManager> gl_string_manager_;
1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<GpuModeManager> gpu_mode_manager_;
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1976e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#if defined(ENABLE_EXTENSIONS)
198f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  scoped_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_;
1995f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<extensions::EventRouterForwarder>
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      extension_event_router_forwarder_;
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2035f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  scoped_ptr<MediaFileSystemRegistry> media_file_system_registry_;
204ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#endif
205ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
2065f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#if !defined(OS_ANDROID)
2075f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  scoped_ptr<RemoteDebuggingServer> remote_debugging_server_;
208c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#endif
2092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#if defined(ENABLE_FULL_PRINTING)
2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_refptr<printing::PrintPreviewDialogController>
2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      print_preview_dialog_controller_;
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_;
2155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Manager for desktop notification UI.
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_notification_ui_manager_;
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<NotificationUIManager> notification_ui_manager_;
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<StatusTray> status_tray_;
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<BackgroundModeManager> background_mode_manager_;
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool created_safe_browsing_service_;
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<SafeBrowsingService> safe_browsing_service_;
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  unsigned int module_ref_count_;
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool did_start_;
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Ensures that all the print jobs are finished before closing the browser.
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<printing::PrintJobManager> print_job_manager_;
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::string locale_;
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Download status updates (like a changing application icon on dock/taskbar)
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // are global per-application. DownloadStatusUpdater does no work in the ctor
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // so we don't have to worry about lazy initialization.
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<DownloadStatusUpdater> download_status_updater_;
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sequenced task runner for local state related I/O tasks.
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const scoped_refptr<base::SequencedTaskRunner> local_state_task_runner_;
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Ensures that the observers of plugin/print disable/enable state
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notifications are properly added and removed.
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PrefChangeRegistrar pref_change_registrar_;
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Lives here so can safely log events on shutdown.
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ChromeNetLog> net_log_;
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Ordered before resource_dispatcher_host_delegate_ due to destruction
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ordering.
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<prerender::PrerenderTracker> prerender_tracker_;
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ChromeResourceDispatcherHostDelegate>
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      resource_dispatcher_host_delegate_;
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_refptr<PromoResourceService> promo_resource_service_;
2632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_;
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Gets called by autoupdate timer to see if browser needs restart and can be
2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // restarted, and if that's the case, restarts the browser.
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void OnAutoupdateTimer();
2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool CanAutorestartForUpdate() const;
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RestartBackgroundInstance();
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // defined(OS_WIN) || defined(OS_LINUX) && !defined(OS_CHROMEOS)
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
274c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // component updater is normally not used under ChromeOS due
275c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // to concerns over integrity of data shared between profiles,
276c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // but some users of component updater only install per-user.
2775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_ptr<component_updater::ComponentUpdateService> component_updater_;
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<CRLSetFetcher> crl_set_fetcher_;
2791320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
2801320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#if !defined(DISABLE_NACL)
2815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_ptr<component_updater::PnaclComponentInstaller>
2825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      pnacl_component_installer_;
2831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(ENABLE_PLUGIN_INSTALLATION)
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<PluginsResourceService> plugins_resource_service_;
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
2882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
289c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  scoped_ptr<BrowserProcessPlatformPart> platform_part_;
290c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // TODO(eroman): Remove this when done debugging 113031. This tracks
2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the callstack which released the final module reference count.
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::debug::StackTrace release_last_reference_callstack_;
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#if defined(ENABLE_WEBRTC)
296868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Lazily initialized.
297868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  scoped_ptr<WebRtcLogUploader> webrtc_log_uploader_;
298868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif
299868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
30046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  scoped_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
30146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
30246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  scoped_ptr<gcm::GCMDriver> gcm_driver_;
303cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
3041320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#if !defined(OS_ANDROID)
3051320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  scoped_ptr<ChromeDeviceClient> device_client_;
3061320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif
3071320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_
312