| 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 <vector> |
| 9 |
| 8 #include "ash/ime/input_method_menu_manager.h" | 10 #include "ash/ime/input_method_menu_manager.h" |
| 9 #include "ash/session/session_state_observer.h" | 11 #include "ash/session/session_state_observer.h" |
| 12 #include "ash/system/chromeos/supervised/custodian_info_tray_observer.h" |
| 10 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/system/tray/system_tray_notifier.h" | 15 #include "ash/system/tray/system_tray_notifier.h" |
| 16 #include "base/callback_forward.h" |
| 13 #include "base/callback_list.h" | 17 #include "base/callback_list.h" |
| 14 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 15 #include "base/containers/scoped_ptr_hash_map.h" | 19 #include "base/containers/scoped_ptr_hash_map.h" |
| 16 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/observer_list.h" |
| 18 #include "base/prefs/pref_change_registrar.h" | 23 #include "base/prefs/pref_change_registrar.h" |
| 19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 24 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 26 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
| 22 #include "chrome/browser/ui/browser_list_observer.h" | 27 #include "chrome/browser/ui/browser_list_observer.h" |
| 23 #include "chromeos/audio/cras_audio_handler.h" | 28 #include "chromeos/audio/cras_audio_handler.h" |
| 24 #include "chromeos/dbus/session_manager_client.h" | 29 #include "chromeos/dbus/session_manager_client.h" |
| 25 #include "chromeos/ime/input_method_manager.h" | 30 #include "chromeos/ime/input_method_manager.h" |
| 26 #include "chromeos/login/login_state.h" | 31 #include "chromeos/login/login_state.h" |
| 27 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 32 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 28 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
| 29 #include "content/public/browser/notification_observer.h" | 34 #include "content/public/browser/notification_observer.h" |
| 30 #include "content/public/browser/notification_registrar.h" | 35 #include "content/public/browser/notification_registrar.h" |
| 31 #include "device/bluetooth/bluetooth_adapter.h" | 36 #include "device/bluetooth/bluetooth_adapter.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 public SessionManagerClient::Observer, | 49 public SessionManagerClient::Observer, |
| 45 public content::NotificationObserver, | 50 public content::NotificationObserver, |
| 46 public input_method::InputMethodManager::Observer, | 51 public input_method::InputMethodManager::Observer, |
| 47 public chromeos::LoginState::Observer, | 52 public chromeos::LoginState::Observer, |
| 48 public chromeos::CrasAudioHandler::AudioObserver, | 53 public chromeos::CrasAudioHandler::AudioObserver, |
| 49 public device::BluetoothAdapter::Observer, | 54 public device::BluetoothAdapter::Observer, |
| 50 public policy::CloudPolicyStore::Observer, | 55 public policy::CloudPolicyStore::Observer, |
| 51 public ash::SessionStateObserver, | 56 public ash::SessionStateObserver, |
| 52 public chrome::BrowserListObserver, | 57 public chrome::BrowserListObserver, |
| 53 public extensions::AppWindowRegistry::Observer, | 58 public extensions::AppWindowRegistry::Observer, |
| 54 public user_manager::UserManager::UserSessionStateObserver { | 59 public user_manager::UserManager::UserSessionStateObserver, |
| 60 public SupervisedUserServiceObserver { |
| 55 public: | 61 public: |
| 56 SystemTrayDelegateChromeOS(); | 62 SystemTrayDelegateChromeOS(); |
| 57 | 63 |
| 58 virtual ~SystemTrayDelegateChromeOS(); | 64 virtual ~SystemTrayDelegateChromeOS(); |
| 59 | 65 |
| 60 void InitializeOnAdapterReady( | 66 void InitializeOnAdapterReady( |
| 61 scoped_refptr<device::BluetoothAdapter> adapter); | 67 scoped_refptr<device::BluetoothAdapter> adapter); |
| 62 | 68 |
| 63 // Overridden from ash::SystemTrayDelegate: | 69 // Overridden from ash::SystemTrayDelegate: |
| 64 virtual void Initialize() override; | 70 virtual void Initialize() override; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 scoped_ptr<ash::VolumeControlDelegate> delegate) override; | 131 scoped_ptr<ash::VolumeControlDelegate> delegate) override; |
| 126 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) | 132 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) |
| 127 override; | 133 override; |
| 128 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) | 134 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) |
| 129 override; | 135 override; |
| 130 virtual int GetSystemTrayMenuWidth() override; | 136 virtual int GetSystemTrayMenuWidth() override; |
| 131 virtual void ActiveUserWasChanged() override; | 137 virtual void ActiveUserWasChanged() override; |
| 132 virtual bool IsSearchKeyMappedToCapsLock() override; | 138 virtual bool IsSearchKeyMappedToCapsLock() override; |
| 133 virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( | 139 virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( |
| 134 const std::string& user_id) override; | 140 const std::string& user_id) override; |
| 141 virtual void AddCustodianInfoTrayObserver( |
| 142 ash::CustodianInfoTrayObserver* observer) override; |
| 143 virtual void RemoveCustodianInfoTrayObserver( |
| 144 ash::CustodianInfoTrayObserver* observer) override; |
| 135 | 145 |
| 136 // Overridden from user_manager::UserManager::UserSessionStateObserver: | 146 // Overridden from user_manager::UserManager::UserSessionStateObserver: |
| 137 virtual void UserAddedToSession(const user_manager::User* active_user) | 147 virtual void UserAddedToSession(const user_manager::User* active_user) |
| 138 override; | 148 override; |
| 139 | 149 |
| 140 virtual void UserChangedSupervisedStatus( | 150 virtual void UserChangedSupervisedStatus( |
| 141 user_manager::User* user) override; | 151 user_manager::User* user) override; |
| 142 | 152 |
| 143 // browser tests need to call ShouldUse24HourClock(). | 153 // browser tests need to call ShouldUse24HourClock(). |
| 144 bool GetShouldUse24HourClockForTesting() const; | 154 bool GetShouldUse24HourClockForTesting() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 163 void UpdateShowLogoutButtonInTray(); | 173 void UpdateShowLogoutButtonInTray(); |
| 164 | 174 |
| 165 void UpdateLogoutDialogDuration(); | 175 void UpdateLogoutDialogDuration(); |
| 166 | 176 |
| 167 void UpdateSessionStartTime(); | 177 void UpdateSessionStartTime(); |
| 168 | 178 |
| 169 void UpdateSessionLengthLimit(); | 179 void UpdateSessionLengthLimit(); |
| 170 | 180 |
| 171 void StopObservingAppWindowRegistry(); | 181 void StopObservingAppWindowRegistry(); |
| 172 | 182 |
| 183 void StopObservingCustodianInfoChanges(); |
| 184 |
| 173 // Notify observers if the current user has no more open browser or app | 185 // Notify observers if the current user has no more open browser or app |
| 174 // windows. | 186 // windows. |
| 175 void NotifyIfLastWindowClosed(); | 187 void NotifyIfLastWindowClosed(); |
| 176 | 188 |
| 177 // LoginState::Observer overrides. | 189 // LoginState::Observer overrides. |
| 178 virtual void LoggedInStateChanged() override; | 190 virtual void LoggedInStateChanged() override; |
| 179 | 191 |
| 180 // Overridden from SessionManagerClient::Observer. | 192 // Overridden from SessionManagerClient::Observer. |
| 181 virtual void ScreenIsLocked() override; | 193 virtual void ScreenIsLocked() override; |
| 182 virtual void ScreenIsUnlocked() override; | 194 virtual void ScreenIsUnlocked() override; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 249 |
| 238 // Overridden from ash::SessionStateObserver | 250 // Overridden from ash::SessionStateObserver |
| 239 virtual void UserAddedToSession(const std::string& user_id) override; | 251 virtual void UserAddedToSession(const std::string& user_id) override; |
| 240 | 252 |
| 241 // Overridden from chrome::BrowserListObserver: | 253 // Overridden from chrome::BrowserListObserver: |
| 242 virtual void OnBrowserRemoved(Browser* browser) override; | 254 virtual void OnBrowserRemoved(Browser* browser) override; |
| 243 | 255 |
| 244 // Overridden from extensions::AppWindowRegistry::Observer: | 256 // Overridden from extensions::AppWindowRegistry::Observer: |
| 245 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) override; | 257 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) override; |
| 246 | 258 |
| 259 // Overridden from SupervisedUserServiceObserver: |
| 260 virtual void OnCustodianInfoChanged() override; |
| 261 |
| 247 void OnAccessibilityStatusChanged( | 262 void OnAccessibilityStatusChanged( |
| 248 const AccessibilityStatusEventDetails& details); | 263 const AccessibilityStatusEventDetails& details); |
| 249 | 264 |
| 250 scoped_ptr<content::NotificationRegistrar> registrar_; | 265 scoped_ptr<content::NotificationRegistrar> registrar_; |
| 251 scoped_ptr<PrefChangeRegistrar> local_state_registrar_; | 266 scoped_ptr<PrefChangeRegistrar> local_state_registrar_; |
| 252 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; | 267 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; |
| 253 Profile* user_profile_; | 268 Profile* user_profile_; |
| 254 base::HourClockType clock_type_; | 269 base::HourClockType clock_type_; |
| 255 int search_key_mapped_to_; | 270 int search_key_mapped_to_; |
| 256 bool screen_locked_; | 271 bool screen_locked_; |
| 257 bool have_session_start_time_; | 272 bool have_session_start_time_; |
| 258 base::TimeTicks session_start_time_; | 273 base::TimeTicks session_start_time_; |
| 259 bool have_session_length_limit_; | 274 bool have_session_length_limit_; |
| 260 base::TimeDelta session_length_limit_; | 275 base::TimeDelta session_length_limit_; |
| 261 std::string enterprise_domain_; | 276 std::string enterprise_domain_; |
| 262 bool should_run_bluetooth_discovery_; | 277 bool should_run_bluetooth_discovery_; |
| 263 bool session_started_; | 278 bool session_started_; |
| 264 | 279 |
| 265 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 280 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |
| 266 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_; | 281 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_; |
| 267 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; | 282 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; |
| 268 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_; | 283 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_; |
| 269 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 284 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
| 270 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate> | 285 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate> |
| 271 accounts_delegates_; | 286 accounts_delegates_; |
| 272 | 287 |
| 288 ObserverList<ash::CustodianInfoTrayObserver> |
| 289 custodian_info_changed_observers_; |
| 290 |
| 273 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; | 291 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; |
| 274 | 292 |
| 275 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); | 293 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); |
| 276 }; | 294 }; |
| 277 | 295 |
| 278 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); | 296 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); |
| 279 | 297 |
| 280 } // namespace chromeos | 298 } // namespace chromeos |
| 281 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ | 299 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ |
| OLD | NEW |