browser_process_impl.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 SetSystemLocale(const std::string& locale);
  42. const std::string& GetSystemLocale() const;
  43. void EndSession() override {}
  44. void FlushLocalStateAndReply(base::OnceClosure reply) override {}
  45. bool IsShuttingDown() override;
  46. metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
  47. override;
  48. metrics::MetricsService* metrics_service() override;
  49. ProfileManager* profile_manager() override;
  50. PrefService* local_state() override;
  51. scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
  52. override;
  53. variations::VariationsService* variations_service() override;
  54. BrowserProcessPlatformPart* platform_part() override;
  55. extensions::EventRouterForwarder* extension_event_router_forwarder() override;
  56. NotificationUIManager* notification_ui_manager() override;
  57. NotificationPlatformBridge* notification_platform_bridge() override;
  58. SystemNetworkContextManager* system_network_context_manager() override;
  59. network::NetworkQualityTracker* network_quality_tracker() override;
  60. policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
  61. policy::PolicyService* policy_service() override;
  62. IconManager* icon_manager() override;
  63. GpuModeManager* gpu_mode_manager() override;
  64. printing::PrintPreviewDialogController* print_preview_dialog_controller()
  65. override;
  66. printing::BackgroundPrintingManager* background_printing_manager() override;
  67. IntranetRedirectDetector* intranet_redirect_detector() override;
  68. DownloadStatusUpdater* download_status_updater() override;
  69. DownloadRequestLimiter* download_request_limiter() override;
  70. BackgroundModeManager* background_mode_manager() override;
  71. StatusTray* status_tray() override;
  72. safe_browsing::SafeBrowsingService* safe_browsing_service() override;
  73. subresource_filter::RulesetService* subresource_filter_ruleset_service()
  74. 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. HidPolicyAllowedDevices* hid_policy_allowed_devices() override;
  85. void CreateDevToolsProtocolHandler() override {}
  86. void CreateDevToolsAutoOpener() override {}
  87. void set_background_mode_manager_for_test(
  88. std::unique_ptr<BackgroundModeManager> manager) override {}
  89. #if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX))
  90. void StartAutoupdateTimer() override {}
  91. #endif
  92. void SetApplicationLocale(const std::string& locale) override;
  93. const std::string& GetApplicationLocale() override;
  94. printing::PrintJobManager* print_job_manager() override;
  95. StartupData* startup_data() override;
  96. private:
  97. #if BUILDFLAG(ENABLE_PRINTING)
  98. std::unique_ptr<printing::PrintJobManager> print_job_manager_;
  99. #endif
  100. std::unique_ptr<PrefService> local_state_;
  101. std::string locale_;
  102. std::string system_locale_;
  103. };
  104. #endif // ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_