[content shell] implement testRunner.overridePreference
[chromium-blink-merge.git] / ash / system / tray / system_tray_delegate.h
blob762ff240bf879131343cb5e96e1daacabf5d717c
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/power/power_supply_status.h"
13 #include "ash/system/user/login_status.h"
14 #include "base/file_path.h"
15 #include "base/i18n/time_formatting.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/string16.h"
18 #include "base/time.h"
19 #include "ui/gfx/image/image_skia.h"
21 namespace ash {
23 struct ASH_EXPORT NetworkIconInfo {
24 NetworkIconInfo();
25 ~NetworkIconInfo();
27 bool connecting;
28 bool connected;
29 bool tray_icon_visible;
30 gfx::ImageSkia image;
31 string16 name;
32 string16 description;
33 std::string service_path;
36 struct ASH_EXPORT BluetoothDeviceInfo {
37 BluetoothDeviceInfo();
38 ~BluetoothDeviceInfo();
40 std::string address;
41 string16 display_name;
42 bool connected;
45 typedef std::vector<BluetoothDeviceInfo> BluetoothDeviceList;
47 // Structure that packs progress information of each operation.
48 struct ASH_EXPORT DriveOperationStatus {
49 enum OperationType {
50 OPERATION_UPLOAD,
51 OPERATION_DOWNLOAD,
52 OPERATION_OTHER,
55 enum OperationState {
56 OPERATION_NOT_STARTED,
57 OPERATION_STARTED,
58 OPERATION_IN_PROGRESS,
59 OPERATION_COMPLETED,
60 OPERATION_FAILED,
61 OPERATION_SUSPENDED,
64 DriveOperationStatus();
65 ~DriveOperationStatus();
67 // File path.
68 FilePath file_path;
69 // Current operation completion progress [0.0 - 1.0].
70 double progress;
71 OperationType type;
72 OperationState state;
75 typedef std::vector<DriveOperationStatus> DriveOperationStatusList;
78 struct ASH_EXPORT IMEPropertyInfo {
79 IMEPropertyInfo();
80 ~IMEPropertyInfo();
82 bool selected;
83 std::string key;
84 string16 name;
87 typedef std::vector<IMEPropertyInfo> IMEPropertyInfoList;
89 struct ASH_EXPORT IMEInfo {
90 IMEInfo();
91 ~IMEInfo();
93 bool selected;
94 bool third_party;
95 std::string id;
96 string16 name;
97 string16 medium_name;
98 string16 short_name;
101 typedef std::vector<IMEInfo> IMEInfoList;
103 class VolumeControlDelegate;
105 class SystemTrayDelegate {
106 public:
107 virtual ~SystemTrayDelegate() {}
109 // Called after SystemTray has been instantiated.
110 virtual void Initialize() = 0;
112 // Returns true if system tray should be visible on startup.
113 virtual bool GetTrayVisibilityOnStartup() = 0;
115 // Gets information about the logged in user.
116 virtual const string16 GetUserDisplayName() const = 0;
117 virtual const std::string GetUserEmail() const = 0;
118 virtual const gfx::ImageSkia& GetUserImage() const = 0;
119 virtual user::LoginStatus GetUserLoginStatus() const = 0;
121 // Returns the domain that manages the device, if it is enterprise-enrolled.
122 virtual const std::string GetEnterpriseDomain() 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;
130 // Gets the current power supply status.
131 virtual PowerSupplyStatus GetPowerSupplyStatus() const = 0;
133 // Requests a status update.
134 virtual void RequestStatusUpdate() const = 0;
136 // Shows settings.
137 virtual void ShowSettings() = 0;
139 // Shows the settings related to date, timezone etc.
140 virtual void ShowDateSettings() = 0;
142 // Shows the settings related to network.
143 virtual void ShowNetworkSettings() = 0;
145 // Shows the settings related to bluetooth.
146 virtual void ShowBluetoothSettings() = 0;
148 // Shows settings related to multiple displays.
149 virtual void ShowDisplaySettings() = 0;
151 // Shows settings related to Google Drive.
152 virtual void ShowDriveSettings() = 0;
154 // Shows settings related to input methods.
155 virtual void ShowIMESettings() = 0;
157 // Shows help.
158 virtual void ShowHelp() = 0;
160 // Show accessilibity help.
161 virtual void ShowAccessibilityHelp() = 0;
163 // Shows more information about public account mode.
164 virtual void ShowPublicAccountInfo() = 0;
166 // Attempts to shut down the system.
167 virtual void ShutDown() = 0;
169 // Attempts to sign out the user.
170 virtual void SignOut() = 0;
172 // Attempts to lock the screen.
173 virtual void RequestLockScreen() = 0;
175 // Attempts to restart the system.
176 virtual void RequestRestart() = 0;
178 // Returns a list of available bluetooth devices.
179 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
181 // Toggles connection to a specific bluetooth device.
182 virtual void ToggleBluetoothConnection(const std::string& address) = 0;
184 // Returns true if bluetooth adapter is discovering bluetooth devices.
185 virtual bool IsBluetoothDiscovering() = 0;
187 // Returns the currently selected IME.
188 virtual void GetCurrentIME(IMEInfo* info) = 0;
190 // Returns a list of availble IMEs.
191 virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
193 // Returns a list of properties for the currently selected IME.
194 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) = 0;
196 // Switches to the selected input method.
197 virtual void SwitchIME(const std::string& ime_id) = 0;
199 // Activates an IME property.
200 virtual void ActivateIMEProperty(const std::string& key) = 0;
202 // Cancels ongoing drive operation.
203 virtual void CancelDriveOperation(const FilePath& file_path) = 0;
205 // Returns information about the ongoing drive operations.
206 virtual void GetDriveOperationStatusList(
207 DriveOperationStatusList* list) = 0;
209 // Returns information about the most relevant network. Relevance is
210 // determined by the implementor (e.g. a connecting network may be more
211 // relevant over a connected network etc.)
212 virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info,
213 bool large) = 0;
215 virtual void GetVirtualNetworkIcon(ash::NetworkIconInfo* info) = 0;
217 // Returns information about the available networks.
218 virtual void GetAvailableNetworks(std::vector<NetworkIconInfo>* list) = 0;
220 // Returns the information about all virtual networks.
221 virtual void GetVirtualNetworks(std::vector<NetworkIconInfo>* list) = 0;
223 // Connects to the network specified by the unique id.
224 virtual void ConnectToNetwork(const std::string& network_id) = 0;
226 // Gets the network IP address, and the mac addresses for the ethernet and
227 // wifi devices. If any of this is unavailable, empty strings are returned.
228 virtual void GetNetworkAddresses(std::string* ip_address,
229 std::string* ethernet_mac_address,
230 std::string* wifi_mac_address) = 0;
232 // Requests network scan when list of networks is opened.
233 virtual void RequestNetworkScan() = 0;
235 // Shous UI to add a new bluetooth device.
236 virtual void AddBluetoothDevice() = 0;
238 // Toggles airplane mode.
239 virtual void ToggleAirplaneMode() = 0;
241 // Toggles wifi network.
242 virtual void ToggleWifi() = 0;
244 // Toggles mobile network.
245 virtual void ToggleMobile() = 0;
247 // Toggles bluetooth.
248 virtual void ToggleBluetooth() = 0;
250 // Shows UI to connect to an unlisted wifi network.
251 virtual void ShowOtherWifi() = 0;
253 // Shows UI to configure vpn.
254 virtual void ShowOtherVPN() = 0;
256 // Shows UI to search for cellular networks.
257 virtual void ShowOtherCellular() = 0;
259 // Returns whether the system is connected to any network.
260 virtual bool IsNetworkConnected() = 0;
262 // Returns whether wifi is available.
263 virtual bool GetWifiAvailable() = 0;
265 // Returns whether mobile networking (cellular or wimax) is available.
266 virtual bool GetMobileAvailable() = 0;
268 // Returns whether bluetooth capability is available.
269 virtual bool GetBluetoothAvailable() = 0;
271 // Returns whether wifi is enabled.
272 virtual bool GetWifiEnabled() = 0;
274 // Returns whether mobile (cellular or wimax) networking is enabled.
275 virtual bool GetMobileEnabled() = 0;
277 // Returns whether bluetooth is enabled.
278 virtual bool GetBluetoothEnabled() = 0;
280 // Returns whether mobile scanning is supported.
281 virtual bool GetMobileScanSupported() = 0;
283 // Retrieves information about the carrier and locale specific |setup_url|.
284 // If none of the carrier info/setup URL cannot be retrieved, returns false.
285 // Note: |setup_url| is returned when carrier is not defined (no SIM card).
286 virtual bool GetCellularCarrierInfo(std::string* carrier_id,
287 std::string* topup_url,
288 std::string* setup_url) = 0;
290 // Returns whether or not the network manager is scanning for wifi networks.
291 virtual bool GetWifiScanning() = 0;
293 // Opens the cellular network specific URL.
294 virtual void ShowCellularURL(const std::string& url) = 0;
296 // Shows UI for changing proxy settings.
297 virtual void ChangeProxySettings() = 0;
299 // Returns VolumeControlDelegate.
300 virtual VolumeControlDelegate* GetVolumeControlDelegate() const = 0;
302 // Sets VolumeControlDelegate.
303 virtual void SetVolumeControlDelegate(
304 scoped_ptr<VolumeControlDelegate> delegate) = 0;
306 // Returns the session start time, or a zero base::Time if no session start
307 // time is set.
308 virtual base::Time GetSessionStartTime() = 0;
310 // Returns the session length limit, or a zero base::TimeDelta if no session
311 // length limit is set.
312 virtual base::TimeDelta GetSessionLengthLimit() = 0;
314 // Creates a dummy delegate for testing.
315 static SystemTrayDelegate* CreateDummyDelegate();
318 } // namespace ash
320 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_