Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/common/accessibility_types.h" | 14 #include "ash/common/accessibility_types.h" |
| 15 #include "ash/common/system/chromeos/supervised/custodian_info_tray_observer.h" | 15 #include "ash/common/system/chromeos/supervised/custodian_info_tray_observer.h" |
| 16 #include "ash/common/system/tray/ime_info.h" | 16 #include "ash/common/system/tray/ime_info.h" |
| 17 #include "ash/common/system/tray/system_tray_delegate.h" | 17 #include "ash/common/system/tray/system_tray_delegate.h" |
| 18 #include "base/callback_forward.h" | 18 #include "base/callback_forward.h" |
| 19 #include "base/callback_list.h" | 19 #include "base/callback_list.h" |
| 20 #include "base/compiler_specific.h" | |
| 21 #include "base/macros.h" | 20 #include "base/macros.h" |
| 22 #include "base/memory/ref_counted.h" | |
| 23 #include "base/memory/weak_ptr.h" | |
| 24 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
| 25 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 22 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | 24 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
| 28 #include "chrome/browser/ui/browser_list_observer.h" | 25 #include "chrome/browser/ui/browser_list_observer.h" |
| 29 #include "chromeos/dbus/session_manager_client.h" | 26 #include "chromeos/dbus/session_manager_client.h" |
| 30 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 27 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 31 #include "components/prefs/pref_change_registrar.h" | 28 #include "components/prefs/pref_change_registrar.h" |
| 32 #include "components/signin/core/account_id/account_id.h" | 29 #include "components/signin/core/account_id/account_id.h" |
| 33 #include "components/user_manager/user_manager.h" | 30 #include "components/user_manager/user_manager.h" |
| 34 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
| 35 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
| 36 #include "device/bluetooth/bluetooth_adapter.h" | |
| 37 #include "device/bluetooth/bluetooth_discovery_session.h" | |
| 38 #include "extensions/browser/app_window/app_window_registry.h" | 33 #include "extensions/browser/app_window/app_window_registry.h" |
| 39 #include "ui/base/ime/chromeos/ime_keyboard.h" | 34 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 40 #include "ui/base/ime/chromeos/input_method_manager.h" | 35 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 41 #include "ui/chromeos/ime/input_method_menu_manager.h" | 36 #include "ui/chromeos/ime/input_method_menu_manager.h" |
| 42 | 37 |
| 43 namespace ash { | 38 namespace ash { |
| 44 class SystemTrayNotifier; | 39 class SystemTrayNotifier; |
| 45 } | 40 } |
| 46 | 41 |
| 47 namespace user_manager { | 42 namespace user_manager { |
| 48 class User; | 43 class User; |
| 49 } | 44 } |
| 50 | 45 |
| 46 class TrayBluetoothHelper; | |
| 47 | |
| 51 namespace chromeos { | 48 namespace chromeos { |
| 52 | 49 |
| 53 class SystemTrayDelegateChromeOS | 50 class SystemTrayDelegateChromeOS |
| 54 : public ui::ime::InputMethodMenuManager::Observer, | 51 : public ui::ime::InputMethodMenuManager::Observer, |
| 55 public ash::SystemTrayDelegate, | 52 public ash::SystemTrayDelegate, |
| 56 public SessionManagerClient::Observer, | 53 public SessionManagerClient::Observer, |
| 57 public content::NotificationObserver, | 54 public content::NotificationObserver, |
| 58 public input_method::InputMethodManager::Observer, | 55 public input_method::InputMethodManager::Observer, |
| 59 public device::BluetoothAdapter::Observer, | |
| 60 public policy::CloudPolicyStore::Observer, | 56 public policy::CloudPolicyStore::Observer, |
| 61 public chrome::BrowserListObserver, | 57 public chrome::BrowserListObserver, |
| 62 public extensions::AppWindowRegistry::Observer, | 58 public extensions::AppWindowRegistry::Observer, |
| 63 public user_manager::UserManager::Observer, | 59 public user_manager::UserManager::Observer, |
| 64 public user_manager::UserManager::UserSessionStateObserver, | 60 public user_manager::UserManager::UserSessionStateObserver, |
| 65 public SupervisedUserServiceObserver, | 61 public SupervisedUserServiceObserver, |
| 66 public input_method::InputMethodManager::ImeMenuObserver { | 62 public input_method::InputMethodManager::ImeMenuObserver { |
| 67 public: | 63 public: |
| 68 SystemTrayDelegateChromeOS(); | 64 SystemTrayDelegateChromeOS(); |
| 69 | 65 |
| 70 ~SystemTrayDelegateChromeOS() override; | 66 ~SystemTrayDelegateChromeOS() override; |
| 71 | 67 |
| 72 void InitializeOnAdapterReady( | 68 // Completes initialization after the Bluetooth adapter is ready. |
| 73 scoped_refptr<device::BluetoothAdapter> adapter); | 69 // TODO: Eliminate this in favor of Initialize(). |
| 70 void InitializeOnAdapterReady(); | |
| 74 | 71 |
| 75 // Overridden from ash::SystemTrayDelegate: | 72 // Overridden from ash::SystemTrayDelegate: |
| 76 void Initialize() override; | 73 void Initialize() override; |
| 77 ash::LoginStatus GetUserLoginStatus() const override; | 74 ash::LoginStatus GetUserLoginStatus() const override; |
| 78 std::string GetEnterpriseDomain() const override; | 75 std::string GetEnterpriseDomain() const override; |
| 79 base::string16 GetEnterpriseMessage() const override; | 76 base::string16 GetEnterpriseMessage() const override; |
| 80 std::string GetSupervisedUserManager() const override; | 77 std::string GetSupervisedUserManager() const override; |
| 81 base::string16 GetSupervisedUserManagerName() const override; | 78 base::string16 GetSupervisedUserManagerName() const override; |
| 82 base::string16 GetSupervisedUserMessage() const override; | 79 base::string16 GetSupervisedUserMessage() const override; |
| 83 bool IsUserSupervised() const override; | 80 bool IsUserSupervised() const override; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 162 |
| 166 // Overridden from InputMethodManager::Observer. | 163 // Overridden from InputMethodManager::Observer. |
| 167 void InputMethodChanged(input_method::InputMethodManager* manager, | 164 void InputMethodChanged(input_method::InputMethodManager* manager, |
| 168 Profile* profile, | 165 Profile* profile, |
| 169 bool show_message) override; | 166 bool show_message) override; |
| 170 | 167 |
| 171 // Overridden from InputMethodMenuManager::Observer. | 168 // Overridden from InputMethodMenuManager::Observer. |
| 172 void InputMethodMenuItemChanged( | 169 void InputMethodMenuItemChanged( |
| 173 ui::ime::InputMethodMenuManager* manager) override; | 170 ui::ime::InputMethodMenuManager* manager) override; |
| 174 | 171 |
| 175 // Overridden from BluetoothAdapter::Observer. | |
| 176 void AdapterPresentChanged(device::BluetoothAdapter* adapter, | |
| 177 bool present) override; | |
| 178 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | |
| 179 bool powered) override; | |
| 180 void AdapterDiscoveringChanged(device::BluetoothAdapter* adapter, | |
| 181 bool discovering) override; | |
| 182 void DeviceAdded(device::BluetoothAdapter* adapter, | |
| 183 device::BluetoothDevice* device) override; | |
| 184 void DeviceChanged(device::BluetoothAdapter* adapter, | |
| 185 device::BluetoothDevice* device) override; | |
| 186 void DeviceRemoved(device::BluetoothAdapter* adapter, | |
| 187 device::BluetoothDevice* device) override; | |
| 188 | |
| 189 void OnStartBluetoothDiscoverySession( | |
| 190 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session); | |
| 191 | |
| 192 void UpdateEnterpriseDomain(); | 172 void UpdateEnterpriseDomain(); |
| 193 | 173 |
| 194 // Overridden from CloudPolicyStore::Observer | 174 // Overridden from CloudPolicyStore::Observer |
| 195 void OnStoreLoaded(policy::CloudPolicyStore* store) override; | 175 void OnStoreLoaded(policy::CloudPolicyStore* store) override; |
| 196 void OnStoreError(policy::CloudPolicyStore* store) override; | 176 void OnStoreError(policy::CloudPolicyStore* store) override; |
| 197 | 177 |
| 198 // Overridden from chrome::BrowserListObserver: | 178 // Overridden from chrome::BrowserListObserver: |
| 199 void OnBrowserRemoved(Browser* browser) override; | 179 void OnBrowserRemoved(Browser* browser) override; |
| 200 | 180 |
| 201 // Overridden from extensions::AppWindowRegistry::Observer: | 181 // Overridden from extensions::AppWindowRegistry::Observer: |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 223 std::unique_ptr<PrefChangeRegistrar> local_state_registrar_; | 203 std::unique_ptr<PrefChangeRegistrar> local_state_registrar_; |
| 224 std::unique_ptr<PrefChangeRegistrar> user_pref_registrar_; | 204 std::unique_ptr<PrefChangeRegistrar> user_pref_registrar_; |
| 225 Profile* user_profile_ = nullptr; | 205 Profile* user_profile_ = nullptr; |
| 226 int search_key_mapped_to_ = input_method::kSearchKey; | 206 int search_key_mapped_to_ = input_method::kSearchKey; |
| 227 bool have_session_start_time_ = false; | 207 bool have_session_start_time_ = false; |
| 228 base::TimeTicks session_start_time_; | 208 base::TimeTicks session_start_time_; |
| 229 bool have_session_length_limit_ = false; | 209 bool have_session_length_limit_ = false; |
| 230 base::TimeDelta session_length_limit_; | 210 base::TimeDelta session_length_limit_; |
| 231 std::string enterprise_domain_; | 211 std::string enterprise_domain_; |
| 232 bool is_active_directory_managed_ = false; | 212 bool is_active_directory_managed_ = false; |
| 233 bool should_run_bluetooth_discovery_ = false; | |
| 234 bool session_started_ = false; | 213 bool session_started_ = false; |
| 235 | 214 |
| 236 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 215 // TODO: Move into //ash. |
|
msw
2017/03/17 00:11:05
nit: cite a bug?
James Cook
2017/03/17 04:02:57
Done.
| |
| 237 std::unique_ptr<device::BluetoothDiscoverySession> | 216 std::unique_ptr<TrayBluetoothHelper> bluetooth_helper_; |
| 238 bluetooth_discovery_session_; | 217 |
| 239 std::unique_ptr<ash::NetworkingConfigDelegate> networking_config_delegate_; | 218 std::unique_ptr<ash::NetworkingConfigDelegate> networking_config_delegate_; |
| 240 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 219 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
| 241 | 220 |
| 242 base::ObserverList<ash::CustodianInfoTrayObserver> | 221 base::ObserverList<ash::CustodianInfoTrayObserver> |
| 243 custodian_info_changed_observers_; | 222 custodian_info_changed_observers_; |
| 244 | 223 |
| 245 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; | |
| 246 | |
| 247 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); | 224 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); |
| 248 }; | 225 }; |
| 249 | 226 |
| 250 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); | 227 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); |
| 251 | 228 |
| 252 } // namespace chromeos | 229 } // namespace chromeos |
| 253 | 230 |
| 254 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 231 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| OLD | NEW |