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/files/file_path.h"
14 #include "base/i18n/time_formatting.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string16.h"
17 #include "ui/gfx/image/image_skia.h"
26 struct ASH_EXPORT NetworkIconInfo {
30 bool highlight() const { return connected || connecting; }
34 bool tray_icon_visible;
37 base::string16 description;
38 std::string service_path;
42 struct ASH_EXPORT BluetoothDeviceInfo {
43 BluetoothDeviceInfo();
44 ~BluetoothDeviceInfo();
47 base::string16 display_name;
53 typedef std::vector<BluetoothDeviceInfo> BluetoothDeviceList;
55 struct ASH_EXPORT IMEPropertyInfo {
64 typedef std::vector<IMEPropertyInfo> IMEPropertyInfoList;
66 struct ASH_EXPORT IMEInfo {
74 base::string16 medium_name;
75 base::string16 short_name;
78 typedef std::vector<IMEInfo> IMEInfoList;
80 class VolumeControlDelegate;
83 class UserAccountsDelegate;
86 class ASH_EXPORT SystemTrayDelegate {
88 virtual ~SystemTrayDelegate() {}
90 // Called after SystemTray has been instantiated.
91 virtual void Initialize() = 0;
93 // Called before SystemTray is destroyed.
94 virtual void Shutdown() = 0;
96 // Returns true if system tray should be visible on startup.
97 virtual bool GetTrayVisibilityOnStartup() = 0;
99 // Gets information about the active user.
100 virtual user::LoginStatus GetUserLoginStatus() const = 0;
102 // Shows UI for changing user's profile picture.
103 virtual void ChangeProfilePicture() = 0;
105 // Returns the domain that manages the device, if it is enterprise-enrolled.
106 virtual const std::string GetEnterpriseDomain() const = 0;
108 // Returns notification for enterprise enrolled devices.
109 virtual const base::string16 GetEnterpriseMessage() const = 0;
111 // Returns the display email of the user that manages the current supervised
113 virtual const std::string GetSupervisedUserManager() const = 0;
115 // Returns the name of the user that manages the current supervised user.
116 virtual const base::string16 GetSupervisedUserManagerName() const = 0;
118 // Returns the notification for supervised users.
119 virtual const base::string16 GetSupervisedUserMessage() const = 0;
121 // Returns true if the current user is supervised.
122 virtual bool IsUserSupervised() const = 0;
124 // Returns whether a system upgrade is available.
125 virtual bool SystemShouldUpgrade() const = 0;
127 // Returns the desired hour clock type.
128 virtual base::HourClockType GetHourClockType() const = 0;
131 virtual void ShowSettings() = 0;
133 // Returns true if settings menu item should appear.
134 virtual bool ShouldShowSettings() = 0;
136 // Shows the settings related to date, timezone etc.
137 virtual void ShowDateSettings() = 0;
139 // Shows the dialog to set system time, date, and timezone.
140 virtual void ShowSetTimeDialog() = 0;
142 // Shows the settings related to network. If |service_path| is not empty,
143 // show the settings for that network.
144 virtual void ShowNetworkSettings(const std::string& service_path) = 0;
146 // Shows the settings related to bluetooth.
147 virtual void ShowBluetoothSettings() = 0;
149 // Shows settings related to multiple displays.
150 virtual void ShowDisplaySettings() = 0;
152 // Shows the page that lets you disable performance tracing.
153 virtual void ShowChromeSlow() = 0;
155 // Returns true if the notification for the display configuration change
157 virtual bool ShouldShowDisplayNotification() = 0;
159 // Shows settings related to input methods.
160 virtual void ShowIMESettings() = 0;
163 virtual void ShowHelp() = 0;
165 // Show accessilibity help.
166 virtual void ShowAccessibilityHelp() = 0;
168 // Show the settings related to accessilibity.
169 virtual void ShowAccessibilitySettings() = 0;
171 // Shows more information about public account mode.
172 virtual void ShowPublicAccountInfo() = 0;
174 // Shows information about enterprise enrolled devices.
175 virtual void ShowEnterpriseInfo() = 0;
177 // Shows information about supervised users.
178 virtual void ShowSupervisedUserInfo() = 0;
180 // Shows login UI to add other users to this session.
181 virtual void ShowUserLogin() = 0;
183 // Shows the spring charger replacement dialog if necessary.
184 // Returns true if the dialog is shown by the call.
185 virtual bool ShowSpringChargerReplacementDialog() = 0;
187 // True if the spring charger replacement dialog is visible.
188 virtual bool IsSpringChargerReplacementDialogVisible() = 0;
190 // True if user has confirmed using safe spring charger.
191 virtual bool HasUserConfirmedSafeSpringCharger() = 0;
193 // Attempts to shut down the system.
194 virtual void ShutDown() = 0;
196 // Attempts to sign out the user.
197 virtual void SignOut() = 0;
199 // Attempts to lock the screen.
200 virtual void RequestLockScreen() = 0;
202 // Attempts to restart the system for update.
203 virtual void RequestRestartForUpdate() = 0;
205 // Returns a list of available bluetooth devices.
206 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
208 // Requests bluetooth start discovering devices.
209 virtual void BluetoothStartDiscovering() = 0;
211 // Requests bluetooth stop discovering devices.
212 virtual void BluetoothStopDiscovering() = 0;
214 // Connect to a specific bluetooth device.
215 virtual void ConnectToBluetoothDevice(const std::string& address) = 0;
217 // Returns true if bluetooth adapter is discovering bluetooth devices.
218 virtual bool IsBluetoothDiscovering() = 0;
220 // Returns the currently selected IME.
221 virtual void GetCurrentIME(IMEInfo* info) = 0;
223 // Returns a list of availble IMEs.
224 virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
226 // Returns a list of properties for the currently selected IME.
227 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) = 0;
229 // Switches to the selected input method.
230 virtual void SwitchIME(const std::string& ime_id) = 0;
232 // Activates an IME property.
233 virtual void ActivateIMEProperty(const std::string& key) = 0;
235 // Shows UI to configure or activate the network specified by |network_id|,
236 // which may include showing Payment or Portal UI when appropriate.
237 virtual void ShowNetworkConfigure(const std::string& network_id) = 0;
239 // Shows UI to enroll the network specified by |network_id| if appropriate
240 // and returns true, otherwise returns false.
241 virtual bool EnrollNetwork(const std::string& network_id) = 0;
243 // Shows UI to manage bluetooth devices.
244 virtual void ManageBluetoothDevices() = 0;
246 // Toggles bluetooth.
247 virtual void ToggleBluetooth() = 0;
249 // Shows UI to unlock a mobile sim.
250 virtual void ShowMobileSimDialog() = 0;
252 // Shows UI to setup a mobile network.
253 virtual void ShowMobileSetupDialog(const std::string& service_path) = 0;
255 // Shows UI to connect to an unlisted network of type |type|. On Chrome OS
256 // |type| corresponds to a Shill network type.
257 virtual void ShowOtherNetworkDialog(const std::string& type) = 0;
259 // Returns whether bluetooth capability is available.
260 virtual bool GetBluetoothAvailable() = 0;
262 // Returns whether bluetooth is enabled.
263 virtual bool GetBluetoothEnabled() = 0;
265 // Returns whether the delegate has initiated a bluetooth discovery session.
266 virtual bool GetBluetoothDiscovering() = 0;
268 // Shows UI for changing proxy settings.
269 virtual void ChangeProxySettings() = 0;
271 // Returns VolumeControlDelegate.
272 virtual VolumeControlDelegate* GetVolumeControlDelegate() const = 0;
274 // Sets VolumeControlDelegate.
275 virtual void SetVolumeControlDelegate(
276 scoped_ptr<VolumeControlDelegate> delegate) = 0;
278 // Retrieves the session start time. Returns |false| if the time is not set.
279 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) = 0;
281 // Retrieves the session length limit. Returns |false| if no limit is set.
282 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) = 0;
284 // Get the system tray menu size in pixels (dependent on the language).
285 virtual int GetSystemTrayMenuWidth() = 0;
287 // The active user has been changed. This will be called when the UI is ready
288 // to be switched to the new user.
289 // Note: This will happen after SessionStateObserver::ActiveUserChanged fires.
290 virtual void ActiveUserWasChanged() = 0;
292 // Returns true when the Search key is configured to be treated as Caps Lock.
293 virtual bool IsSearchKeyMappedToCapsLock() = 0;
295 // Returns accounts delegate for given user.
296 virtual tray::UserAccountsDelegate* GetUserAccountsDelegate(
297 const std::string& user_id) = 0;
302 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_