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"
18 #include "ui/gfx/native_widget_types.h"
27 struct ASH_EXPORT NetworkIconInfo
{
31 bool highlight() const { return connected
|| connecting
; }
35 bool tray_icon_visible
;
38 base::string16 description
;
39 std::string service_path
;
43 struct ASH_EXPORT BluetoothDeviceInfo
{
44 BluetoothDeviceInfo();
45 ~BluetoothDeviceInfo();
48 base::string16 display_name
;
54 typedef std::vector
<BluetoothDeviceInfo
> BluetoothDeviceList
;
56 struct ASH_EXPORT IMEPropertyInfo
{
65 typedef std::vector
<IMEPropertyInfo
> IMEPropertyInfoList
;
67 struct ASH_EXPORT IMEInfo
{
75 base::string16 medium_name
;
76 base::string16 short_name
;
79 typedef std::vector
<IMEInfo
> IMEInfoList
;
81 class VolumeControlDelegate
;
84 class UserAccountsDelegate
;
87 class ASH_EXPORT SystemTrayDelegate
{
89 virtual ~SystemTrayDelegate() {}
91 // Called after SystemTray has been instantiated.
92 virtual void Initialize() = 0;
94 // Called before SystemTray is destroyed.
95 virtual void Shutdown() = 0;
97 // Returns true if system tray should be visible on startup.
98 virtual bool GetTrayVisibilityOnStartup() = 0;
100 // Gets information about the active user.
101 virtual user::LoginStatus
GetUserLoginStatus() const = 0;
103 // Shows UI for changing user's profile picture.
104 virtual void ChangeProfilePicture() = 0;
106 // Returns the domain that manages the device, if it is enterprise-enrolled.
107 virtual const std::string
GetEnterpriseDomain() const = 0;
109 // Returns notification for enterprise enrolled devices.
110 virtual const base::string16
GetEnterpriseMessage() const = 0;
112 // Returns the display email of the user that manages the current supervised
114 virtual const std::string
GetSupervisedUserManager() const = 0;
116 // Returns the name of the user that manages the current supervised user.
117 virtual const base::string16
GetSupervisedUserManagerName() const = 0;
119 // Returns the notification for supervised users.
120 virtual const base::string16
GetSupervisedUserMessage() const = 0;
122 // Returns whether a system upgrade is available.
123 virtual bool SystemShouldUpgrade() const = 0;
125 // Returns the desired hour clock type.
126 virtual base::HourClockType
GetHourClockType() const = 0;
129 virtual void ShowSettings() = 0;
131 // Returns true if settings menu item should appear.
132 virtual bool ShouldShowSettings() = 0;
134 // Shows the settings related to date, timezone etc.
135 virtual void ShowDateSettings() = 0;
137 // Shows the dialog to set system time, date, and timezone.
138 virtual void ShowSetTimeDialog() = 0;
140 // Shows the settings related to network. If |service_path| is not empty,
141 // show the settings for that network.
142 virtual void ShowNetworkSettings(const std::string
& service_path
) = 0;
144 // Shows the settings related to bluetooth.
145 virtual void ShowBluetoothSettings() = 0;
147 // Shows settings related to multiple displays.
148 virtual void ShowDisplaySettings() = 0;
150 // Shows the page that lets you disable performance tracing.
151 virtual void ShowChromeSlow() = 0;
153 // Returns true if the notification for the display configuration change
155 virtual bool ShouldShowDisplayNotification() = 0;
157 // Shows settings related to input methods.
158 virtual void ShowIMESettings() = 0;
161 virtual void ShowHelp() = 0;
163 // Show accessilibity help.
164 virtual void ShowAccessibilityHelp() = 0;
166 // Show the settings related to accessilibity.
167 virtual void ShowAccessibilitySettings() = 0;
169 // Shows more information about public account mode.
170 virtual void ShowPublicAccountInfo() = 0;
172 // Shows information about enterprise enrolled devices.
173 virtual void ShowEnterpriseInfo() = 0;
175 // Shows information about supervised users.
176 virtual void ShowSupervisedUserInfo() = 0;
178 // Shows login UI to add other users to this session.
179 virtual void ShowUserLogin() = 0;
181 // Shows the spring charger replacement dialog if necessary.
182 // Returns true if the dialog is shown by the call.
183 virtual bool ShowSpringChargerReplacementDialog() = 0;
185 // True if the spring charger replacement dialog is visible.
186 virtual bool IsSpringChargerReplacementDialogVisible() = 0;
188 // True if user has confirmed using safe spring charger.
189 virtual bool HasUserConfirmedSafeSpringCharger() = 0;
191 // Attempts to shut down the system.
192 virtual void ShutDown() = 0;
194 // Attempts to sign out the user.
195 virtual void SignOut() = 0;
197 // Attempts to lock the screen.
198 virtual void RequestLockScreen() = 0;
200 // Attempts to restart the system for update.
201 virtual void RequestRestartForUpdate() = 0;
203 // Returns a list of available bluetooth devices.
204 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList
* devices
) = 0;
206 // Requests bluetooth start discovering devices.
207 virtual void BluetoothStartDiscovering() = 0;
209 // Requests bluetooth stop discovering devices.
210 virtual void BluetoothStopDiscovering() = 0;
212 // Connect to a specific bluetooth device.
213 virtual void ConnectToBluetoothDevice(const std::string
& address
) = 0;
215 // Returns true if bluetooth adapter is discovering bluetooth devices.
216 virtual bool IsBluetoothDiscovering() = 0;
218 // Returns the currently selected IME.
219 virtual void GetCurrentIME(IMEInfo
* info
) = 0;
221 // Returns a list of availble IMEs.
222 virtual void GetAvailableIMEList(IMEInfoList
* list
) = 0;
224 // Returns a list of properties for the currently selected IME.
225 virtual void GetCurrentIMEProperties(IMEPropertyInfoList
* list
) = 0;
227 // Switches to the selected input method.
228 virtual void SwitchIME(const std::string
& ime_id
) = 0;
230 // Activates an IME property.
231 virtual void ActivateIMEProperty(const std::string
& key
) = 0;
233 // Shows UI to configure or activate the network specified by |network_id|,
234 // which may include showing Payment or Portal UI when appropriate.
235 // |parent_window| is used to parent any configuration UI. If NULL a default
236 // window will be used.
237 virtual void ShowNetworkConfigure(const std::string
& network_id
,
238 gfx::NativeWindow parent_window
) = 0;
240 // Shows UI to enroll the network specified by |network_id| if appropriate
241 // and returns true, otherwise returns false. |parent_window| is used
242 // to parent any configuration UI. If NULL a default window will be used.
243 virtual bool EnrollNetwork(const std::string
& network_id
,
244 gfx::NativeWindow parent_window
) = 0;
246 // Shows UI to manage bluetooth devices.
247 virtual void ManageBluetoothDevices() = 0;
249 // Toggles bluetooth.
250 virtual void ToggleBluetooth() = 0;
252 // Shows UI to unlock a mobile sim.
253 virtual void ShowMobileSimDialog() = 0;
255 // Shows UI to setup a mobile network.
256 virtual void ShowMobileSetupDialog(const std::string
& service_path
) = 0;
258 // Shows UI to connect to an unlisted network of type |type|. On Chrome OS
259 // |type| corresponds to a Shill network type.
260 virtual void ShowOtherNetworkDialog(const std::string
& type
) = 0;
262 // Returns whether bluetooth capability is available.
263 virtual bool GetBluetoothAvailable() = 0;
265 // Returns whether bluetooth is enabled.
266 virtual bool GetBluetoothEnabled() = 0;
268 // Returns whether the delegate has initiated a bluetooth discovery session.
269 virtual bool GetBluetoothDiscovering() = 0;
271 // Shows UI for changing proxy settings.
272 virtual void ChangeProxySettings() = 0;
274 // Returns VolumeControlDelegate.
275 virtual VolumeControlDelegate
* GetVolumeControlDelegate() const = 0;
277 // Sets VolumeControlDelegate.
278 virtual void SetVolumeControlDelegate(
279 scoped_ptr
<VolumeControlDelegate
> delegate
) = 0;
281 // Retrieves the session start time. Returns |false| if the time is not set.
282 virtual bool GetSessionStartTime(base::TimeTicks
* session_start_time
) = 0;
284 // Retrieves the session length limit. Returns |false| if no limit is set.
285 virtual bool GetSessionLengthLimit(base::TimeDelta
* session_length_limit
) = 0;
287 // Get the system tray menu size in pixels (dependent on the language).
288 virtual int GetSystemTrayMenuWidth() = 0;
290 // The active user has been changed. This will be called when the UI is ready
291 // to be switched to the new user.
292 // Note: This will happen after SessionStateObserver::ActiveUserChanged fires.
293 virtual void ActiveUserWasChanged() = 0;
295 // Returns true when the Search key is configured to be treated as Caps Lock.
296 virtual bool IsSearchKeyMappedToCapsLock() = 0;
298 // Returns accounts delegate for given user.
299 virtual tray::UserAccountsDelegate
* GetUserAccountsDelegate(
300 const std::string
& user_id
) = 0;
305 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_