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_
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"
27 class CustodianInfoTrayObserver;
29 struct ASH_EXPORT NetworkIconInfo {
33 bool highlight() const { return connected || connecting; }
37 bool tray_icon_visible;
40 base::string16 description;
41 std::string service_path;
45 struct ASH_EXPORT BluetoothDeviceInfo {
46 BluetoothDeviceInfo();
47 ~BluetoothDeviceInfo();
50 base::string16 display_name;
56 typedef std::vector<BluetoothDeviceInfo> BluetoothDeviceList;
58 struct ASH_EXPORT IMEPropertyInfo {
67 typedef std::vector<IMEPropertyInfo> IMEPropertyInfoList;
69 struct ASH_EXPORT IMEInfo {
77 base::string16 medium_name;
78 base::string16 short_name;
81 struct ASH_EXPORT UpdateInfo {
92 UpdateSeverity severity;
94 bool factory_reset_required;
97 typedef std::vector<IMEInfo> IMEInfoList;
99 class VolumeControlDelegate;
102 class UserAccountsDelegate;
105 class ASH_EXPORT SystemTrayDelegate {
107 virtual ~SystemTrayDelegate() {}
109 // Called after SystemTray has been instantiated.
110 virtual void Initialize() = 0;
112 // Called before SystemTray is destroyed.
113 virtual void Shutdown() = 0;
115 // Returns true if system tray should be visible on startup.
116 virtual bool GetTrayVisibilityOnStartup() = 0;
118 // Gets information about the active user.
119 virtual user::LoginStatus GetUserLoginStatus() const = 0;
121 // Shows UI for changing user's profile picture.
122 virtual void ChangeProfilePicture() = 0;
124 // Returns the domain that manages the device, if it is enterprise-enrolled.
125 virtual const std::string GetEnterpriseDomain() const = 0;
127 // Returns notification for enterprise enrolled devices.
128 virtual const base::string16 GetEnterpriseMessage() const = 0;
130 // Returns the display email of the user that manages the current supervised
132 virtual const std::string GetSupervisedUserManager() const = 0;
134 // Returns the name of the user that manages the current supervised user.
135 virtual const base::string16 GetSupervisedUserManagerName() const = 0;
137 // Returns the notification for supervised users.
138 virtual const base::string16 GetSupervisedUserMessage() const = 0;
140 // Returns true if the current user is supervised.
141 virtual bool IsUserSupervised() const = 0;
143 // Fills |info| structure with current update info.
144 virtual void GetSystemUpdateInfo(UpdateInfo* info) const = 0;
146 // Returns the desired hour clock type.
147 virtual base::HourClockType GetHourClockType() const = 0;
150 virtual void ShowSettings() = 0;
152 // Returns true if settings menu item should appear.
153 virtual bool ShouldShowSettings() = 0;
155 // Shows the settings related to date, timezone etc.
156 virtual void ShowDateSettings() = 0;
158 // Shows the dialog to set system time, date, and timezone.
159 virtual void ShowSetTimeDialog() = 0;
161 // Shows the settings related to network. If |service_path| is not empty,
162 // show the settings for that network.
163 virtual void ShowNetworkSettings(const std::string& service_path) = 0;
165 // Shows the settings related to bluetooth.
166 virtual void ShowBluetoothSettings() = 0;
168 // Shows settings related to multiple displays.
169 virtual void ShowDisplaySettings() = 0;
171 // Shows the page that lets you disable performance tracing.
172 virtual void ShowChromeSlow() = 0;
174 // Returns true if the notification for the display configuration change
176 virtual bool ShouldShowDisplayNotification() = 0;
178 // Shows settings related to input methods.
179 virtual void ShowIMESettings() = 0;
182 virtual void ShowHelp() = 0;
184 // Show accessilibity help.
185 virtual void ShowAccessibilityHelp() = 0;
187 // Show the settings related to accessilibity.
188 virtual void ShowAccessibilitySettings() = 0;
190 // Shows more information about public account mode.
191 virtual void ShowPublicAccountInfo() = 0;
193 // Shows information about enterprise enrolled devices.
194 virtual void ShowEnterpriseInfo() = 0;
196 // Shows information about supervised users.
197 virtual void ShowSupervisedUserInfo() = 0;
199 // Shows login UI to add other users to this session.
200 virtual void ShowUserLogin() = 0;
202 // Shows the spring charger replacement dialog if necessary.
203 // Returns true if the dialog is shown by the call.
204 virtual bool ShowSpringChargerReplacementDialog() = 0;
206 // True if the spring charger replacement dialog is visible.
207 virtual bool IsSpringChargerReplacementDialogVisible() = 0;
209 // True if user has confirmed using safe spring charger.
210 virtual bool HasUserConfirmedSafeSpringCharger() = 0;
212 // Attempts to shut down the system.
213 virtual void ShutDown() = 0;
215 // Attempts to sign out the user.
216 virtual void SignOut() = 0;
218 // Attempts to lock the screen.
219 virtual void RequestLockScreen() = 0;
221 // Attempts to restart the system for update.
222 virtual void RequestRestartForUpdate() = 0;
224 // Returns a list of available bluetooth devices.
225 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
227 // Requests bluetooth start discovering devices.
228 virtual void BluetoothStartDiscovering() = 0;
230 // Requests bluetooth stop discovering devices.
231 virtual void BluetoothStopDiscovering() = 0;
233 // Connect to a specific bluetooth device.
234 virtual void ConnectToBluetoothDevice(const std::string& address) = 0;
236 // Returns true if bluetooth adapter is discovering bluetooth devices.
237 virtual bool IsBluetoothDiscovering() = 0;
239 // Returns the currently selected IME.
240 virtual void GetCurrentIME(IMEInfo* info) = 0;
242 // Returns a list of availble IMEs.
243 virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
245 // Returns a list of properties for the currently selected IME.
246 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) = 0;
248 // Switches to the selected input method.
249 virtual void SwitchIME(const std::string& ime_id) = 0;
251 // Activates an IME property.
252 virtual void ActivateIMEProperty(const std::string& key) = 0;
254 // Shows UI to manage bluetooth devices.
255 virtual void ManageBluetoothDevices() = 0;
257 // Toggles bluetooth.
258 virtual void ToggleBluetooth() = 0;
260 // Shows UI to connect to an unlisted network of type |type|. On Chrome OS
261 // |type| corresponds to a Shill network type.
262 virtual void ShowOtherNetworkDialog(const std::string& type) = 0;
264 // Returns whether bluetooth capability is available.
265 virtual bool GetBluetoothAvailable() = 0;
267 // Returns whether bluetooth is enabled.
268 virtual bool GetBluetoothEnabled() = 0;
270 // Returns whether the delegate has initiated a bluetooth discovery session.
271 virtual bool GetBluetoothDiscovering() = 0;
273 // Shows UI for changing proxy settings.
274 virtual void ChangeProxySettings() = 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;
314 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_