• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Embedded Framework Authors.
2 // Portions (c) 2011 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 
6 // This file provides a stub implementation of Chrome's BrowserProcess object
7 // for use as an interop layer between CEF and files that live in chrome/.
8 
9 #ifndef CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_
10 #define CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_
11 
12 #include <memory>
13 #include <string>
14 
15 #include "base/compiler_specific.h"
16 #include "base/metrics/field_trial.h"
17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/extensions/event_router_forwarder.h"
19 #include "media/media_buildflags.h"
20 
21 class ChromeProfileManagerAlloy;
22 
23 class BackgroundModeManager {
24  public:
25   BackgroundModeManager();
26   virtual ~BackgroundModeManager();
27 
28  private:
29   DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager);
30 };
31 
32 class ChromeBrowserProcessAlloy : public BrowserProcess {
33  public:
34   ChromeBrowserProcessAlloy();
35   ~ChromeBrowserProcessAlloy() override;
36 
37   void Initialize();
38   void OnContextInitialized();
39   void CleanupOnUIThread();
40 
41   // BrowserProcess implementation.
42   void EndSession() override;
43   void FlushLocalStateAndReply(base::OnceClosure reply) override;
44   metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
45       override;
46   metrics::MetricsService* metrics_service() override;
47   SystemNetworkContextManager* system_network_context_manager() override;
48   network::NetworkQualityTracker* network_quality_tracker() override;
49   WatchDogThread* watchdog_thread() override;
50   ProfileManager* profile_manager() override;
51   PrefService* local_state() override;
52   scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
53       override;
54   variations::VariationsService* variations_service() override;
55   BrowserProcessPlatformPart* platform_part() override;
56   extensions::EventRouterForwarder* extension_event_router_forwarder() override;
57   NotificationUIManager* notification_ui_manager() override;
58   NotificationPlatformBridge* notification_platform_bridge() override;
59   policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
60   policy::PolicyService* policy_service() override;
61   IconManager* icon_manager() override;
62   GpuModeManager* gpu_mode_manager() override;
63   void CreateDevToolsProtocolHandler() override;
64   void CreateDevToolsAutoOpener() override;
65   bool IsShuttingDown() override;
66   printing::PrintJobManager* print_job_manager() override;
67   printing::PrintPreviewDialogController* print_preview_dialog_controller()
68       override;
69   printing::BackgroundPrintingManager* background_printing_manager() override;
70   IntranetRedirectDetector* intranet_redirect_detector() override;
71   const std::string& GetApplicationLocale() override;
72   void SetApplicationLocale(const std::string& locale) override;
73   DownloadStatusUpdater* download_status_updater() override;
74   DownloadRequestLimiter* download_request_limiter() override;
75 #if BUILDFLAG(ENABLE_BACKGROUND_MODE)
76   BackgroundModeManager* background_mode_manager() override;
77   void set_background_mode_manager_for_test(
78       std::unique_ptr<BackgroundModeManager> manager) override;
79 #endif
80   StatusTray* status_tray() override;
81   safe_browsing::SafeBrowsingService* safe_browsing_service() override;
82   subresource_filter::RulesetService* subresource_filter_ruleset_service()
83       override;
84   federated_learning::FlocSortingLshClustersService*
85   floc_sorting_lsh_clusters_service() override;
86   StartupData* startup_data() override;
87 
88 #if defined(OS_WIN) || defined(OS_LINUX)
89   void StartAutoupdateTimer() override;
90 #endif
91 
92   component_updater::ComponentUpdateService* component_updater() override;
93   MediaFileSystemRegistry* media_file_system_registry() override;
94   WebRtcLogUploader* webrtc_log_uploader() override;
95   network_time::NetworkTimeTracker* network_time_tracker() override;
96   gcm::GCMDriver* gcm_driver() override;
97   resource_coordinator::TabManager* GetTabManager() override;
98   resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
99       override;
100   BuildState* GetBuildState() override;
101 
102  private:
103   bool initialized_;
104   bool context_initialized_;
105   bool shutdown_;
106 
107   std::string locale_;
108   std::unique_ptr<printing::PrintJobManager> print_job_manager_;
109   std::unique_ptr<ChromeProfileManagerAlloy> profile_manager_;
110   scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
111   scoped_refptr<printing::PrintPreviewDialogController>
112       print_preview_dialog_controller_;
113   std::unique_ptr<printing::BackgroundPrintingManager>
114       background_printing_manager_;
115   std::unique_ptr<PrefService> local_state_;
116   // Must be destroyed after |local_state_|.
117   std::unique_ptr<policy::ChromeBrowserPolicyConnector>
118       browser_policy_connector_;
119   std::unique_ptr<base::FieldTrialList> field_trial_list_;
120 
121   DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessAlloy);
122 };
123 
124 #endif  // CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_
125