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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc

Issue 438493002: Added ConsumerManagementService class to handle enroll state and device owner info in boot lockbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@signin
Patch Set: Only create ConsumerManagementService when --enable-consumer-management is specified. Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
13 #include "base/location.h" 12 #include "base/location.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
16 #include "base/prefs/pref_registry_simple.h" 15 #include "base/prefs/pref_registry_simple.h"
17 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
18 #include "base/prefs/scoped_user_pref_update.h" 17 #include "base/prefs/scoped_user_pref_update.h"
19 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
20 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
(...skipping 11 matching lines...) Expand all
33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 32 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" 33 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h"
35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 34 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 35 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" 36 #include "chrome/browser/chromeos/login/ui/webui_login_display.h"
38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 37 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
39 #include "chrome/browser/chromeos/login/users/user_manager.h" 38 #include "chrome/browser/chromeos/login/users/user_manager.h"
40 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 39 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
41 #include "chrome/browser/chromeos/login/wizard_controller.h" 40 #include "chrome/browser/chromeos/login/wizard_controller.h"
42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
42 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
43 #include "chrome/browser/chromeos/policy/device_local_account.h" 43 #include "chrome/browser/chromeos/policy/device_local_account.h"
44 #include "chrome/browser/chromeos/profiles/profile_helper.h" 44 #include "chrome/browser/chromeos/profiles/profile_helper.h"
45 #include "chrome/browser/chromeos/settings/cros_settings.h" 45 #include "chrome/browser/chromeos/settings/cros_settings.h"
46 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap i.h" 46 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap i.h"
47 #include "chrome/browser/io_thread.h" 47 #include "chrome/browser/io_thread.h"
48 #include "chrome/browser/profiles/profile.h" 48 #include "chrome/browser/profiles/profile.h"
49 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie ver.h" 49 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie ver.h"
50 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" 50 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h"
51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
52 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" 52 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h"
53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" 53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
54 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 54 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
55 #include "chrome/common/pref_names.h" 55 #include "chrome/common/pref_names.h"
56 #include "chrome/common/url_constants.h" 56 #include "chrome/common/url_constants.h"
57 #include "chromeos/chromeos_switches.h"
58 #include "chromeos/dbus/dbus_thread_manager.h" 57 #include "chromeos/dbus/dbus_thread_manager.h"
59 #include "chromeos/dbus/power_manager_client.h" 58 #include "chromeos/dbus/power_manager_client.h"
60 #include "chromeos/ime/ime_keyboard.h" 59 #include "chromeos/ime/ime_keyboard.h"
61 #include "chromeos/ime/input_method_descriptor.h" 60 #include "chromeos/ime/input_method_descriptor.h"
62 #include "chromeos/ime/input_method_manager.h" 61 #include "chromeos/ime/input_method_manager.h"
63 #include "chromeos/login/auth/key.h" 62 #include "chromeos/login/auth/key.h"
64 #include "chromeos/login/auth/user_context.h" 63 #include "chromeos/login/auth/user_context.h"
65 #include "chromeos/network/network_state.h" 64 #include "chromeos/network/network_state.h"
66 #include "chromeos/network/network_state_handler.h" 65 #include "chromeos/network/network_state_handler.h"
67 #include "chromeos/network/portal_detector/network_portal_detector.h" 66 #include "chromeos/network/portal_detector/network_portal_detector.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 content::NotificationService::AllSources()); 291 content::NotificationService::AllSources());
293 registrar_.Add(this, 292 registrar_.Add(this,
294 chrome::NOTIFICATION_AUTH_CANCELLED, 293 chrome::NOTIFICATION_AUTH_CANCELLED,
295 content::NotificationService::AllSources()); 294 content::NotificationService::AllSources());
296 295
297 chromeos::input_method::ImeKeyboard* keyboard = 296 chromeos::input_method::ImeKeyboard* keyboard =
298 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); 297 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
299 if (keyboard) 298 if (keyboard)
300 keyboard->AddObserver(this); 299 keyboard->AddObserver(this);
301 300
302 CommandLine* command_line = CommandLine::ForCurrentProcess(); 301 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.
303 PrefService* prefs = g_browser_process->local_state(); 302 g_browser_process->platform_part()->browser_policy_connector_chromeos()->
303 GetConsumerManagementService();
304 is_enrolling_consumer_management_ = 304 is_enrolling_consumer_management_ =
305 command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement) && 305 management_service &&
306 prefs->GetBoolean(prefs::kConsumerManagementEnrollmentRequested); 306 management_service->GetEnrollmentState() ==
307 307 policy::ConsumerManagementService::ENROLLMENT_ENROLLING;
308 } 308 }
309 309
310 SigninScreenHandler::~SigninScreenHandler() { 310 SigninScreenHandler::~SigninScreenHandler() {
311 chromeos::input_method::ImeKeyboard* keyboard = 311 chromeos::input_method::ImeKeyboard* keyboard =
312 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); 312 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard();
313 if (keyboard) 313 if (keyboard)
314 keyboard->RemoveObserver(this); 314 keyboard->RemoveObserver(this);
315 weak_factory_.InvalidateWeakPtrs(); 315 weak_factory_.InvalidateWeakPtrs();
316 if (delegate_) 316 if (delegate_)
317 delegate_->SetWebUIHandler(NULL); 317 delegate_->SetWebUIHandler(NULL);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 424 }
425 425
426 void SigninScreenHandler::Show(const LoginScreenContext& context) { 426 void SigninScreenHandler::Show(const LoginScreenContext& context) {
427 CHECK(delegate_); 427 CHECK(delegate_);
428 428
429 // Just initialize internal fields from context and call ShowImpl(). 429 // Just initialize internal fields from context and call ShowImpl().
430 oobe_ui_ = context.oobe_ui(); 430 oobe_ui_ = context.oobe_ui();
431 431
432 std::string email; 432 std::string email;
433 if (is_enrolling_consumer_management_) { 433 if (is_enrolling_consumer_management_) {
434 // We don't check if the value of the owner email is trusted because it is 434 // We don't check if the value of the owner e-mail is trusted because it is
435 // only used to pre-fill the email field in Gaia sign-in page and a cached 435 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached
436 // value is sufficient. 436 // value is sufficient.
437 CrosSettings::Get()->GetString(kDeviceOwner, &email); 437 CrosSettings::Get()->GetString(kDeviceOwner, &email);
438 } else { 438 } else {
439 email = context.email(); 439 email = context.email();
440 } 440 }
441 gaia_screen_handler_->PopulateEmail(email); 441 gaia_screen_handler_->PopulateEmail(email);
442 ShowImpl(); 442 ShowImpl();
443 } 443 }
444 444
445 void SigninScreenHandler::ShowRetailModeLoginSpinner() { 445 void SigninScreenHandler::ShowRetailModeLoginSpinner() {
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, 1346 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id,
1347 bool diagnostic_mode) { 1347 bool diagnostic_mode) {
1348 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); 1348 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id);
1349 SigninSpecifics specifics; 1349 SigninSpecifics specifics;
1350 specifics.kiosk_diagnostic_mode = diagnostic_mode; 1350 specifics.kiosk_diagnostic_mode = diagnostic_mode;
1351 if (delegate_) 1351 if (delegate_)
1352 delegate_->Login(context, specifics); 1352 delegate_->Login(context, specifics);
1353 } 1353 }
1354 1354
1355 void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() { 1355 void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() {
1356 PrefService* prefs = g_browser_process->local_state(); 1356 policy::ConsumerManagementService* management_service =
1357 prefs->SetBoolean(prefs::kConsumerManagementEnrollmentRequested, false); 1357 g_browser_process->platform_part()->browser_policy_connector_chromeos()->
1358 GetConsumerManagementService();
1359 CHECK(management_service);
1360 management_service->SetEnrollmentState(
1361 policy::ConsumerManagementService::ENROLLMENT_CANCELED);
1358 is_enrolling_consumer_management_ = false; 1362 is_enrolling_consumer_management_ = false;
1359 ShowImpl(); 1363 ShowImpl();
1360 } 1364 }
1361 1365
1362 bool SigninScreenHandler::AllWhitelistedUsersPresent() { 1366 bool SigninScreenHandler::AllWhitelistedUsersPresent() {
1363 CrosSettings* cros_settings = CrosSettings::Get(); 1367 CrosSettings* cros_settings = CrosSettings::Get();
1364 bool allow_new_user = false; 1368 bool allow_new_user = false;
1365 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1369 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1366 if (allow_new_user) 1370 if (allow_new_user)
1367 return false; 1371 return false;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 return gaia_screen_handler_->frame_error(); 1481 return gaia_screen_handler_->frame_error();
1478 } 1482 }
1479 1483
1480 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { 1484 void SigninScreenHandler::OnCapsLockChanged(bool enabled) {
1481 caps_lock_enabled_ = enabled; 1485 caps_lock_enabled_ = enabled;
1482 if (page_is_ready()) 1486 if (page_is_ready())
1483 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); 1487 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_);
1484 } 1488 }
1485 1489
1486 } // namespace chromeos 1490 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698