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