cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ash / system / tray / system_tray_delegate.h
blobcd1ee8be68e28c16ed0a48df3b3762232de1da2f
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/user/login_status.h"
13 #include "ash/volume_control_delegate.h"
14 #include "base/callback_forward.h"
15 #include "base/files/file_path.h"
16 #include "base/i18n/time_formatting.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/strings/string16.h"
19 #include "ui/gfx/image/image_skia.h"
21 namespace base {
22 class TimeDelta;
23 class TimeTicks;
26 namespace ash {
28 class CustodianInfoTrayObserver;
29 class ShutdownPolicyObserver;
31 struct ASH_EXPORT NetworkIconInfo {
32 NetworkIconInfo();
33 ~NetworkIconInfo();
35 bool highlight() const { return connected || connecting; }
37 bool connecting;
38 bool connected;
39 bool tray_icon_visible;
40 gfx::ImageSkia image;
41 base::string16 name;
42 base::string16 description;
43 std::string service_path;
44 bool is_cellular;
47 struct ASH_EXPORT BluetoothDeviceInfo {
48 BluetoothDeviceInfo();
49 ~BluetoothDeviceInfo();
51 std::string address;
52 base::string16 display_name;
53 bool connected;
54 bool connecting;
55 bool paired;
58 using BluetoothDeviceList = std::vector<BluetoothDeviceInfo>;
60 struct ASH_EXPORT IMEPropertyInfo {
61 IMEPropertyInfo();
62 ~IMEPropertyInfo();
64 bool selected;
65 std::string key;
66 base::string16 name;
69 using IMEPropertyInfoList = std::vector<IMEPropertyInfo>;
71 struct ASH_EXPORT IMEInfo {
72 IMEInfo();
73 ~IMEInfo();
75 bool selected;
76 bool third_party;
77 std::string id;
78 base::string16 name;
79 base::string16 medium_name;
80 base::string16 short_name;
83 struct ASH_EXPORT UpdateInfo {
84 enum UpdateSeverity {
85 UPDATE_NORMAL,
86 UPDATE_LOW_GREEN,
87 UPDATE_HIGH_ORANGE,
88 UPDATE_SEVERE_RED,
91 UpdateInfo();
92 ~UpdateInfo();
94 UpdateSeverity severity;
95 bool update_required;
96 bool factory_reset_required;
99 using IMEInfoList = std::vector<IMEInfo>;
101 class CastConfigDelegate;
102 class NetworkingConfigDelegate;
103 class VPNDelegate;
105 using RebootOnShutdownCallback = base::Callback<void(bool)>;
107 namespace tray {
108 class UserAccountsDelegate;
109 } // namespace tray
111 // SystemTrayDelegate is intended for delegating tasks in the System Tray to the
112 // application (e.g. Chrome). These tasks should be limited to application
113 // (browser) specific tasks. For non application specific tasks, where possible,
114 // components/, chromeos/, device/, etc., code should be used directly. If more
115 // than one related method is being added, consider adding an additional
116 // specific delegate (e.g. VolumeControlDelegate).
118 // These methods should all have trivial default implementations for platforms
119 // that do not implement the method (e.g. return false or nullptr). This
120 // eliminates the need to propagate default implementations across the various
121 // implementations of this class. Consumers of this delegate should handle the
122 // default return value (e.g. nullptr).
123 class ASH_EXPORT SystemTrayDelegate {
124 public:
125 SystemTrayDelegate();
126 virtual ~SystemTrayDelegate();
128 // Called after SystemTray has been instantiated.
129 virtual void Initialize();
131 // Called before SystemTray is destroyed.
132 virtual void Shutdown();
134 // Returns true if system tray should be visible on startup.
135 virtual bool GetTrayVisibilityOnStartup();
137 // Gets information about the active user.
138 virtual user::LoginStatus GetUserLoginStatus() const;
140 // Shows UI for changing user's profile picture.
141 virtual void ChangeProfilePicture();
143 // Returns the domain that manages the device, if it is enterprise-enrolled.
144 virtual const std::string GetEnterpriseDomain() const;
146 // Returns notification for enterprise enrolled devices.
147 virtual const base::string16 GetEnterpriseMessage() const;
149 // Returns the display email of the user that manages the current supervised
150 // user.
151 virtual const std::string GetSupervisedUserManager() const;
153 // Returns the name of the user that manages the current supervised user.
154 virtual const base::string16 GetSupervisedUserManagerName() const;
156 // Returns the notification for supervised users.
157 virtual const base::string16 GetSupervisedUserMessage() const;
159 // Returns true if the current user is supervised: has legacy supervised
160 // account or kid account.
161 virtual bool IsUserSupervised() const;
163 // Returns true if the current user is child.
164 // TODO(merkulova): remove on FakeUserManager componentization.
165 // crbug.com/443119
166 virtual bool IsUserChild() const;
168 // Fills |info| structure (which must not be null) with current update info.
169 virtual void GetSystemUpdateInfo(UpdateInfo* info) const;
171 // Returns the desired hour clock type.
172 virtual base::HourClockType GetHourClockType() const;
174 // Shows settings.
175 virtual void ShowSettings();
177 // Returns true if settings menu item should appear.
178 virtual bool ShouldShowSettings();
180 // Shows the settings related to date, timezone etc.
181 virtual void ShowDateSettings();
183 // Shows the dialog to set system time, date, and timezone.
184 virtual void ShowSetTimeDialog();
186 // Shows the settings related to network. If |guid| is not empty,
187 // show the settings for the corresponding network.
188 virtual void ShowNetworkSettingsForGuid(const std::string& guid);
190 // Shows settings related to multiple displays.
191 virtual void ShowDisplaySettings();
193 // Shows the page that lets you disable performance tracing.
194 virtual void ShowChromeSlow();
196 // Returns true if the notification for the display configuration change
197 // should appear.
198 virtual bool ShouldShowDisplayNotification();
200 // Shows settings related to input methods.
201 virtual void ShowIMESettings();
203 // Shows help.
204 virtual void ShowHelp();
206 // Show accessilibity help.
207 virtual void ShowAccessibilityHelp();
209 // Show the settings related to accessilibity.
210 virtual void ShowAccessibilitySettings();
212 // Shows more information about public account mode.
213 virtual void ShowPublicAccountInfo();
215 // Shows information about enterprise enrolled devices.
216 virtual void ShowEnterpriseInfo();
218 // Shows information about supervised users.
219 virtual void ShowSupervisedUserInfo();
221 // Shows login UI to add other users to this session.
222 virtual void ShowUserLogin();
224 // Attempts to sign out the user.
225 virtual void SignOut();
227 // Attempts to lock the screen.
228 virtual void RequestLockScreen();
230 // Attempts to restart the system for update.
231 virtual void RequestRestartForUpdate();
233 // Returns a list of available bluetooth devices.
234 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices);
236 // Requests bluetooth start discovering devices.
237 virtual void BluetoothStartDiscovering();
239 // Requests bluetooth stop discovering devices.
240 virtual void BluetoothStopDiscovering();
242 // Connect to a specific bluetooth device.
243 virtual void ConnectToBluetoothDevice(const std::string& address);
245 // Returns true if bluetooth adapter is discovering bluetooth devices.
246 virtual bool IsBluetoothDiscovering();
248 // Returns the currently selected IME.
249 virtual void GetCurrentIME(IMEInfo* info);
251 // Returns a list of availble IMEs.
252 virtual void GetAvailableIMEList(IMEInfoList* list);
254 // Returns a list of properties for the currently selected IME.
255 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list);
257 // Switches to the selected input method.
258 virtual void SwitchIME(const std::string& ime_id);
260 // Activates an IME property.
261 virtual void ActivateIMEProperty(const std::string& key);
263 // Shows UI to manage bluetooth devices.
264 virtual void ManageBluetoothDevices();
266 // Toggles bluetooth.
267 virtual void ToggleBluetooth();
269 // Shows UI to connect to an unlisted network of type |type|. On Chrome OS
270 // |type| corresponds to a Shill network type.
271 virtual void ShowOtherNetworkDialog(const std::string& type);
273 // Returns whether bluetooth capability is available.
274 virtual bool GetBluetoothAvailable();
276 // Returns whether bluetooth is enabled.
277 virtual bool GetBluetoothEnabled();
279 // Returns whether the delegate has initiated a bluetooth discovery session.
280 virtual bool GetBluetoothDiscovering();
282 // Shows UI for changing proxy settings.
283 virtual void ChangeProxySettings();
285 // Returns CastConfigDelegate. May return nullptr.
286 virtual CastConfigDelegate* GetCastConfigDelegate() const;
288 // Returns NetworkingConfigDelegate. May return nullptr.
289 virtual NetworkingConfigDelegate* GetNetworkingConfigDelegate() const;
291 // Returns VolumeControlDelegate. May return nullptr.
292 virtual VolumeControlDelegate* GetVolumeControlDelegate() const;
294 // Sets the VolumeControlDelegate.
295 virtual void SetVolumeControlDelegate(
296 scoped_ptr<VolumeControlDelegate> delegate);
298 // Retrieves the session start time. Returns |false| if the time is not set.
299 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time);
301 // Retrieves the session length limit. Returns |false| if no limit is set.
302 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit);
304 // Get the system tray menu size in pixels (dependent on the language).
305 virtual int GetSystemTrayMenuWidth();
307 // The active user has been changed. This will be called when the UI is ready
308 // to be switched to the new user.
309 // Note: This will happen after SessionStateObserver::ActiveUserChanged fires.
310 virtual void ActiveUserWasChanged();
312 // Returns true when the Search key is configured to be treated as Caps Lock.
313 virtual bool IsSearchKeyMappedToCapsLock();
315 // Returns accounts delegate for given user. May return nullptr.
316 virtual tray::UserAccountsDelegate* GetUserAccountsDelegate(
317 const std::string& user_id);
319 // Adding observers that are notified when supervised info is being changed.
320 virtual void AddCustodianInfoTrayObserver(
321 CustodianInfoTrayObserver* observer);
323 virtual void RemoveCustodianInfoTrayObserver(
324 CustodianInfoTrayObserver* observer);
326 // Adds an observer whose |OnShutdownPolicyChanged| function is called when
327 // the |DeviceRebootOnShutdown| policy changes. If this policy is set to
328 // true, a device cannot be shut down anymore but only rebooted.
329 virtual void AddShutdownPolicyObserver(ShutdownPolicyObserver* observer);
331 virtual void RemoveShutdownPolicyObserver(ShutdownPolicyObserver* observer);
333 // Determines whether the device is automatically rebooted when shut down as
334 // specified by the device policy |DeviceRebootOnShutdown|. This function
335 // asynchronously calls |callback| once a trusted policy becomes available.
336 virtual void ShouldRebootOnShutdown(const RebootOnShutdownCallback& callback);
338 // Returns VPNDelegate. May return nullptr.
339 virtual VPNDelegate* GetVPNDelegate() const;
342 } // namespace ash
344 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_