| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ui/webui/options/chromeos/consumer_management_handler.h
" | 5 #include "chrome/browser/ui/webui/options/chromeos/consumer_management_handler.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 11 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 12 #include "chrome/browser/chromeos/policy/consumer_management_stage.h" | 12 #include "chrome/browser/chromeos/policy/consumer_management_stage.h" |
| 13 #include "chrome/browser/chromeos/policy/consumer_unenrollment_handler.h" | |
| 14 #include "chrome/browser/chromeos/policy/consumer_unenrollment_handler_factory.h
" | |
| 15 #include "chrome/browser/profiles/profile.h" | |
| 16 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "chromeos/dbus/power_manager_client.h" | 15 #include "chromeos/dbus/power_manager_client.h" |
| 19 #include "components/user_manager/user_manager.h" | 16 #include "components/user_manager/user_manager.h" |
| 20 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 22 | 19 |
| 23 namespace chromeos { | 20 namespace chromeos { |
| 24 namespace options { | 21 namespace options { |
| 25 | 22 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 84 } |
| 88 | 85 |
| 89 CHECK(management_service_); | 86 CHECK(management_service_); |
| 90 management_service_->SetStage( | 87 management_service_->SetStage( |
| 91 policy::ConsumerManagementStage::EnrollmentRequested()); | 88 policy::ConsumerManagementStage::EnrollmentRequested()); |
| 92 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 89 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 93 } | 90 } |
| 94 | 91 |
| 95 void ConsumerManagementHandler::HandleUnenrollConsumerManagement( | 92 void ConsumerManagementHandler::HandleUnenrollConsumerManagement( |
| 96 const base::ListValue* args) { | 93 const base::ListValue* args) { |
| 97 if (!user_manager::UserManager::Get()->IsCurrentUserOwner()) { | 94 NOTIMPLEMENTED(); |
| 98 LOG(ERROR) << "Received unenrollConsumerManagement, but the current user " | |
| 99 << "is not the owner."; | |
| 100 return; | |
| 101 } | |
| 102 | |
| 103 CHECK(management_service_); | |
| 104 management_service_->SetStage( | |
| 105 policy::ConsumerManagementStage::UnenrollmentRequested()); | |
| 106 policy::ConsumerUnenrollmentHandlerFactory::GetForBrowserContext( | |
| 107 Profile::FromWebUI(web_ui()))->Start(); | |
| 108 } | 95 } |
| 109 | 96 |
| 110 } // namespace options | 97 } // namespace options |
| 111 } // namespace chromeos | 98 } // namespace chromeos |
| OLD | NEW |