Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ash / system / tray / system_tray_delegate.h
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.
4
5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_
7
8 #include <string>
9 #include <vector>
10
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"
19
20 namespace base {
21 class TimeDelta;
22 class TimeTicks;
23 }
24
25 namespace ash {
26
27 class CustodianInfoTrayObserver;
28
29 struct ASH_EXPORT NetworkIconInfo {
30   NetworkIconInfo();
31   ~NetworkIconInfo();
32
33   bool highlight() const { return connected || connecting; }
34
35   bool connecting;
36   bool connected;
37   bool tray_icon_visible;
38   gfx::ImageSkia image;
39   base::string16 name;
40   base::string16 description;
41   std::string service_path;
42   bool is_cellular;
43 };
44
45 struct ASH_EXPORT BluetoothDeviceInfo {
46   BluetoothDeviceInfo();
47   ~BluetoothDeviceInfo();
48
49   std::string address;
50   base::string16 display_name;
51   bool connected;
52   bool connecting;
53   bool paired;
54 };
55
56 typedef std::vector<BluetoothDeviceInfo> BluetoothDeviceList;
57
58 struct ASH_EXPORT IMEPropertyInfo {
59   IMEPropertyInfo();
60   ~IMEPropertyInfo();
61
62   bool selected;
63   std::string key;
64   base::string16 name;
65 };
66
67 typedef std::vector<IMEPropertyInfo> IMEPropertyInfoList;
68
69 struct ASH_EXPORT IMEInfo {
70   IMEInfo();
71   ~IMEInfo();
72
73   bool selected;
74   bool third_party;
75   std::string id;
76   base::string16 name;
77   base::string16 medium_name;
78   base::string16 short_name;
79 };
80
81 struct ASH_EXPORT UpdateInfo {
82   enum UpdateSeverity {
83     UPDATE_NORMAL,
84     UPDATE_LOW_GREEN,
85     UPDATE_HIGH_ORANGE,
86     UPDATE_SEVERE_RED,
87   };
88
89   UpdateInfo();
90   ~UpdateInfo();
91
92   UpdateSeverity severity;
93   bool update_required;
94   bool factory_reset_required;
95 };
96
97 typedef std::vector<IMEInfo> IMEInfoList;
98
99 class VolumeControlDelegate;
100
101 namespace tray {
102 class UserAccountsDelegate;
103 }  // namespace tray
104
105 class ASH_EXPORT SystemTrayDelegate {
106  public:
107   virtual ~SystemTrayDelegate() {}
108
109   // Called after SystemTray has been instantiated.
110   virtual void Initialize() = 0;
111
112   // Called before SystemTray is destroyed.
113   virtual void Shutdown() = 0;
114
115   // Returns true if system tray should be visible on startup.
116   virtual bool GetTrayVisibilityOnStartup() = 0;
117
118   // Gets information about the active user.
119   virtual user::LoginStatus GetUserLoginStatus() const = 0;
120
121   // Shows UI for changing user's profile picture.
122   virtual void ChangeProfilePicture() = 0;
123
124   // Returns the domain that manages the device, if it is enterprise-enrolled.
125   virtual const std::string GetEnterpriseDomain() const = 0;
126
127   // Returns notification for enterprise enrolled devices.
128   virtual const base::string16 GetEnterpriseMessage() const = 0;
129
130   // Returns the display email of the user that manages the current supervised
131   // user.
132   virtual const std::string GetSupervisedUserManager() const = 0;
133
134   // Returns the name of the user that manages the current supervised user.
135   virtual const base::string16 GetSupervisedUserManagerName() const = 0;
136
137   // Returns the notification for supervised users.
138   virtual const base::string16 GetSupervisedUserMessage() const = 0;
139
140   // Returns true if the current user is supervised.
141   virtual bool IsUserSupervised() const = 0;
142
143   // Fills |info| structure with current update info.
144   virtual void GetSystemUpdateInfo(UpdateInfo* info) const = 0;
145
146   // Returns the desired hour clock type.
147   virtual base::HourClockType GetHourClockType() const = 0;
148
149   // Shows settings.
150   virtual void ShowSettings() = 0;
151
152   // Returns true if settings menu item should appear.
153   virtual bool ShouldShowSettings() = 0;
154
155   // Shows the settings related to date, timezone etc.
156   virtual void ShowDateSettings() = 0;
157
158   // Shows the dialog to set system time, date, and timezone.
159   virtual void ShowSetTimeDialog() = 0;
160
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;
164
165   // Shows the settings related to bluetooth.
166   virtual void ShowBluetoothSettings() = 0;
167
168   // Shows settings related to multiple displays.
169   virtual void ShowDisplaySettings() = 0;
170
171   // Shows the page that lets you disable performance tracing.
172   virtual void ShowChromeSlow() = 0;
173
174   // Returns true if the notification for the display configuration change
175   // should appear.
176   virtual bool ShouldShowDisplayNotification() = 0;
177
178   // Shows settings related to input methods.
179   virtual void ShowIMESettings() = 0;
180
181   // Shows help.
182   virtual void ShowHelp() = 0;
183
184   // Show accessilibity help.
185   virtual void ShowAccessibilityHelp() = 0;
186
187   // Show the settings related to accessilibity.
188   virtual void ShowAccessibilitySettings() = 0;
189
190   // Shows more information about public account mode.
191   virtual void ShowPublicAccountInfo() = 0;
192
193   // Shows information about enterprise enrolled devices.
194   virtual void ShowEnterpriseInfo() = 0;
195
196   // Shows information about supervised users.
197   virtual void ShowSupervisedUserInfo() = 0;
198
199   // Shows login UI to add other users to this session.
200   virtual void ShowUserLogin() = 0;
201
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;
205
206   // True if the spring charger replacement dialog is visible.
207   virtual bool IsSpringChargerReplacementDialogVisible() = 0;
208
209   // True if user has confirmed using safe spring charger.
210   virtual bool HasUserConfirmedSafeSpringCharger() = 0;
211
212   // Attempts to shut down the system.
213   virtual void ShutDown() = 0;
214
215   // Attempts to sign out the user.
216   virtual void SignOut() = 0;
217
218   // Attempts to lock the screen.
219   virtual void RequestLockScreen() = 0;
220
221   // Attempts to restart the system for update.
222   virtual void RequestRestartForUpdate() = 0;
223
224   // Returns a list of available bluetooth devices.
225   virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices) = 0;
226
227   // Requests bluetooth start discovering devices.
228   virtual void BluetoothStartDiscovering() = 0;
229
230   // Requests bluetooth stop discovering devices.
231   virtual void BluetoothStopDiscovering() = 0;
232
233   // Connect to a specific bluetooth device.
234   virtual void ConnectToBluetoothDevice(const std::string& address) = 0;
235
236   // Returns true if bluetooth adapter is discovering bluetooth devices.
237   virtual bool IsBluetoothDiscovering() = 0;
238
239   // Returns the currently selected IME.
240   virtual void GetCurrentIME(IMEInfo* info) = 0;
241
242   // Returns a list of availble IMEs.
243   virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
244
245   // Returns a list of properties for the currently selected IME.
246   virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) = 0;
247
248   // Switches to the selected input method.
249   virtual void SwitchIME(const std::string& ime_id) = 0;
250
251   // Activates an IME property.
252   virtual void ActivateIMEProperty(const std::string& key) = 0;
253
254   // Shows UI to manage bluetooth devices.
255   virtual void ManageBluetoothDevices() = 0;
256
257   // Toggles bluetooth.
258   virtual void ToggleBluetooth() = 0;
259
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;
263
264   // Returns whether bluetooth capability is available.
265   virtual bool GetBluetoothAvailable() = 0;
266
267   // Returns whether bluetooth is enabled.
268   virtual bool GetBluetoothEnabled() = 0;
269
270   // Returns whether the delegate has initiated a bluetooth discovery session.
271   virtual bool GetBluetoothDiscovering() = 0;
272
273   // Shows UI for changing proxy settings.
274   virtual void ChangeProxySettings() = 0;
275
276   // Returns VolumeControlDelegate.
277   virtual VolumeControlDelegate* GetVolumeControlDelegate() const = 0;
278
279   // Sets VolumeControlDelegate.
280   virtual void SetVolumeControlDelegate(
281       scoped_ptr<VolumeControlDelegate> delegate) = 0;
282
283   // Retrieves the session start time. Returns |false| if the time is not set.
284   virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) = 0;
285
286   // Retrieves the session length limit. Returns |false| if no limit is set.
287   virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) = 0;
288
289   // Get the system tray menu size in pixels (dependent on the language).
290   virtual int GetSystemTrayMenuWidth() = 0;
291
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;
296
297   // Returns true when the Search key is configured to be treated as Caps Lock.
298   virtual bool IsSearchKeyMappedToCapsLock() = 0;
299
300   // Returns accounts delegate for given user.
301   virtual tray::UserAccountsDelegate* GetUserAccountsDelegate(
302       const std::string& user_id) = 0;
303
304   // Adding observers that are notified when supervised info is being changed.
305   virtual void AddCustodianInfoTrayObserver(
306       CustodianInfoTrayObserver* observer) = 0;
307
308   virtual void RemoveCustodianInfoTrayObserver(
309       CustodianInfoTrayObserver* observer) = 0;
310 };
311
312 }  // namespace ash
313
314 #endif  // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_