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

Unified Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 811033002: Add device policy to disallow shutdown - ash UI modifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduced scope of CL (ash only now, removed webui changes) Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index 11bddcfec7d98278f10c0a13d2b546466af1ecfd..d45513bd915ac0e964153ed80bdc69bc8246d4d6 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -19,6 +19,7 @@
#include "ash/shell_window_ids.h"
#include "ash/system/bluetooth/bluetooth_observer.h"
#include "ash/system/chromeos/session/logout_button_observer.h"
+#include "ash/system/chromeos/shutdown_policy_observer.h"
#include "ash/system/date/clock_observer.h"
#include "ash/system/ime/ime_observer.h"
#include "ash/system/tray/system_tray.h"
@@ -231,6 +232,8 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
base::Unretained(this)));
user_manager::UserManager::Get()->AddSessionStateObserver(this);
+ shutdown_policy_handler_.reset(
+ new ShutdownPolicyHandler(CrosSettings::Get(), this));
stevenjb 2015/01/07 19:24:19 It's a shame that we have to provide this level of
cschuet (SLOW) 2015/01/13 10:38:28 As discussed in http://crbug.com/446937, the scope
}
void SystemTrayDelegateChromeOS::Initialize() {
@@ -596,11 +599,6 @@ void SystemTrayDelegateChromeOS::ShowUserLogin() {
}
}
-void SystemTrayDelegateChromeOS::ShutDown() {
- ash::Shell::GetInstance()->lock_state_controller()->RequestShutdown(
- ash::LockStateController::POWER_OFF);
-}
-
void SystemTrayDelegateChromeOS::SignOut() {
chrome::AttemptUserExit();
}
@@ -839,6 +837,21 @@ void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver(
custodian_info_changed_observers_.RemoveObserver(observer);
}
+void SystemTrayDelegateChromeOS::AddShutdownPolicyObserver(
+ ash::ShutdownPolicyObserver* observer) {
+ shutdown_policy_observers_.AddObserver(observer);
+}
+
+void SystemTrayDelegateChromeOS::RemoveShutdownPolicyObserver(
+ ash::ShutdownPolicyObserver* observer) {
+ shutdown_policy_observers_.RemoveObserver(observer);
+}
+
+void SystemTrayDelegateChromeOS::ShouldRebootOnShutdown(
+ const ash::RebootOnShutdownCallback& callback) {
+ shutdown_policy_handler_->CheckIfRebootOnShutdown(callback);
+}
+
void SystemTrayDelegateChromeOS::UserAddedToSession(
const user_manager::User* active_user) {
}
@@ -1324,6 +1337,13 @@ void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged(
OnAccessibilityModeChanged(details.notify);
}
+void SystemTrayDelegateChromeOS::OnShutdownPolicyChanged(
+ bool reboot_on_shutdown) {
+ // Notify all observers.
+ FOR_EACH_OBSERVER(ash::ShutdownPolicyObserver, shutdown_policy_observers_,
+ OnShutdownPolicyChanged(reboot_on_shutdown));
+}
+
const base::string16
SystemTrayDelegateChromeOS::GetLegacySupervisedUserMessage() const {
std::string user_manager_name = GetSupervisedUserManager();

Powered by Google App Engine
This is Rietveld 408576698