Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.h

Issue 627593003: Adding infrastructure for possibility of changing manager names for the supervised accounts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Specific observer class introduced. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
18 #include "base/prefs/pref_change_registrar.h" 22 #include "base/prefs/pref_change_registrar.h"
19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 23 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
20 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" 25 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
22 #include "chrome/browser/ui/browser_list_observer.h" 26 #include "chrome/browser/ui/browser_list_observer.h"
23 #include "chromeos/audio/cras_audio_handler.h" 27 #include "chromeos/audio/cras_audio_handler.h"
24 #include "chromeos/dbus/session_manager_client.h" 28 #include "chromeos/dbus/session_manager_client.h"
25 #include "chromeos/ime/input_method_manager.h" 29 #include "chromeos/ime/input_method_manager.h"
26 #include "chromeos/login/login_state.h" 30 #include "chromeos/login/login_state.h"
27 #include "components/policy/core/common/cloud/cloud_policy_store.h" 31 #include "components/policy/core/common/cloud/cloud_policy_store.h"
28 #include "content/public/browser/notification_observer.h" 32 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 33 #include "content/public/browser/notification_registrar.h"
30 #include "device/bluetooth/bluetooth_adapter.h" 34 #include "device/bluetooth/bluetooth_adapter.h"
31 #include "device/bluetooth/bluetooth_discovery_session.h" 35 #include "device/bluetooth/bluetooth_discovery_session.h"
32 #include "extensions/browser/app_window/app_window_registry.h" 36 #include "extensions/browser/app_window/app_window_registry.h"
33 37
34 namespace chromeos { 38 namespace chromeos {
35 39
36 class SystemTrayDelegateChromeOS 40 class SystemTrayDelegateChromeOS
37 : public ash::ime::InputMethodMenuManager::Observer, 41 : public ash::ime::InputMethodMenuManager::Observer,
38 public ash::SystemTrayDelegate, 42 public ash::SystemTrayDelegate,
39 public SessionManagerClient::Observer, 43 public SessionManagerClient::Observer,
40 public content::NotificationObserver, 44 public content::NotificationObserver,
41 public input_method::InputMethodManager::Observer, 45 public input_method::InputMethodManager::Observer,
42 public chromeos::LoginState::Observer, 46 public chromeos::LoginState::Observer,
43 public chromeos::CrasAudioHandler::AudioObserver, 47 public chromeos::CrasAudioHandler::AudioObserver,
44 public device::BluetoothAdapter::Observer, 48 public device::BluetoothAdapter::Observer,
45 public policy::CloudPolicyStore::Observer, 49 public policy::CloudPolicyStore::Observer,
46 public ash::SessionStateObserver, 50 public ash::SessionStateObserver,
47 public chrome::BrowserListObserver, 51 public chrome::BrowserListObserver,
48 public extensions::AppWindowRegistry::Observer { 52 public extensions::AppWindowRegistry::Observer,
53 public SupervisedUserServiceObserver {
49 public: 54 public:
50 SystemTrayDelegateChromeOS(); 55 SystemTrayDelegateChromeOS();
51 56
52 virtual ~SystemTrayDelegateChromeOS(); 57 virtual ~SystemTrayDelegateChromeOS();
53 58
54 void InitializeOnAdapterReady( 59 void InitializeOnAdapterReady(
55 scoped_refptr<device::BluetoothAdapter> adapter); 60 scoped_refptr<device::BluetoothAdapter> adapter);
56 61
57 // Overridden from ash::SystemTrayDelegate: 62 // Overridden from ash::SystemTrayDelegate:
58 virtual void Initialize() OVERRIDE; 63 virtual void Initialize() OVERRIDE;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 scoped_ptr<ash::VolumeControlDelegate> delegate) OVERRIDE; 124 scoped_ptr<ash::VolumeControlDelegate> delegate) OVERRIDE;
120 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) 125 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time)
121 OVERRIDE; 126 OVERRIDE;
122 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) 127 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit)
123 OVERRIDE; 128 OVERRIDE;
124 virtual int GetSystemTrayMenuWidth() OVERRIDE; 129 virtual int GetSystemTrayMenuWidth() OVERRIDE;
125 virtual void ActiveUserWasChanged() OVERRIDE; 130 virtual void ActiveUserWasChanged() OVERRIDE;
126 virtual bool IsSearchKeyMappedToCapsLock() OVERRIDE; 131 virtual bool IsSearchKeyMappedToCapsLock() OVERRIDE;
127 virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( 132 virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate(
128 const std::string& user_id) OVERRIDE; 133 const std::string& user_id) OVERRIDE;
134 virtual void AddCustodianInfoChangedObserver(
135 base::WeakPtr<CustodianInfoTrayObserver> observer) OVERRIDE;
129 136
130 // browser tests need to call ShouldUse24HourClock(). 137 // browser tests need to call ShouldUse24HourClock().
131 bool GetShouldUse24HourClockForTesting() const; 138 bool GetShouldUse24HourClockForTesting() const;
132 139
133 private: 140 private:
134 // Should be the same as CrosSettings::ObserverSubscription. 141 // Should be the same as CrosSettings::ObserverSubscription.
135 typedef base::CallbackList<void(void)>::Subscription 142 typedef base::CallbackList<void(void)>::Subscription
136 CrosSettingsObserverSubscription; 143 CrosSettingsObserverSubscription;
137 144
138 ash::SystemTray* GetPrimarySystemTray(); 145 ash::SystemTray* GetPrimarySystemTray();
(...skipping 11 matching lines...) Expand all
150 void UpdateShowLogoutButtonInTray(); 157 void UpdateShowLogoutButtonInTray();
151 158
152 void UpdateLogoutDialogDuration(); 159 void UpdateLogoutDialogDuration();
153 160
154 void UpdateSessionStartTime(); 161 void UpdateSessionStartTime();
155 162
156 void UpdateSessionLengthLimit(); 163 void UpdateSessionLengthLimit();
157 164
158 void StopObservingAppWindowRegistry(); 165 void StopObservingAppWindowRegistry();
159 166
167 void StopObservingCustodianInfoChanges();
168
160 // Notify observers if the current user has no more open browser or app 169 // Notify observers if the current user has no more open browser or app
161 // windows. 170 // windows.
162 void NotifyIfLastWindowClosed(); 171 void NotifyIfLastWindowClosed();
163 172
164 // LoginState::Observer overrides. 173 // LoginState::Observer overrides.
165 virtual void LoggedInStateChanged() OVERRIDE; 174 virtual void LoggedInStateChanged() OVERRIDE;
166 175
167 // Overridden from SessionManagerClient::Observer. 176 // Overridden from SessionManagerClient::Observer.
168 virtual void ScreenIsLocked() OVERRIDE; 177 virtual void ScreenIsLocked() OVERRIDE;
169 virtual void ScreenIsUnlocked() OVERRIDE; 178 virtual void ScreenIsUnlocked() OVERRIDE;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 233
225 // Overridden from ash::SessionStateObserver 234 // Overridden from ash::SessionStateObserver
226 virtual void UserAddedToSession(const std::string& user_id) OVERRIDE; 235 virtual void UserAddedToSession(const std::string& user_id) OVERRIDE;
227 236
228 // Overridden from chrome::BrowserListObserver: 237 // Overridden from chrome::BrowserListObserver:
229 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; 238 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
230 239
231 // Overridden from extensions::AppWindowRegistry::Observer: 240 // Overridden from extensions::AppWindowRegistry::Observer:
232 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE; 241 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE;
233 242
243 // Overridden from SupervisedUserServiceObserver:
244 virtual void OnCustodianInfoChanged() OVERRIDE;
245
234 void OnAccessibilityStatusChanged( 246 void OnAccessibilityStatusChanged(
235 const AccessibilityStatusEventDetails& details); 247 const AccessibilityStatusEventDetails& details);
236 248
237 scoped_ptr<content::NotificationRegistrar> registrar_; 249 scoped_ptr<content::NotificationRegistrar> registrar_;
238 scoped_ptr<PrefChangeRegistrar> local_state_registrar_; 250 scoped_ptr<PrefChangeRegistrar> local_state_registrar_;
239 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; 251 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_;
240 Profile* user_profile_; 252 Profile* user_profile_;
241 base::HourClockType clock_type_; 253 base::HourClockType clock_type_;
242 int search_key_mapped_to_; 254 int search_key_mapped_to_;
243 bool screen_locked_; 255 bool screen_locked_;
244 bool have_session_start_time_; 256 bool have_session_start_time_;
245 base::TimeTicks session_start_time_; 257 base::TimeTicks session_start_time_;
246 bool have_session_length_limit_; 258 bool have_session_length_limit_;
247 base::TimeDelta session_length_limit_; 259 base::TimeDelta session_length_limit_;
248 std::string enterprise_domain_; 260 std::string enterprise_domain_;
249 bool should_run_bluetooth_discovery_; 261 bool should_run_bluetooth_discovery_;
250 262
251 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; 263 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
252 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_; 264 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_;
253 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; 265 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_;
254 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_; 266 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_;
255 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; 267 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
256 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate> 268 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate>
257 accounts_delegates_; 269 accounts_delegates_;
258 270
271 std::vector<base::WeakPtr<CustodianInfoTrayObserver>>
272 custodian_info_changed_observers_;
273
259 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; 274 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_;
260 275
261 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); 276 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS);
262 }; 277 };
263 278
264 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); 279 ash::SystemTrayDelegate* CreateSystemTrayDelegate();
265 280
266 } // namespace chromeos 281 } // namespace chromeos
267 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ 282 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698