Chromium Code Reviews| 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/prefs/pref_service.h" | |
| 11 #include "base/values.h" | 10 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/login/users/user_manager.h" | 12 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 14 #include "chrome/common/pref_names.h" | 13 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 14 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/dbus/power_manager_client.h" | 16 #include "chromeos/dbus/power_manager_client.h" |
| 17 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
| 18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 namespace options { | 22 namespace options { |
| 23 | 23 |
| 24 ConsumerManagementHandler::ConsumerManagementHandler() { | 24 ConsumerManagementHandler::ConsumerManagementHandler() { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 } | 76 } |
| 77 | 77 |
| 78 void ConsumerManagementHandler::HandleEnrollConsumerManagement( | 78 void ConsumerManagementHandler::HandleEnrollConsumerManagement( |
| 79 const base::ListValue* args) { | 79 const base::ListValue* args) { |
| 80 if (!chromeos::UserManager::Get()->IsCurrentUserOwner()) { | 80 if (!chromeos::UserManager::Get()->IsCurrentUserOwner()) { |
| 81 LOG(ERROR) << "Received enrollConsumerManagement, but the current user is " | 81 LOG(ERROR) << "Received enrollConsumerManagement, but the current user is " |
| 82 << "not the owner."; | 82 << "not the owner."; |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 PrefService* prefs = g_browser_process->local_state(); | 86 policy::BrowserPolicyConnectorChromeOS* connector = |
|
bartfab (slow)
2014/08/04 18:44:57
See my comment in gaia_screen_handler.cc regarding
davidyu
2014/08/05 07:27:01
Done.
| |
| 87 prefs->SetBoolean(prefs::kConsumerManagementEnrollmentRequested, true); | 87 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
|
bartfab (slow)
2014/08/04 18:44:56
Nit 1: Indent two more spaces.
Nit 2: #include "ch
davidyu
2014/08/05 07:27:01
Done.
| |
| 88 prefs->CommitPendingWrite(); | 88 connector->GetConsumerManagementService()->SetEnrollState( |
| 89 policy::ConsumerManagementService::ENROLL_ENROLLING); | |
| 89 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 90 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void ConsumerManagementHandler::HandleUnenrollConsumerManagement( | 93 void ConsumerManagementHandler::HandleUnenrollConsumerManagement( |
| 93 const base::ListValue* args) { | 94 const base::ListValue* args) { |
| 94 NOTIMPLEMENTED(); | 95 NOTIMPLEMENTED(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace options | 98 } // namespace options |
| 98 } // namespace chromeos | 99 } // namespace chromeos |
| OLD | NEW |