browser_process_impl.h 4.7 KB

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