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 // Structure that packs progress information of each operation.
57 struct ASH_EXPORT DriveOperationStatus {
64 OPERATION_NOT_STARTED,
65 OPERATION_IN_PROGRESS,
70 DriveOperationStatus();
71 ~DriveOperationStatus();
73 // Unique ID for the operation.
77 base::FilePath file_path;
78 // Current operation completion progress [0.0 - 1.0].
84 typedef std::vector<DriveOperationStatus> DriveOperationStatusList;
87 struct ASH_EXPORT IMEPropertyInfo {
96 typedef std::vector<IMEPropertyInfo> IMEPropertyInfoList;
98 struct ASH_EXPORT IMEInfo {
106 base::string16 medium_name;
107 base::string16 short_name;
110 typedef std::vector<IMEInfo> IMEInfoList;
112 class VolumeControlDelegate;
114 class ASH_EXPORT SystemTrayDelegate {
116 virtual ~SystemTrayDelegate() {}
118 // Called after SystemTray has been instantiated.
119 virtual void Initialize() = 0;
121 // Called before SystemTray is destroyed.
122 virtual void Shutdown() = 0;
124 // Returns true if system tray should be visible on startup.
125 virtual bool GetTrayVisibilityOnStartup() = 0;
127 // Gets information about the active user.
128 virtual user::LoginStatus GetUserLoginStatus() const = 0;
129 virtual bool IsOobeCompleted() const = 0;
131 // Shows UI for changing user's profile picture.
132 virtual void ChangeProfilePicture() = 0;
134 // Returns the domain that manages the device, if it is enterprise-enrolled.
135 virtual const std::string GetEnterpriseDomain() const = 0;
137 // Returns notification for enterprise enrolled devices.
138 virtual const base::string16 GetEnterpriseMessage() const = 0;
140 // Returns the display email of user that manages current
141 // locally managed user.
142 virtual const std::string GetLocallyManagedUserManager() const = 0;
144 // Returns the name of user that manages current locally managed user.
145 virtual const base::string16 GetLocallyManagedUserManagerName() const = 0;
147 // Returns notification for locally managed users.
148 virtual const base::string16 GetLocallyManagedUserMessage() const = 0;
150 // Returns whether a system upgrade is available.
151 virtual bool SystemShouldUpgrade() const = 0;
153 // Returns the desired hour clock type.
154 virtual base::HourClockType GetHourClockType() const = 0;
157 virtual void ShowSettings() = 0;
159 // Returns true if settings menu item should appear.
160 virtual bool ShouldShowSettings() = 0;
162 // Shows the settings related to date, timezone etc.
163 virtual void ShowDateSettings() = 0;
165 // Shows the settings related to network. If |service_path| is not empty,
166 // show the settings for that network.
167 virtual void ShowNetworkSettings(const std::string& service_path) = 0;
169 // Shows the settings related to bluetooth.
170 virtual void ShowBluetoothSettings() = 0;
172 // Shows settings related to multiple displays.
173 virtual void ShowDisplaySettings() = 0;
175 // Shows the page that lets you disable performance tracing.
176 virtual void ShowChromeSlow() = 0;
178 // Returns true if the notification for the display configuration change
180 virtual bool ShouldShowDisplayNotification() = 0;
182 // Shows settings related to Google Drive.
183 virtual void ShowDriveSettings() = 0;
185 // Shows settings related to input methods.
186 virtual void ShowIMESettings() = 0;
189 virtual void ShowHelp() = 0;
191 // Show accessilibity help.
192 virtual void ShowAccessibilityHelp() = 0;
194 // Show the settings related to accessilibity.
195 virtual void ShowAccessibilitySettings() = 0;
197 // Shows more information about public account mode.
198 virtual void ShowPublicAccountInfo() = 0;
200 // Shows information about enterprise enrolled devices.
201 virtual void ShowEnterpriseInfo() = 0;
203 // Shows information about locally managed users.
204 virtual void ShowLocallyManagedUserInfo() = 0;
206 // Shows login UI to add other users to this session.
207 virtual void ShowUserLogin() = 0;
209 // Shows the spring charger replacement dialog if necessary.
210 // Returns true if the dialog is shown by the call.
211 virtual bool ShowSpringChargerReplacementDialog() = 0;
213 // True if the spring charger replacement dialog is visible.
214 virtual bool IsSpringChargerReplacementDialogVisible() = 0;
216 // True if user has confirmed using safe spring charger.
217 virtual bool HasUserConfirmedSafeSpringCharger() = 0;
219 // Attempts to shut down the system.
220 virtual void ShutDown() = 0;
222 // Attempts to sign out the user.
223 virtual void SignOut() = 0;
225 // Attempts to lock the screen.
226 virtual void RequestLockScreen() = 0;
228 // Attempts to restart the system for update.
229 virtual void RequestRestartForUpdate() = 0;
231 // Returns a list of available bluetooth devices.
232 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
234 // Requests bluetooth start discovering devices.
235 virtual void BluetoothStartDiscovering() = 0;
237 // Requests bluetooth stop discovering devices.
238 virtual void BluetoothStopDiscovering() = 0;
240 // Connect to a specific bluetooth device.
241 virtual void ConnectToBluetoothDevice(const std::string& address) = 0;
243 // Returns true if bluetooth adapter is discovering bluetooth devices.
244 virtual bool IsBluetoothDiscovering() = 0;
246 // Returns the currently selected IME.
247 virtual void GetCurrentIME(IMEInfo* info) = 0;
249 // Returns a list of availble IMEs.
250 virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
252 // Returns a list of properties for the currently selected IME.
253 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) = 0;
255 // Switches to the selected input method.
256 virtual void SwitchIME(const std::string& ime_id) = 0;
258 // Activates an IME property.
259 virtual void ActivateIMEProperty(const std::string& key) = 0;
261 // Cancels ongoing drive operation.
262 virtual void CancelDriveOperation(int32 operation_id) = 0;
264 // Returns information about the ongoing drive operations.
265 virtual void GetDriveOperationStatusList(
266 DriveOperationStatusList* list) = 0;
268 // Shows UI to configure or activate the network specified by |network_id|,
269 // which may include showing Payment or Portal UI when appropriate.
270 // |parent_window| is used to parent any configuration UI. If NULL a default
271 // window will be used.
272 virtual void ShowNetworkConfigure(const std::string& network_id,
273 gfx::NativeWindow parent_window) = 0;
275 // Shows UI to enroll the network specified by |network_id| if appropriate
276 // and returns true, otherwise returns false. |parent_window| is used
277 // to parent any configuration UI. If NULL a default window will be used.
278 virtual bool EnrollNetwork(const std::string& network_id,
279 gfx::NativeWindow parent_window) = 0;
281 // Shows UI to manage bluetooth devices.
282 virtual void ManageBluetoothDevices() = 0;
284 // Toggles bluetooth.
285 virtual void ToggleBluetooth() = 0;
287 // Shows UI to unlock a mobile sim.
288 virtual void ShowMobileSimDialog() = 0;
290 // Shows UI to setup a mobile network.
291 virtual void ShowMobileSetupDialog(const std::string& service_path) = 0;
293 // Shows UI to connect to an unlisted network of type |type|. On Chrome OS
294 // |type| corresponds to a Shill network type.
295 virtual void ShowOtherNetworkDialog(const std::string& type) = 0;
297 // Returns whether bluetooth capability is available.
298 virtual bool GetBluetoothAvailable() = 0;
300 // Returns whether bluetooth is enabled.
301 virtual bool GetBluetoothEnabled() = 0;
303 // Shows UI for changing proxy settings.
304 virtual void ChangeProxySettings() = 0;
306 // Returns VolumeControlDelegate.
307 virtual VolumeControlDelegate* GetVolumeControlDelegate() const = 0;
309 // Sets VolumeControlDelegate.
310 virtual void SetVolumeControlDelegate(
311 scoped_ptr<VolumeControlDelegate> delegate) = 0;
313 // Retrieves the session start time. Returns |false| if the time is not set.
314 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) = 0;
316 // Retrieves the session length limit. Returns |false| if no limit is set.
317 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) = 0;
319 // Get the system tray menu size in pixels (dependent on the language).
320 virtual int GetSystemTrayMenuWidth() = 0;
322 // The active user has been changed. This will be called when the UI is ready
323 // to be switched to the new user.
324 // Note: This will happen after SessionStateObserver::ActiveUserChanged fires.
325 virtual void ActiveUserWasChanged() = 0;
330 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_