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