OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/signin/user_manager_screen_handler.h" | 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/value_conversions.h" | 10 #include "base/value_conversions.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 void UserManagerScreenHandler::EnableInput() { | 246 void UserManagerScreenHandler::EnableInput() { |
247 // Nothing here because UI is not disabled when starting to authenticate. | 247 // Nothing here because UI is not disabled when starting to authenticate. |
248 } | 248 } |
249 | 249 |
250 void UserManagerScreenHandler::SetAuthType( | 250 void UserManagerScreenHandler::SetAuthType( |
251 const std::string& user_email, | 251 const std::string& user_email, |
252 ScreenlockBridge::LockHandler::AuthType auth_type, | 252 ScreenlockBridge::LockHandler::AuthType auth_type, |
253 const base::string16& auth_value) { | 253 const base::string16& auth_value) { |
| 254 if (GetAuthType(user_email) == |
| 255 ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD) |
| 256 return; |
| 257 |
254 user_auth_type_map_[user_email] = auth_type; | 258 user_auth_type_map_[user_email] = auth_type; |
255 web_ui()->CallJavascriptFunction( | 259 web_ui()->CallJavascriptFunction( |
256 "login.AccountPickerScreen.setAuthType", | 260 "login.AccountPickerScreen.setAuthType", |
257 base::StringValue(user_email), | 261 base::StringValue(user_email), |
258 base::FundamentalValue(auth_type), | 262 base::FundamentalValue(auth_type), |
259 base::StringValue(auth_value)); | 263 base::StringValue(auth_value)); |
260 } | 264 } |
261 | 265 |
262 ScreenlockBridge::LockHandler::AuthType UserManagerScreenHandler::GetAuthType( | 266 ScreenlockBridge::LockHandler::AuthType UserManagerScreenHandler::GetAuthType( |
263 const std::string& user_email) const { | 267 const std::string& user_email) const { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 ProfileMetrics::SWITCH_PROFILE_MANAGER); | 414 ProfileMetrics::SWITCH_PROFILE_MANAGER); |
411 } | 415 } |
412 | 416 |
413 void UserManagerScreenHandler::HandleAttemptUnlock( | 417 void UserManagerScreenHandler::HandleAttemptUnlock( |
414 const base::ListValue* args) { | 418 const base::ListValue* args) { |
415 std::string email; | 419 std::string email; |
416 CHECK(args->GetString(0, &email)); | 420 CHECK(args->GetString(0, &email)); |
417 GetScreenlockRouter(email)->OnAuthAttempted(GetAuthType(email), ""); | 421 GetScreenlockRouter(email)->OnAuthAttempted(GetAuthType(email), ""); |
418 } | 422 } |
419 | 423 |
| 424 void UserManagerScreenHandler::HandleHardlockUserPod( |
| 425 const base::ListValue* args) { |
| 426 std::string email; |
| 427 CHECK(args->GetString(0, &email)); |
| 428 SetAuthType(email, |
| 429 ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD, |
| 430 base::string16()); |
| 431 HideUserPodCustomIcon(email); |
| 432 } |
| 433 |
420 void UserManagerScreenHandler::OnClientLoginSuccess( | 434 void UserManagerScreenHandler::OnClientLoginSuccess( |
421 const ClientLoginResult& result) { | 435 const ClientLoginResult& result) { |
422 chrome::SetLocalAuthCredentials(authenticating_profile_index_, | 436 chrome::SetLocalAuthCredentials(authenticating_profile_index_, |
423 password_attempt_); | 437 password_attempt_); |
424 ReportAuthenticationResult(true, ProfileMetrics::AUTH_ONLINE); | 438 ReportAuthenticationResult(true, ProfileMetrics::AUTH_ONLINE); |
425 } | 439 } |
426 | 440 |
427 void UserManagerScreenHandler::OnClientLoginFailure( | 441 void UserManagerScreenHandler::OnClientLoginFailure( |
428 const GoogleServiceAuthError& error) { | 442 const GoogleServiceAuthError& error) { |
429 const GoogleServiceAuthError::State state = error.state(); | 443 const GoogleServiceAuthError::State state = error.state(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 } else { | 660 } else { |
647 web_ui()->CallJavascriptFunction( | 661 web_ui()->CallJavascriptFunction( |
648 "cr.ui.Oobe.showSignInError", | 662 "cr.ui.Oobe.showSignInError", |
649 base::FundamentalValue(0), | 663 base::FundamentalValue(0), |
650 base::StringValue( | 664 base::StringValue( |
651 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), | 665 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), |
652 base::StringValue(""), | 666 base::StringValue(""), |
653 base::FundamentalValue(0)); | 667 base::FundamentalValue(0)); |
654 } | 668 } |
655 } | 669 } |
OLD | NEW |