OLD | NEW |
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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
39 #include "chrome/browser/chromeos/login/users/user_manager.h" | 39 #include "chrome/browser/chromeos/login/users/user_manager.h" |
40 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 40 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
41 #include "chrome/browser/chromeos/login/wizard_controller.h" | 41 #include "chrome/browser/chromeos/login/wizard_controller.h" |
42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 43 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
43 #include "chrome/browser/chromeos/policy/device_local_account.h" | 44 #include "chrome/browser/chromeos/policy/device_local_account.h" |
44 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 45 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
45 #include "chrome/browser/chromeos/settings/cros_settings.h" | 46 #include "chrome/browser/chromeos/settings/cros_settings.h" |
46 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 47 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
47 #include "chrome/browser/io_thread.h" | 48 #include "chrome/browser/io_thread.h" |
48 #include "chrome/browser/profiles/profile.h" | 49 #include "chrome/browser/profiles/profile.h" |
49 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" | 50 #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" | 51 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 52 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
52 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 53 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 content::NotificationService::AllSources()); | 293 content::NotificationService::AllSources()); |
293 registrar_.Add(this, | 294 registrar_.Add(this, |
294 chrome::NOTIFICATION_AUTH_CANCELLED, | 295 chrome::NOTIFICATION_AUTH_CANCELLED, |
295 content::NotificationService::AllSources()); | 296 content::NotificationService::AllSources()); |
296 | 297 |
297 chromeos::input_method::ImeKeyboard* keyboard = | 298 chromeos::input_method::ImeKeyboard* keyboard = |
298 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); | 299 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); |
299 if (keyboard) | 300 if (keyboard) |
300 keyboard->AddObserver(this); | 301 keyboard->AddObserver(this); |
301 | 302 |
302 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 303 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
303 PrefService* prefs = g_browser_process->local_state(); | 304 policy::BrowserPolicyConnectorChromeOS* connector = |
| 305 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
304 is_enrolling_consumer_management_ = | 306 is_enrolling_consumer_management_ = |
305 command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement) && | 307 command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement) && |
306 prefs->GetBoolean(prefs::kConsumerManagementEnrollmentRequested); | 308 connector->GetConsumerManagementService()->GetEnrollmentState() == |
307 | 309 policy::ConsumerManagementService::ENROLLMENT_ENROLLING; |
308 } | 310 } |
309 | 311 |
310 SigninScreenHandler::~SigninScreenHandler() { | 312 SigninScreenHandler::~SigninScreenHandler() { |
311 chromeos::input_method::ImeKeyboard* keyboard = | 313 chromeos::input_method::ImeKeyboard* keyboard = |
312 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); | 314 chromeos::input_method::InputMethodManager::Get()->GetImeKeyboard(); |
313 if (keyboard) | 315 if (keyboard) |
314 keyboard->RemoveObserver(this); | 316 keyboard->RemoveObserver(this); |
315 weak_factory_.InvalidateWeakPtrs(); | 317 weak_factory_.InvalidateWeakPtrs(); |
316 if (delegate_) | 318 if (delegate_) |
317 delegate_->SetWebUIHandler(NULL); | 319 delegate_->SetWebUIHandler(NULL); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 426 } |
425 | 427 |
426 void SigninScreenHandler::Show(const LoginScreenContext& context) { | 428 void SigninScreenHandler::Show(const LoginScreenContext& context) { |
427 CHECK(delegate_); | 429 CHECK(delegate_); |
428 | 430 |
429 // Just initialize internal fields from context and call ShowImpl(). | 431 // Just initialize internal fields from context and call ShowImpl(). |
430 oobe_ui_ = context.oobe_ui(); | 432 oobe_ui_ = context.oobe_ui(); |
431 | 433 |
432 std::string email; | 434 std::string email; |
433 if (is_enrolling_consumer_management_) { | 435 if (is_enrolling_consumer_management_) { |
434 // We don't check if the value of the owner email is trusted because it is | 436 // 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 | 437 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
436 // value is sufficient. | 438 // value is sufficient. |
437 CrosSettings::Get()->GetString(kDeviceOwner, &email); | 439 CrosSettings::Get()->GetString(kDeviceOwner, &email); |
438 } else { | 440 } else { |
439 email = context.email(); | 441 email = context.email(); |
440 } | 442 } |
441 gaia_screen_handler_->PopulateEmail(email); | 443 gaia_screen_handler_->PopulateEmail(email); |
442 ShowImpl(); | 444 ShowImpl(); |
443 } | 445 } |
444 | 446 |
445 void SigninScreenHandler::ShowRetailModeLoginSpinner() { | 447 void SigninScreenHandler::ShowRetailModeLoginSpinner() { |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, | 1340 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, |
1339 bool diagnostic_mode) { | 1341 bool diagnostic_mode) { |
1340 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); | 1342 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); |
1341 SigninSpecifics specifics; | 1343 SigninSpecifics specifics; |
1342 specifics.kiosk_diagnostic_mode = diagnostic_mode; | 1344 specifics.kiosk_diagnostic_mode = diagnostic_mode; |
1343 if (delegate_) | 1345 if (delegate_) |
1344 delegate_->Login(context, specifics); | 1346 delegate_->Login(context, specifics); |
1345 } | 1347 } |
1346 | 1348 |
1347 void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() { | 1349 void SigninScreenHandler::HandleCancelConsumerManagementEnrollment() { |
1348 PrefService* prefs = g_browser_process->local_state(); | 1350 policy::BrowserPolicyConnectorChromeOS* connector = |
1349 prefs->SetBoolean(prefs::kConsumerManagementEnrollmentRequested, false); | 1351 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 1352 connector->GetConsumerManagementService()->SetEnrollmentState( |
| 1353 policy::ConsumerManagementService::ENROLLMENT_CANCELED); |
1350 is_enrolling_consumer_management_ = false; | 1354 is_enrolling_consumer_management_ = false; |
1351 ShowImpl(); | 1355 ShowImpl(); |
1352 } | 1356 } |
1353 | 1357 |
1354 bool SigninScreenHandler::AllWhitelistedUsersPresent() { | 1358 bool SigninScreenHandler::AllWhitelistedUsersPresent() { |
1355 CrosSettings* cros_settings = CrosSettings::Get(); | 1359 CrosSettings* cros_settings = CrosSettings::Get(); |
1356 bool allow_new_user = false; | 1360 bool allow_new_user = false; |
1357 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1361 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
1358 if (allow_new_user) | 1362 if (allow_new_user) |
1359 return false; | 1363 return false; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 return gaia_screen_handler_->frame_error(); | 1473 return gaia_screen_handler_->frame_error(); |
1470 } | 1474 } |
1471 | 1475 |
1472 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1476 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
1473 caps_lock_enabled_ = enabled; | 1477 caps_lock_enabled_ = enabled; |
1474 if (page_is_ready()) | 1478 if (page_is_ready()) |
1475 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1479 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
1476 } | 1480 } |
1477 | 1481 |
1478 } // namespace chromeos | 1482 } // namespace chromeos |
OLD | NEW |