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

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: Weak pointers removed. 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"
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 "content/public/browser/notification_observer.h" 33 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 34 #include "content/public/browser/notification_registrar.h"
30 #include "device/bluetooth/bluetooth_adapter.h" 35 #include "device/bluetooth/bluetooth_adapter.h"
31 #include "device/bluetooth/bluetooth_discovery_session.h" 36 #include "device/bluetooth/bluetooth_discovery_session.h"
32 #include "extensions/browser/app_window/app_window_registry.h" 37 #include "extensions/browser/app_window/app_window_registry.h"
33 38
34 namespace chromeos { 39 namespace chromeos {
35 40
36 class SystemTrayDelegateChromeOS 41 class SystemTrayDelegateChromeOS
37 : public ash::ime::InputMethodMenuManager::Observer, 42 : public ash::ime::InputMethodMenuManager::Observer,
38 public ash::SystemTrayDelegate, 43 public ash::SystemTrayDelegate,
39 public SessionManagerClient::Observer, 44 public SessionManagerClient::Observer,
40 public content::NotificationObserver, 45 public content::NotificationObserver,
41 public input_method::InputMethodManager::Observer, 46 public input_method::InputMethodManager::Observer,
42 public chromeos::LoginState::Observer, 47 public chromeos::LoginState::Observer,
43 public chromeos::CrasAudioHandler::AudioObserver, 48 public chromeos::CrasAudioHandler::AudioObserver,
44 public device::BluetoothAdapter::Observer, 49 public device::BluetoothAdapter::Observer,
45 public policy::CloudPolicyStore::Observer, 50 public policy::CloudPolicyStore::Observer,
46 public ash::SessionStateObserver, 51 public ash::SessionStateObserver,
47 public chrome::BrowserListObserver, 52 public chrome::BrowserListObserver,
48 public extensions::AppWindowRegistry::Observer { 53 public extensions::AppWindowRegistry::Observer,
54 public SupervisedUserServiceObserver {
49 public: 55 public:
50 SystemTrayDelegateChromeOS(); 56 SystemTrayDelegateChromeOS();
51 57
52 virtual ~SystemTrayDelegateChromeOS(); 58 virtual ~SystemTrayDelegateChromeOS();
53 59
54 void InitializeOnAdapterReady( 60 void InitializeOnAdapterReady(
55 scoped_refptr<device::BluetoothAdapter> adapter); 61 scoped_refptr<device::BluetoothAdapter> adapter);
56 62
57 // Overridden from ash::SystemTrayDelegate: 63 // Overridden from ash::SystemTrayDelegate:
58 virtual void Initialize() OVERRIDE; 64 virtual void Initialize() OVERRIDE;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 scoped_ptr<ash::VolumeControlDelegate> delegate) OVERRIDE; 125 scoped_ptr<ash::VolumeControlDelegate> delegate) OVERRIDE;
120 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time) 126 virtual bool GetSessionStartTime(base::TimeTicks* session_start_time)
121 OVERRIDE; 127 OVERRIDE;
122 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) 128 virtual bool GetSessionLengthLimit(base::TimeDelta* session_length_limit)
123 OVERRIDE; 129 OVERRIDE;
124 virtual int GetSystemTrayMenuWidth() OVERRIDE; 130 virtual int GetSystemTrayMenuWidth() OVERRIDE;
125 virtual void ActiveUserWasChanged() OVERRIDE; 131 virtual void ActiveUserWasChanged() OVERRIDE;
126 virtual bool IsSearchKeyMappedToCapsLock() OVERRIDE; 132 virtual bool IsSearchKeyMappedToCapsLock() OVERRIDE;
127 virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( 133 virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate(
128 const std::string& user_id) OVERRIDE; 134 const std::string& user_id) OVERRIDE;
135 virtual void AddObserver(ash::CustodianInfoTrayObserver* observer) OVERRIDE;
Daniel Erat 2014/10/07 16:16:00 nit: rename these to AddCustodianInfoTrayObserver
merkulova 2014/10/08 09:19:37 Done.
136 virtual void RemoveObserver(
137 ash::CustodianInfoTrayObserver* observer) OVERRIDE;
129 138
130 // browser tests need to call ShouldUse24HourClock(). 139 // browser tests need to call ShouldUse24HourClock().
131 bool GetShouldUse24HourClockForTesting() const; 140 bool GetShouldUse24HourClockForTesting() const;
132 141
133 private: 142 private:
134 // Should be the same as CrosSettings::ObserverSubscription. 143 // Should be the same as CrosSettings::ObserverSubscription.
135 typedef base::CallbackList<void(void)>::Subscription 144 typedef base::CallbackList<void(void)>::Subscription
136 CrosSettingsObserverSubscription; 145 CrosSettingsObserverSubscription;
137 146
138 ash::SystemTray* GetPrimarySystemTray(); 147 ash::SystemTray* GetPrimarySystemTray();
(...skipping 11 matching lines...) Expand all
150 void UpdateShowLogoutButtonInTray(); 159 void UpdateShowLogoutButtonInTray();
151 160
152 void UpdateLogoutDialogDuration(); 161 void UpdateLogoutDialogDuration();
153 162
154 void UpdateSessionStartTime(); 163 void UpdateSessionStartTime();
155 164
156 void UpdateSessionLengthLimit(); 165 void UpdateSessionLengthLimit();
157 166
158 void StopObservingAppWindowRegistry(); 167 void StopObservingAppWindowRegistry();
159 168
169 void StopObservingCustodianInfoChanges();
170
160 // Notify observers if the current user has no more open browser or app 171 // Notify observers if the current user has no more open browser or app
161 // windows. 172 // windows.
162 void NotifyIfLastWindowClosed(); 173 void NotifyIfLastWindowClosed();
163 174
164 // LoginState::Observer overrides. 175 // LoginState::Observer overrides.
165 virtual void LoggedInStateChanged() OVERRIDE; 176 virtual void LoggedInStateChanged() OVERRIDE;
166 177
167 // Overridden from SessionManagerClient::Observer. 178 // Overridden from SessionManagerClient::Observer.
168 virtual void ScreenIsLocked() OVERRIDE; 179 virtual void ScreenIsLocked() OVERRIDE;
169 virtual void ScreenIsUnlocked() OVERRIDE; 180 virtual void ScreenIsUnlocked() OVERRIDE;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 235
225 // Overridden from ash::SessionStateObserver 236 // Overridden from ash::SessionStateObserver
226 virtual void UserAddedToSession(const std::string& user_id) OVERRIDE; 237 virtual void UserAddedToSession(const std::string& user_id) OVERRIDE;
227 238
228 // Overridden from chrome::BrowserListObserver: 239 // Overridden from chrome::BrowserListObserver:
229 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; 240 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE;
230 241
231 // Overridden from extensions::AppWindowRegistry::Observer: 242 // Overridden from extensions::AppWindowRegistry::Observer:
232 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE; 243 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE;
233 244
245 // Overridden from SupervisedUserServiceObserver:
246 virtual void OnCustodianInfoChanged() OVERRIDE;
247
234 void OnAccessibilityStatusChanged( 248 void OnAccessibilityStatusChanged(
235 const AccessibilityStatusEventDetails& details); 249 const AccessibilityStatusEventDetails& details);
236 250
237 scoped_ptr<content::NotificationRegistrar> registrar_; 251 scoped_ptr<content::NotificationRegistrar> registrar_;
238 scoped_ptr<PrefChangeRegistrar> local_state_registrar_; 252 scoped_ptr<PrefChangeRegistrar> local_state_registrar_;
239 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; 253 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_;
240 Profile* user_profile_; 254 Profile* user_profile_;
241 base::HourClockType clock_type_; 255 base::HourClockType clock_type_;
242 int search_key_mapped_to_; 256 int search_key_mapped_to_;
243 bool screen_locked_; 257 bool screen_locked_;
244 bool have_session_start_time_; 258 bool have_session_start_time_;
245 base::TimeTicks session_start_time_; 259 base::TimeTicks session_start_time_;
246 bool have_session_length_limit_; 260 bool have_session_length_limit_;
247 base::TimeDelta session_length_limit_; 261 base::TimeDelta session_length_limit_;
248 std::string enterprise_domain_; 262 std::string enterprise_domain_;
249 bool should_run_bluetooth_discovery_; 263 bool should_run_bluetooth_discovery_;
250 264
251 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; 265 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
252 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_; 266 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_;
253 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; 267 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_;
254 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_; 268 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_;
255 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; 269 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
256 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate> 270 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate>
257 accounts_delegates_; 271 accounts_delegates_;
258 272
273 ObserverList<ash::CustodianInfoTrayObserver>
274 custodian_info_changed_observers_;
275
259 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; 276 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_;
260 277
261 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); 278 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS);
262 }; 279 };
263 280
264 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); 281 ash::SystemTrayDelegate* CreateSystemTrayDelegate();
265 282
266 } // namespace chromeos 283 } // namespace chromeos
267 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ 284 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698