Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| index 8b226e95b17383166411636fe2a3fbeee74a5eee..1ca93c966c95764e8af50f8d0f9cc272632afe24 100644 |
| --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc |
| @@ -8,7 +8,6 @@ |
| #include "base/bind.h" |
| #include "base/bind_helpers.h" |
| -#include "base/command_line.h" |
| #include "base/debug/trace_event.h" |
| #include "base/location.h" |
| #include "base/logging.h" |
| @@ -40,6 +39,7 @@ |
| #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| #include "chrome/browser/chromeos/login/wizard_controller.h" |
| #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| +#include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| #include "chrome/browser/chromeos/policy/device_local_account.h" |
| #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| @@ -54,7 +54,6 @@ |
| #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| -#include "chromeos/chromeos_switches.h" |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/dbus/power_manager_client.h" |
| #include "chromeos/ime/ime_keyboard.h" |
| @@ -299,12 +298,13 @@ SigninScreenHandler::SigninScreenHandler( |
| if (keyboard) |
| keyboard->AddObserver(this); |
| - CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| - PrefService* prefs = g_browser_process->local_state(); |
| + policy::ConsumerManagementService* management_service = |
|
bartfab (slow)
2014/08/07 14:32:35
Nit: I suggested renaming |consumer_management| to
davidyu
2014/08/08 03:56:24
Done.
|
| + g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| + GetConsumerManagementService(); |
| is_enrolling_consumer_management_ = |
| - command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement) && |
| - prefs->GetBoolean(prefs::kConsumerManagementEnrollmentRequested); |
| - |
| + management_service && |
| + management_service->GetEnrollmentState() == |
| + policy::ConsumerManagementService::ENROLLMENT_ENROLLING; |
| } |
| SigninScreenHandler::~SigninScreenHandler() { |
| @@ -431,8 +431,8 @@ void SigninScreenHandler::Show(const LoginScreenContext& context) { |
| std::string email; |
| if (is_enrolling_consumer_management_) { |
| - // We don't check if the value of the owner email is trusted because it is |
| - // only used to pre-fill the email field in Gaia sign-in page and a cached |
| + // We don't check if the value of the owner e-mail is trusted because it is |
| + // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
| // value is sufficient. |
| CrosSettings::Get()->GetString(kDeviceOwner, &email); |
| } else { |
| @@ -1353,8 +1353,12 @@ void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, |
| } |
| void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() { |
| - PrefService* prefs = g_browser_process->local_state(); |
| - prefs->SetBoolean(prefs::kConsumerManagementEnrollmentRequested, false); |
| + policy::ConsumerManagementService* management_service = |
| + g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| + GetConsumerManagementService(); |
| + CHECK(management_service); |
| + management_service->SetEnrollmentState( |
| + policy::ConsumerManagementService::ENROLLMENT_CANCELED); |
| is_enrolling_consumer_management_ = false; |
| ShowImpl(); |
| } |