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

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

Issue 811033002: Add device policy to disallow shutdown - ash UI modifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shutdown_allowed => reboot_on_shutdown Created 6 years 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> 8 #include <vector>
9 9
10 #include "ash/session/session_state_observer.h" 10 #include "ash/session/session_state_observer.h"
11 #include "ash/system/chromeos/supervised/custodian_info_tray_observer.h" 11 #include "ash/system/chromeos/supervised/custodian_info_tray_observer.h"
12 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/system_tray.h"
13 #include "ash/system/tray/system_tray_delegate.h" 13 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/system/tray/system_tray_notifier.h" 14 #include "ash/system/tray/system_tray_notifier.h"
15 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
16 #include "base/callback_list.h" 16 #include "base/callback_list.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/containers/scoped_ptr_hash_map.h" 18 #include "base/containers/scoped_ptr_hash_map.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/observer_list.h" 21 #include "base/observer_list.h"
22 #include "base/prefs/pref_change_registrar.h" 22 #include "base/prefs/pref_change_registrar.h"
23 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 23 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" 25 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
26 #include "chrome/browser/ui/browser_list_observer.h" 26 #include "chrome/browser/ui/browser_list_observer.h"
27 #include "chrome/browser/ui/webui/chromeos/login/shutdown_policy_observer.h"
Daniel Erat 2014/12/17 16:21:04 it seems strange to me for this file to depend on
stevenjb 2014/12/17 19:09:03 +1. shutdown_policy_observer.h should probably be
cschuet (SLOW) 2015/01/07 14:37:07 Done.
cschuet (SLOW) 2015/01/07 14:37:07 Done.
27 #include "chromeos/audio/cras_audio_handler.h" 28 #include "chromeos/audio/cras_audio_handler.h"
28 #include "chromeos/dbus/session_manager_client.h" 29 #include "chromeos/dbus/session_manager_client.h"
29 #include "chromeos/login/login_state.h" 30 #include "chromeos/login/login_state.h"
30 #include "components/policy/core/common/cloud/cloud_policy_store.h" 31 #include "components/policy/core/common/cloud/cloud_policy_store.h"
31 #include "components/user_manager/user_manager.h" 32 #include "components/user_manager/user_manager.h"
32 #include "content/public/browser/notification_observer.h" 33 #include "content/public/browser/notification_observer.h"
33 #include "content/public/browser/notification_registrar.h" 34 #include "content/public/browser/notification_registrar.h"
34 #include "device/bluetooth/bluetooth_adapter.h" 35 #include "device/bluetooth/bluetooth_adapter.h"
35 #include "device/bluetooth/bluetooth_discovery_session.h" 36 #include "device/bluetooth/bluetooth_discovery_session.h"
36 #include "extensions/browser/app_window/app_window_registry.h" 37 #include "extensions/browser/app_window/app_window_registry.h"
37 #include "ui/base/ime/chromeos/input_method_manager.h" 38 #include "ui/base/ime/chromeos/input_method_manager.h"
38 #include "ui/chromeos/ime/input_method_menu_manager.h" 39 #include "ui/chromeos/ime/input_method_menu_manager.h"
39 40
40 namespace user_manager { 41 namespace user_manager {
41 class User; 42 class User;
42 } 43 }
43 44
44 namespace chromeos { 45 namespace chromeos {
45
46 class SystemTrayDelegateChromeOS 46 class SystemTrayDelegateChromeOS
47 : public ui::ime::InputMethodMenuManager::Observer, 47 : public ui::ime::InputMethodMenuManager::Observer,
48 public ash::SystemTrayDelegate, 48 public ash::SystemTrayDelegate,
49 public SessionManagerClient::Observer, 49 public SessionManagerClient::Observer,
50 public content::NotificationObserver, 50 public content::NotificationObserver,
51 public input_method::InputMethodManager::Observer, 51 public input_method::InputMethodManager::Observer,
52 public chromeos::LoginState::Observer, 52 public chromeos::LoginState::Observer,
53 public chromeos::CrasAudioHandler::AudioObserver, 53 public chromeos::CrasAudioHandler::AudioObserver,
54 public device::BluetoothAdapter::Observer, 54 public device::BluetoothAdapter::Observer,
55 public policy::CloudPolicyStore::Observer, 55 public policy::CloudPolicyStore::Observer,
56 public ash::SessionStateObserver, 56 public ash::SessionStateObserver,
57 public chrome::BrowserListObserver, 57 public chrome::BrowserListObserver,
58 public extensions::AppWindowRegistry::Observer, 58 public extensions::AppWindowRegistry::Observer,
59 public user_manager::UserManager::UserSessionStateObserver, 59 public user_manager::UserManager::UserSessionStateObserver,
60 public SupervisedUserServiceObserver { 60 public SupervisedUserServiceObserver,
61 public ShutdownPolicyObserver::Delegate {
61 public: 62 public:
62 SystemTrayDelegateChromeOS(); 63 SystemTrayDelegateChromeOS();
63 64
64 ~SystemTrayDelegateChromeOS() override; 65 ~SystemTrayDelegateChromeOS() override;
65 66
66 void InitializeOnAdapterReady( 67 void InitializeOnAdapterReady(
67 scoped_refptr<device::BluetoothAdapter> adapter); 68 scoped_refptr<device::BluetoothAdapter> adapter);
68 69
69 // Overridden from ash::SystemTrayDelegate: 70 // Overridden from ash::SystemTrayDelegate:
70 void Initialize() override; 71 void Initialize() override;
(...skipping 19 matching lines...) Expand all
90 void ShowChromeSlow() override; 91 void ShowChromeSlow() override;
91 bool ShouldShowDisplayNotification() override; 92 bool ShouldShowDisplayNotification() override;
92 void ShowIMESettings() override; 93 void ShowIMESettings() override;
93 void ShowHelp() override; 94 void ShowHelp() override;
94 void ShowAccessibilityHelp() override; 95 void ShowAccessibilityHelp() override;
95 void ShowAccessibilitySettings() override; 96 void ShowAccessibilitySettings() override;
96 void ShowPublicAccountInfo() override; 97 void ShowPublicAccountInfo() override;
97 void ShowSupervisedUserInfo() override; 98 void ShowSupervisedUserInfo() override;
98 void ShowEnterpriseInfo() override; 99 void ShowEnterpriseInfo() override;
99 void ShowUserLogin() override; 100 void ShowUserLogin() override;
101 void Restart() override;
100 void ShutDown() override; 102 void ShutDown() override;
101 void SignOut() override; 103 void SignOut() override;
102 void RequestLockScreen() override; 104 void RequestLockScreen() override;
103 void RequestRestartForUpdate() override; 105 void RequestRestartForUpdate() override;
104 void GetAvailableBluetoothDevices(ash::BluetoothDeviceList* list) override; 106 void GetAvailableBluetoothDevices(ash::BluetoothDeviceList* list) override;
105 void BluetoothStartDiscovering() override; 107 void BluetoothStartDiscovering() override;
106 void BluetoothStopDiscovering() override; 108 void BluetoothStopDiscovering() override;
107 void ConnectToBluetoothDevice(const std::string& address) override; 109 void ConnectToBluetoothDevice(const std::string& address) override;
108 bool IsBluetoothDiscovering() override; 110 bool IsBluetoothDiscovering() override;
109 void GetCurrentIME(ash::IMEInfo* info) override; 111 void GetCurrentIME(ash::IMEInfo* info) override;
(...skipping 15 matching lines...) Expand all
125 bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override; 127 bool GetSessionLengthLimit(base::TimeDelta* session_length_limit) override;
126 int GetSystemTrayMenuWidth() override; 128 int GetSystemTrayMenuWidth() override;
127 void ActiveUserWasChanged() override; 129 void ActiveUserWasChanged() override;
128 bool IsSearchKeyMappedToCapsLock() override; 130 bool IsSearchKeyMappedToCapsLock() override;
129 ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( 131 ash::tray::UserAccountsDelegate* GetUserAccountsDelegate(
130 const std::string& user_id) override; 132 const std::string& user_id) override;
131 void AddCustodianInfoTrayObserver( 133 void AddCustodianInfoTrayObserver(
132 ash::CustodianInfoTrayObserver* observer) override; 134 ash::CustodianInfoTrayObserver* observer) override;
133 void RemoveCustodianInfoTrayObserver( 135 void RemoveCustodianInfoTrayObserver(
134 ash::CustodianInfoTrayObserver* observer) override; 136 ash::CustodianInfoTrayObserver* observer) override;
137 void AddShutdownPolicyObserver(
138 ash::ShutdownPolicyObserver* observer) override;
139 void ShouldRebootOnShutdown(
140 const ash::RebootOnShutdownCallback& callback) override;
141 void RemoveShutdownPolicyObserver(
142 ash::ShutdownPolicyObserver* observer) override;
135 143
136 // Overridden from user_manager::UserManager::UserSessionStateObserver: 144 // Overridden from user_manager::UserManager::UserSessionStateObserver:
137 void UserAddedToSession(const user_manager::User* active_user) override; 145 void UserAddedToSession(const user_manager::User* active_user) override;
138 146
139 void UserChangedChildStatus(user_manager::User* user) override; 147 void UserChangedChildStatus(user_manager::User* user) override;
140 148
141 // browser tests need to call ShouldUse24HourClock(). 149 // browser tests need to call ShouldUse24HourClock().
142 bool GetShouldUse24HourClockForTesting() const; 150 bool GetShouldUse24HourClockForTesting() const;
143 151
144 private: 152 private:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 251
244 // Overridden from extensions::AppWindowRegistry::Observer: 252 // Overridden from extensions::AppWindowRegistry::Observer:
245 void OnAppWindowRemoved(extensions::AppWindow* app_window) override; 253 void OnAppWindowRemoved(extensions::AppWindow* app_window) override;
246 254
247 // Overridden from SupervisedUserServiceObserver: 255 // Overridden from SupervisedUserServiceObserver:
248 void OnCustodianInfoChanged() override; 256 void OnCustodianInfoChanged() override;
249 257
250 void OnAccessibilityStatusChanged( 258 void OnAccessibilityStatusChanged(
251 const AccessibilityStatusEventDetails& details); 259 const AccessibilityStatusEventDetails& details);
252 260
261 // Overridden from ShutdownPolicyObserver::Delegate.
262 void OnShutdownPolicyChanged(bool reboot_on_shutdown) override;
263
253 scoped_ptr<content::NotificationRegistrar> registrar_; 264 scoped_ptr<content::NotificationRegistrar> registrar_;
254 scoped_ptr<PrefChangeRegistrar> local_state_registrar_; 265 scoped_ptr<PrefChangeRegistrar> local_state_registrar_;
255 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_; 266 scoped_ptr<PrefChangeRegistrar> user_pref_registrar_;
256 Profile* user_profile_; 267 Profile* user_profile_;
257 base::HourClockType clock_type_; 268 base::HourClockType clock_type_;
258 int search_key_mapped_to_; 269 int search_key_mapped_to_;
259 bool screen_locked_; 270 bool screen_locked_;
260 bool have_session_start_time_; 271 bool have_session_start_time_;
261 base::TimeTicks session_start_time_; 272 base::TimeTicks session_start_time_;
262 bool have_session_length_limit_; 273 bool have_session_length_limit_;
263 base::TimeDelta session_length_limit_; 274 base::TimeDelta session_length_limit_;
264 std::string enterprise_domain_; 275 std::string enterprise_domain_;
265 bool should_run_bluetooth_discovery_; 276 bool should_run_bluetooth_discovery_;
266 bool session_started_; 277 bool session_started_;
267 278
268 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; 279 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
269 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_; 280 scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_;
270 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; 281 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_;
271 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_; 282 scoped_ptr<CrosSettingsObserverSubscription> device_settings_observer_;
272 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; 283 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
273 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate> 284 base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate>
274 accounts_delegates_; 285 accounts_delegates_;
286 scoped_ptr<ShutdownPolicyObserver> shutdown_policy_observer_;
Daniel Erat 2014/12/17 16:21:04 please improve the naming here. it's confusing to
stevenjb 2014/12/17 19:09:02 +1, I suggest the following: * The existing Shutdo
cschuet (SLOW) 2015/01/07 14:37:07 Done.
cschuet (SLOW) 2015/01/07 14:37:07 Done.
275 287
276 ObserverList<ash::CustodianInfoTrayObserver> 288 ObserverList<ash::CustodianInfoTrayObserver>
277 custodian_info_changed_observers_; 289 custodian_info_changed_observers_;
278 290
291 ObserverList<ash::ShutdownPolicyObserver, true> shutdown_policy_observers_;
292
279 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; 293 base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_;
280 294
281 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS); 295 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS);
282 }; 296 };
283 297
284 ash::SystemTrayDelegate* CreateSystemTrayDelegate(); 298 ash::SystemTrayDelegate* CreateSystemTrayDelegate();
285 299
286 } // namespace chromeos 300 } // namespace chromeos
287 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ 301 #endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698