[M120][Tizen][Onscreen] Fix build errors for TV profile
[platform/framework/web/chromium-efl.git] / chrome / browser / browser_process_platform_part_ash.h
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_ASH_H_
6 #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_ASH_H_
7
8 #include <memory>
9
10 #include "base/sequence_checker.h"
11 #include "chrome/browser/browser_process_platform_part_chromeos.h"
12 #include "chrome/browser/component_updater/cros_component_installer_chromeos.h"
13 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
14
15 class BrowserProcessPlatformPartTestApi;
16 class Profile;
17
18 namespace ash {
19 class AccountManagerFactory;
20 class AshProxyMonitor;
21 class BrowserContextFlusher;
22 class ChromeSessionManager;
23 class ChromeUserManager;
24 class InSessionPasswordChangeManager;
25 class ProfileHelper;
26 class SchedulerConfigurationManager;
27 class TimeZoneResolver;
28
29 namespace system {
30 class AutomaticRebootManager;
31 class DeviceDisablingManager;
32 class DeviceDisablingManagerDefaultDelegate;
33 class TimeZoneResolverManager;
34 class SystemClock;
35 }  // namespace system
36 }  // namespace ash
37
38 namespace policy {
39 class BrowserPolicyConnectorAsh;
40 }
41
42 class ScopedKeepAlive;
43
44 class BrowserProcessPlatformPart : public BrowserProcessPlatformPartChromeOS {
45  public:
46   BrowserProcessPlatformPart();
47
48   BrowserProcessPlatformPart(const BrowserProcessPlatformPart&) = delete;
49   BrowserProcessPlatformPart& operator=(const BrowserProcessPlatformPart&) =
50       delete;
51
52   ~BrowserProcessPlatformPart() override;
53
54   void InitializeAutomaticRebootManager();
55   void ShutdownAutomaticRebootManager();
56
57   void InitializeChromeUserManager();
58   void DestroyChromeUserManager();
59
60   void InitializeDeviceDisablingManager();
61   void ShutdownDeviceDisablingManager();
62
63   void InitializeSessionManager();
64   void ShutdownSessionManager();
65
66   void InitializeCrosComponentManager();
67   void ShutdownCrosComponentManager();
68
69   void InitializeSchedulerConfigurationManager();
70   void ShutdownSchedulerConfigurationManager();
71
72   void InitializeAshProxyMonitor();
73   void ShutdownAshProxyMonitor();
74
75   // Initializes all services that need the primary profile. Gets called as soon
76   // as the primary profile is available, which implies that the primary user
77   // has logged in. The services are shut down automatically when the primary
78   // profile is destroyed.
79   // Use this for simple 'leaf-type' services with no or negligible inter-
80   // dependencies. If your service has more complex dependencies, consider using
81   // a BrowserContextKeyedService and restricting service creation to the
82   // primary profile.
83   void InitializePrimaryProfileServices(Profile* primary_profile);
84
85   // Used to register a KeepAlive when Ash is initialized, and release it
86   // when until Chrome starts exiting. Ensure we stay running the whole time.
87   void RegisterKeepAlive();
88   void UnregisterKeepAlive();
89
90   // Returns the ProfileHelper instance that is used to identify
91   // users and their profiles in Chrome OS multi user session.
92   ash::ProfileHelper* profile_helper();
93
94   ash::system::AutomaticRebootManager* automatic_reboot_manager() {
95     return automatic_reboot_manager_.get();
96   }
97
98   policy::BrowserPolicyConnectorAsh* browser_policy_connector_ash();
99
100   ash::ChromeSessionManager* session_manager() {
101     return session_manager_.get();
102   }
103
104   ash::ChromeUserManager* user_manager() { return chrome_user_manager_.get(); }
105
106   ash::SchedulerConfigurationManager* scheduler_configuration_manager() {
107     return scheduler_configuration_manager_.get();
108   }
109
110   ash::system::DeviceDisablingManager* device_disabling_manager() {
111     return device_disabling_manager_.get();
112   }
113
114   scoped_refptr<component_updater::CrOSComponentManager>
115   cros_component_manager() {
116     return cros_component_manager_;
117   }
118
119   ash::AshProxyMonitor* ash_proxy_monitor() { return ash_proxy_monitor_.get(); }
120
121   ash::system::TimeZoneResolverManager* GetTimezoneResolverManager();
122
123   ash::TimeZoneResolver* GetTimezoneResolver();
124
125   // Overridden from BrowserProcessPlatformPartBase:
126   void StartTearDown() override;
127   void AttemptExit(bool try_to_quit_application) override;
128
129   ash::system::SystemClock* GetSystemClock();
130   void DestroySystemClock();
131
132   ash::AccountManagerFactory* GetAccountManagerFactory();
133
134   ash::InSessionPasswordChangeManager* in_session_password_change_manager() {
135     return in_session_password_change_manager_.get();
136   }
137
138   static void EnsureFactoryBuilt();
139
140  protected:
141   // BrowserProcessPlatformPartChromeOS:
142   bool CanRestoreUrlsForProfile(const Profile* profile) const override;
143
144  private:
145   friend class BrowserProcessPlatformPartTestApi;
146
147   void CreateProfileHelper();
148
149   void ShutdownPrimaryProfileServices();
150
151   std::unique_ptr<ash::ChromeSessionManager> session_manager_;
152
153   bool created_profile_helper_;
154   std::unique_ptr<ash::ProfileHelper> profile_helper_;
155
156   std::unique_ptr<ash::BrowserContextFlusher> browser_context_flusher_;
157
158   std::unique_ptr<ash::system::AutomaticRebootManager>
159       automatic_reboot_manager_;
160
161   std::unique_ptr<ash::ChromeUserManager> chrome_user_manager_;
162
163   std::unique_ptr<ash::system::DeviceDisablingManagerDefaultDelegate>
164       device_disabling_manager_delegate_;
165   std::unique_ptr<ash::system::DeviceDisablingManager>
166       device_disabling_manager_;
167
168   std::unique_ptr<ash::system::TimeZoneResolverManager>
169       timezone_resolver_manager_;
170   std::unique_ptr<ash::TimeZoneResolver> timezone_resolver_;
171
172   std::unique_ptr<ash::system::SystemClock> system_clock_;
173
174   std::unique_ptr<ScopedKeepAlive> keep_alive_;
175
176   // Whether cros_component_manager_ has been initialized for test. Set by
177   // BrowserProcessPlatformPartTestApi.
178   bool using_testing_cros_component_manager_ = false;
179   scoped_refptr<component_updater::CrOSComponentManager>
180       cros_component_manager_;
181
182   std::unique_ptr<ash::AccountManagerFactory> account_manager_factory_;
183
184   std::unique_ptr<ash::InSessionPasswordChangeManager>
185       in_session_password_change_manager_;
186
187   base::CallbackListSubscription primary_profile_shutdown_subscription_;
188
189   std::unique_ptr<ash::SchedulerConfigurationManager>
190       scheduler_configuration_manager_;
191
192   std::unique_ptr<ash::AshProxyMonitor> ash_proxy_monitor_;
193
194   SEQUENCE_CHECKER(sequence_checker_);
195 };
196
197 #endif  // CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_ASH_H_