ProfilePolicyConnectorFactory: Refactoring from Profile to BrowserContext.
[chromium-blink-merge.git] / ash / system / tray / system_tray_delegate.h
blobee1637fe2a59961789c8631ba63e17b649086c98
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.
5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "ash/system/user/login_status.h"
13 #include "base/callback_forward.h"
14 #include "base/files/file_path.h"
15 #include "base/i18n/time_formatting.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/strings/string16.h"
18 #include "ui/gfx/image/image_skia.h"
20 namespace base {
21 class TimeDelta;
22 class TimeTicks;
25 namespace ash {
27 class CustodianInfoTrayObserver;
28 class ShutdownPolicyObserver;
30 struct ASH_EXPORT NetworkIconInfo {
31 NetworkIconInfo();
32 ~NetworkIconInfo();
34 bool highlight() const { return connected || connecting; }
36 bool connecting;
37 bool connected;
38 bool tray_icon_visible;
39 gfx::ImageSkia image;
40 base::string16 name;
41 base::string16 description;
42 std::string service_path;
43 bool is_cellular;
46 struct ASH_EXPORT BluetoothDeviceInfo {
47 BluetoothDeviceInfo();
48 ~BluetoothDeviceInfo();
50 std::string address;
51 base::string16 display_name;
52 bool connected;
53 bool connecting;
54 bool paired;
57 using BluetoothDeviceList = std::vector<BluetoothDeviceInfo>;
59 struct ASH_EXPORT IMEPropertyInfo {
60 IMEPropertyInfo();
61 ~IMEPropertyInfo();
63 bool selected;
64 std::string key;
65 base::string16 name;
68 using IMEPropertyInfoList = std::vector<IMEPropertyInfo>;
70 struct ASH_EXPORT IMEInfo {
71 IMEInfo();
72 ~IMEInfo();
74 bool selected;
75 bool third_party;
76 std::string id;
77 base::string16 name;
78 base::string16 medium_name;
79 base::string16 short_name;
82 struct ASH_EXPORT UpdateInfo {
83 enum UpdateSeverity {
84 UPDATE_NORMAL,
85 UPDATE_LOW_GREEN,
86 UPDATE_HIGH_ORANGE,
87 UPDATE_SEVERE_RED,
90 UpdateInfo();
91 ~UpdateInfo();
93 UpdateSeverity severity;
94 bool update_required;
95 bool factory_reset_required;
98 using IMEInfoList = std::vector<IMEInfo>;
100 class NetworkingConfigDelegate;
101 class VolumeControlDelegate;
103 using RebootOnShutdownCallback = base::Callback<void(bool)>;
105 namespace tray {
106 class UserAccountsDelegate;
107 } // namespace tray
109 class ASH_EXPORT SystemTrayDelegate {
110 public:
111 virtual ~SystemTrayDelegate() {}
113 // Called after SystemTray has been instantiated.
114 virtual void Initialize() = 0;
116 // Called before SystemTray is destroyed.
117 virtual void Shutdown() = 0;
119 // Returns true if system tray should be visible on startup.
120 virtual bool GetTrayVisibilityOnStartup() = 0;
122 // Gets information about the active user.
123 virtual user::LoginStatus GetUserLoginStatus() const = 0;
125 // Shows UI for changing user's profile picture.
126 virtual void ChangeProfilePicture() = 0;
128 // Returns the domain that manages the device, if it is enterprise-enrolled.
129 virtual const std::string GetEnterpriseDomain() const = 0;
131 // Returns notification for enterprise enrolled devices.
132 virtual const base::string16 GetEnterpriseMessage() const = 0;
134 // Returns the display email of the user that manages the current supervised
135 // user.
136 virtual const std::string GetSupervisedUserManager() const = 0;
138 // Returns the name of the user that manages the current supervised user.
139 virtual const base::string16 GetSupervisedUserManagerName() const = 0;
141 // Returns the notification for supervised users.
142 virtual const base::string16 GetSupervisedUserMessage() const = 0;
144 // Returns true if the current user is supervised: has legacy supervised
145 // account or kid account.
146 virtual bool IsUserSupervised() const = 0;
148 // Returns true if the current user is child.
149 // TODO(merkulova): remove on FakeUserManager componentization.
150 // crbug.com/443119
151 virtual bool IsUserChild() const = 0;
153 // Fills |info| structure with current update info.
154 virtual void GetSystemUpdateInfo(UpdateInfo* info) const = 0;
156 // Returns the desired hour clock type.
157 virtual base::HourClockType GetHourClockType() const = 0;
159 // Shows settings.
160 virtual void ShowSettings() = 0;
162 // Returns true if settings menu item should appear.
163 virtual bool ShouldShowSettings() = 0;
165 // Shows the settings related to date, timezone etc.
166 virtual void ShowDateSettings() = 0;
168 // Shows the dialog to set system time, date, and timezone.
169 virtual void ShowSetTimeDialog() = 0;
171 // Shows the settings related to network. If |service_path| is not empty,
172 // show the settings for that network.
173 virtual void ShowNetworkSettings(const std::string& service_path) = 0;
175 // Shows the settings related to bluetooth.
176 virtual void ShowBluetoothSettings() = 0;
178 // Shows settings related to multiple displays.
179 virtual void ShowDisplaySettings() = 0;
181 // Shows the page that lets you disable performance tracing.
182 virtual void ShowChromeSlow() = 0;
184 // Returns true if the notification for the display configuration change
185 // should appear.
186 virtual bool ShouldShowDisplayNotification() = 0;
188 // Shows settings related to input methods.
189 virtual void ShowIMESettings() = 0;
191 // Shows help.
192 virtual void ShowHelp() = 0;
194 // Show accessilibity help.
195 virtual void ShowAccessibilityHelp() = 0;
197 // Show the settings related to accessilibity.
198 virtual void ShowAccessibilitySettings() = 0;
200 // Shows more information about public account mode.
201 virtual void ShowPublicAccountInfo() = 0;
203 // Shows information about enterprise enrolled devices.
204 virtual void ShowEnterpriseInfo() = 0;
206 // Shows information about supervised users.
207 virtual void ShowSupervisedUserInfo() = 0;
209 // Shows login UI to add other users to this session.
210 virtual void ShowUserLogin() = 0;
212 // Attempts to sign out the user.
213 virtual void SignOut() = 0;
215 // Attempts to lock the screen.
216 virtual void RequestLockScreen() = 0;
218 // Attempts to restart the system for update.
219 virtual void RequestRestartForUpdate() = 0;
221 // Returns a list of available bluetooth devices.
222 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
224 // Requests bluetooth start discovering devices.
225 virtual void BluetoothStartDiscovering() = 0;
227 // Requests bluetooth stop discovering devices.
228 virtual void BluetoothStopDiscovering() = 0;
230 // Connect to a specific bluetooth device.
231 virtual void ConnectToBluetoothDevice(const std::string& address) = 0;
233 // Returns true if bluetooth adapter is discovering bluetooth devices.
234 virtual bool IsBluetoothDiscovering() = 0;
236 // Returns the currently selected IME.
237 virtual void GetCurrentIME(IMEInfo* info) = 0;
239 // Returns a list of availble IMEs.
240 virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
242 // Returns a list of properties for the currently selected IME.
243 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) = 0;
245 // Switches to the selected input method.
246 virtual void SwitchIME(const std::string& ime_id) = 0;
248 // Activates an IME property.
249 virtual void ActivateIMEProperty(const std::string& key) = 0;
251 // Shows UI to manage bluetooth devices.
252 virtual void ManageBluetoothDevices() = 0;
254 // Toggles bluetooth.
255 virtual void ToggleBluetooth() = 0;
257 // Shows UI to connect to an unlisted network of type |type|. On Chrome OS
258 // |type| corresponds to a Shill network type.
259 virtual void ShowOtherNetworkDialog(const std::string& type) = 0;
261 // Returns whether bluetooth capability is available.
262 virtual bool GetBluetoothAvailable() = 0;
264 // Returns whether bluetooth is enabled.
265 virtual bool GetBluetoothEnabled() = 0;
267 // Returns whether the delegate has initiated a bluetooth discovery session.
268 virtual bool GetBluetoothDiscovering() = 0;
270 // Shows UI for changing proxy settings.
271 virtual void ChangeProxySettings() = 0;
273 // Returns NetworkingConfigDelegate.
274 virtual NetworkingConfigDelegate* GetNetworkingConfigDelegate() const = 0;
276 // Returns VolumeControlDelegate.
277 virtual VolumeControlDelegate* GetVolumeControlDelegate() const = 0;
279 // Sets VolumeControlDelegate.
280 virtual void SetVolumeControlDelegate(
281 scoped_ptr<VolumeControlDelegate> delegate) = 0;
283 // Retrieves the session start time. Returns |false| if the time is not set.
284 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) = 0;
286 // Retrieves the session length limit. Returns |false| if no limit is set.
287 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) = 0;
289 // Get the system tray menu size in pixels (dependent on the language).
290 virtual int GetSystemTrayMenuWidth() = 0;
292 // The active user has been changed. This will be called when the UI is ready
293 // to be switched to the new user.
294 // Note: This will happen after SessionStateObserver::ActiveUserChanged fires.
295 virtual void ActiveUserWasChanged() = 0;
297 // Returns true when the Search key is configured to be treated as Caps Lock.
298 virtual bool IsSearchKeyMappedToCapsLock() = 0;
300 // Returns accounts delegate for given user.
301 virtual tray::UserAccountsDelegate* GetUserAccountsDelegate(
302 const std::string& user_id) = 0;
304 // Adding observers that are notified when supervised info is being changed.
305 virtual void AddCustodianInfoTrayObserver(
306 CustodianInfoTrayObserver* observer) = 0;
308 virtual void RemoveCustodianInfoTrayObserver(
309 CustodianInfoTrayObserver* observer) = 0;
311 // Adds an observer whose |OnShutdownPolicyChanged| function is called when
312 // the |DeviceRebootOnShutdown| policy changes. If this policy is set to
313 // true, a device cannot be shut down anymore but only rebooted.
314 virtual void AddShutdownPolicyObserver(ShutdownPolicyObserver* observer) = 0;
316 virtual void RemoveShutdownPolicyObserver(
317 ShutdownPolicyObserver* observer) = 0;
319 // Determines whether the device is automatically rebooted when shut down as
320 // specified by the device policy |DeviceRebootOnShutdown|. This function
321 // asynchronously calls |callback| once a trusted policy becomes available.
322 virtual void ShouldRebootOnShutdown(
323 const RebootOnShutdownCallback& callback) = 0;
326 } // namespace ash
328 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_