| 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_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_ | |
| 6 #define ASH_COMMON_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/common/login_status.h" | |
| 14 #include "base/callback_forward.h" | |
| 15 #include "base/files/file_path.h" | |
| 16 #include "base/i18n/time_formatting.h" | |
| 17 #include "base/strings/string16.h" | |
| 18 | |
| 19 namespace base { | |
| 20 class TimeDelta; | |
| 21 class TimeTicks; | |
| 22 } | |
| 23 | |
| 24 namespace device { | |
| 25 enum class BluetoothDeviceType; | |
| 26 } | |
| 27 | |
| 28 namespace ash { | |
| 29 struct IMEInfo; | |
| 30 struct IMEPropertyInfo; | |
| 31 | |
| 32 class CustodianInfoTrayObserver; | |
| 33 class SystemTray; | |
| 34 class SystemTrayItem; | |
| 35 | |
| 36 using IMEInfoList = std::vector<IMEInfo>; | |
| 37 using IMEPropertyInfoList = std::vector<IMEPropertyInfo>; | |
| 38 | |
| 39 struct ASH_EXPORT BluetoothDeviceInfo { | |
| 40 BluetoothDeviceInfo(); | |
| 41 BluetoothDeviceInfo(const BluetoothDeviceInfo& other); | |
| 42 ~BluetoothDeviceInfo(); | |
| 43 | |
| 44 std::string address; | |
| 45 base::string16 display_name; | |
| 46 bool connected; | |
| 47 bool connecting; | |
| 48 bool paired; | |
| 49 device::BluetoothDeviceType device_type; | |
| 50 }; | |
| 51 | |
| 52 using BluetoothDeviceList = std::vector<BluetoothDeviceInfo>; | |
| 53 | |
| 54 class NetworkingConfigDelegate; | |
| 55 | |
| 56 // SystemTrayDelegate is intended for delegating tasks in the System Tray to the | |
| 57 // application (e.g. Chrome). These tasks should be limited to application | |
| 58 // (browser) specific tasks. For non application specific tasks, where possible, | |
| 59 // components/, chromeos/, device/, etc., code should be used directly. If more | |
| 60 // than one related method is being added, consider adding an additional | |
| 61 // specific delegate (e.g. CastConfigDelegate). | |
| 62 // | |
| 63 // These methods should all have trivial default implementations for platforms | |
| 64 // that do not implement the method (e.g. return false or nullptr). This | |
| 65 // eliminates the need to propagate default implementations across the various | |
| 66 // implementations of this class. Consumers of this delegate should handle the | |
| 67 // default return value (e.g. nullptr). | |
| 68 class ASH_EXPORT SystemTrayDelegate { | |
| 69 public: | |
| 70 SystemTrayDelegate(); | |
| 71 virtual ~SystemTrayDelegate(); | |
| 72 | |
| 73 // Called after SystemTray has been instantiated. | |
| 74 virtual void Initialize(); | |
| 75 | |
| 76 // Gets information about the active user. | |
| 77 virtual LoginStatus GetUserLoginStatus() const; | |
| 78 | |
| 79 // Returns the domain that manages the device, if it is enterprise-enrolled. | |
| 80 virtual std::string GetEnterpriseDomain() const; | |
| 81 | |
| 82 // Returns the realm that manages the device, if it is enterprise enrolled | |
| 83 // with Active Directory and joined the realm (Active Directory domain). | |
| 84 virtual std::string GetEnterpriseRealm() const; | |
| 85 | |
| 86 // Returns notification for enterprise enrolled devices. | |
| 87 virtual base::string16 GetEnterpriseMessage() const; | |
| 88 | |
| 89 // Returns the display email of the user that manages the current supervised | |
| 90 // user. | |
| 91 virtual std::string GetSupervisedUserManager() const; | |
| 92 | |
| 93 // Returns the name of the user that manages the current supervised user. | |
| 94 virtual base::string16 GetSupervisedUserManagerName() const; | |
| 95 | |
| 96 // Returns the notification for supervised users. | |
| 97 virtual base::string16 GetSupervisedUserMessage() const; | |
| 98 | |
| 99 // Returns true if the current user is supervised: has legacy supervised | |
| 100 // account or kid account. | |
| 101 virtual bool IsUserSupervised() const; | |
| 102 | |
| 103 // Returns true if the current user is child. | |
| 104 // TODO(merkulova): remove on FakeUserManager componentization. | |
| 105 // crbug.com/443119 | |
| 106 virtual bool IsUserChild() const; | |
| 107 | |
| 108 // Returns true if settings menu item should appear. | |
| 109 virtual bool ShouldShowSettings() const; | |
| 110 | |
| 111 // Returns true if notification tray should appear. | |
| 112 virtual bool ShouldShowNotificationTray() const; | |
| 113 | |
| 114 // Shows information about enterprise enrolled devices. | |
| 115 virtual void ShowEnterpriseInfo(); | |
| 116 | |
| 117 // Shows login UI to add other users to this session. | |
| 118 virtual void ShowUserLogin(); | |
| 119 | |
| 120 // Returns a list of available bluetooth devices. | |
| 121 virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* devices); | |
| 122 | |
| 123 // Requests bluetooth start discovering devices. | |
| 124 virtual void BluetoothStartDiscovering(); | |
| 125 | |
| 126 // Requests bluetooth stop discovering devices. | |
| 127 virtual void BluetoothStopDiscovering(); | |
| 128 | |
| 129 // Connect to a specific bluetooth device. | |
| 130 virtual void ConnectToBluetoothDevice(const std::string& address); | |
| 131 | |
| 132 // Returns true if bluetooth adapter is discovering bluetooth devices. | |
| 133 virtual bool IsBluetoothDiscovering() const; | |
| 134 | |
| 135 // Returns the currently selected IME. | |
| 136 virtual void GetCurrentIME(IMEInfo* info); | |
| 137 | |
| 138 // Returns a list of availble IMEs. | |
| 139 virtual void GetAvailableIMEList(IMEInfoList* list); | |
| 140 | |
| 141 // Returns a list of properties for the currently selected IME. | |
| 142 virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list); | |
| 143 | |
| 144 // Returns a non-empty string if IMEs are managed by policy. | |
| 145 virtual base::string16 GetIMEManagedMessage(); | |
| 146 | |
| 147 // Switches to the selected input method. | |
| 148 virtual void SwitchIME(const std::string& ime_id); | |
| 149 | |
| 150 // Activates an IME property. | |
| 151 virtual void ActivateIMEProperty(const std::string& key); | |
| 152 | |
| 153 // Shows UI to manage bluetooth devices. | |
| 154 virtual void ManageBluetoothDevices(); | |
| 155 | |
| 156 // Toggles bluetooth. | |
| 157 virtual void ToggleBluetooth(); | |
| 158 | |
| 159 // Returns whether bluetooth capability is available. | |
| 160 virtual bool GetBluetoothAvailable(); | |
| 161 | |
| 162 // Returns whether bluetooth is enabled. | |
| 163 virtual bool GetBluetoothEnabled(); | |
| 164 | |
| 165 // Returns whether the delegate has initiated a bluetooth discovery session. | |
| 166 virtual bool GetBluetoothDiscovering(); | |
| 167 | |
| 168 // Returns NetworkingConfigDelegate. May return nullptr. | |
| 169 virtual NetworkingConfigDelegate* GetNetworkingConfigDelegate() const; | |
| 170 | |
| 171 // Retrieves the session start time. Returns |false| if the time is not set. | |
| 172 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time); | |
| 173 | |
| 174 // Retrieves the session length limit. Returns |false| if no limit is set. | |
| 175 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit); | |
| 176 | |
| 177 // Get the system tray menu size in pixels (dependent on the language). | |
| 178 // This is not used in material design and should be removed during pre-MD | |
| 179 // code cleanup. See https://crbug.com/614453. | |
| 180 virtual int GetSystemTrayMenuWidth(); | |
| 181 | |
| 182 // The active user has been changed. This will be called when the UI is ready | |
| 183 // to be switched to the new user. | |
| 184 // Note: This will happen after SessionStateObserver::ActiveUserChanged fires. | |
| 185 virtual void ActiveUserWasChanged(); | |
| 186 | |
| 187 // Returns true when the Search key is configured to be treated as Caps Lock. | |
| 188 virtual bool IsSearchKeyMappedToCapsLock(); | |
| 189 | |
| 190 // Adding observers that are notified when supervised info is being changed. | |
| 191 virtual void AddCustodianInfoTrayObserver( | |
| 192 CustodianInfoTrayObserver* observer); | |
| 193 | |
| 194 virtual void RemoveCustodianInfoTrayObserver( | |
| 195 CustodianInfoTrayObserver* observer); | |
| 196 | |
| 197 // Creates a system tray item for display rotation lock. | |
| 198 // TODO(jamescook): Remove this when mus has support for display management | |
| 199 // and we have a DisplayManager equivalent. See http://crbug.com/548429 | |
| 200 virtual std::unique_ptr<SystemTrayItem> CreateRotationLockTrayItem( | |
| 201 SystemTray* tray); | |
| 202 }; | |
| 203 | |
| 204 } // namespace ash | |
| 205 | |
| 206 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_DELEGATE_H_ | |
| OLD | NEW |