browser_process_impl.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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
  3. // found in the LICENSE file.
  4. // This interface is for managing the global services of the application. Each
  5. // service is lazily created when requested the first time. The service getters
  6. // will return NULL if the service is not available, so callers must check for
  7. // this condition.
  8. #ifndef ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
  9. #define ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
  10. #include <memory>
  11. #include <string>
  12. #include "base/command_line.h"
  13. #include "chrome/browser/browser_process.h"
  14. #include "components/prefs/pref_service.h"
  15. #include "components/prefs/value_map_pref_store.h"
  16. #include "printing/buildflags/buildflags.h"
  17. #include "services/network/public/cpp/shared_url_loader_factory.h"
  18. #include "shell/browser/net/system_network_context_manager.h"
  19. namespace printing {
  20. class PrintJobManager;
  21. }
  22. // Empty definition for std::unique_ptr, rather than a forward declaration
  23. class BackgroundModeManager {};
  24. // NOT THREAD SAFE, call only from the main thread.
  25. // These functions shouldn't return NULL unless otherwise noted.
  26. class BrowserProcessImpl : public BrowserProcess {
  27. public:
  28. BrowserProcessImpl();
  29. ~BrowserProcessImpl() override;
  30. // disable copy
  31. BrowserProcessImpl(const BrowserProcessImpl&) = delete;
  32. BrowserProcessImpl& operator=(const BrowserProcessImpl&) = delete;
  33. static void ApplyProxyModeFromCommandLine(ValueMapPrefStore* pref_store);
  34. BuildState* GetBuildState() override;
  35. breadcrumbs::BreadcrumbPersistentStorageManager*
  36. GetBreadcrumbPersistentStorageManager() override;
  37. void PostEarlyInitialization();
  38. void PreCreateThreads();
  39. void PostDestroyThreads() {}
  40. void PostMainMessageLoopRun();
  41. void EndSession() override {}
  42. void FlushLocalStateAndReply(base::OnceClosure reply) override {}
  43. bool IsShuttingDown() override;
  44. metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
  45. override;
  46. metrics::MetricsService* metrics_service() override;
  47. ProfileManager* profile_manager() override;
  48. PrefService* local_state() override;
  49. scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
  50. override;
  51. variations::VariationsService* variations_service() override;
  52. BrowserProcessPlatformPart* platform_part() override;
  53. extensions::EventRouterForwarder* extension_event_router_forwarder() override;
  54. NotificationUIManager* notification_ui_manager() override;
  55. NotificationPlatformBridge* notification_platform_bridge() override;
  56. SystemNetworkContextManager* system_network_context_manager() override;
  57. network::NetworkQualityTracker* network_quality_tracker() override;
  58. policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
  59. policy::PolicyService* policy_service() override;
  60. IconManager* icon_manager() override;
  61. GpuModeManager* gpu_mode_manager() override;
  62. printing::PrintPreviewDialogController* print_preview_dialog_controller()
  63. override;
  64. printing::BackgroundPrintingManager* background_printing_manager() override;
  65. IntranetRedirectDetector* intranet_redirect_detector() override;
  66. DownloadStatusUpdater* download_status_updater() override;
  67. DownloadRequestLimiter* download_request_limiter() override;
  68. BackgroundModeManager* background_mode_manager() override;
  69. StatusTray* status_tray() override;
  70. safe_browsing::SafeBrowsingService* safe_browsing_service() override;
  71. subresource_filter::RulesetService* subresource_filter_ruleset_service()
  72. override;
  73. federated_learning::FlocSortingLshClustersService*
  74. floc_sorting_lsh_clusters_service() override;
  75. component_updater::ComponentUpdateService* component_updater() override;
  76. MediaFileSystemRegistry* media_file_system_registry() override;
  77. WebRtcLogUploader* webrtc_log_uploader() override;
  78. network_time::NetworkTimeTracker* network_time_tracker() override;
  79. gcm::GCMDriver* gcm_driver() override;
  80. resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
  81. override;
  82. resource_coordinator::TabManager* GetTabManager() override;
  83. SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
  84. void CreateDevToolsProtocolHandler() override {}
  85. void CreateDevToolsAutoOpener() override {}
  86. void set_background_mode_manager_for_test(
  87. std::unique_ptr<BackgroundModeManager> manager) override {}
  88. #if (defined(OS_WIN) || defined(OS_LINUX))
  89. void StartAutoupdateTimer() override {}
  90. #endif
  91. void SetApplicationLocale(const std::string& locale) override;
  92. const std::string& GetApplicationLocale() override;
  93. printing::PrintJobManager* print_job_manager() override;
  94. StartupData* startup_data() override;
  95. private:
  96. #if BUILDFLAG(ENABLE_PRINTING)
  97. std::unique_ptr<printing::PrintJobManager> print_job_manager_;
  98. #endif
  99. std::unique_ptr<PrefService> local_state_;
  100. std::string locale_;
  101. };
  102. #endif // ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_