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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 void SigninScreenHandler::ShowSigninScreenForCreds( | 967 void SigninScreenHandler::ShowSigninScreenForCreds( |
968 const std::string& username, | 968 const std::string& username, |
969 const std::string& password) { | 969 const std::string& password) { |
970 VLOG(2) << "ShowSigninScreenForCreds " << username << " " << password; | 970 VLOG(2) << "ShowSigninScreenForCreds " << username << " " << password; |
971 | 971 |
972 test_user_ = username; | 972 test_user_ = username; |
973 test_pass_ = password; | 973 test_pass_ = password; |
974 HandleShowAddUser(NULL); | 974 HandleShowAddUser(NULL); |
975 } | 975 } |
976 | 976 |
| 977 void SigninScreenHandler::SetGaiaOriginForTesting(const std::string& arg) { |
| 978 gaia_origin_for_test_ = arg; |
| 979 } |
| 980 |
977 void SigninScreenHandler::OnBrowsingDataRemoverDone() { | 981 void SigninScreenHandler::OnBrowsingDataRemoverDone() { |
978 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 982 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
979 cookie_remover_ = NULL; | 983 cookie_remover_ = NULL; |
980 cookies_cleared_ = true; | 984 cookies_cleared_ = true; |
981 cookie_remover_callback_.Run(); | 985 cookie_remover_callback_.Run(); |
982 cookie_remover_callback_.Reset(); | 986 cookie_remover_callback_.Reset(); |
983 } | 987 } |
984 | 988 |
985 void SigninScreenHandler::OnCapsLockChange(bool enabled) { | 989 void SigninScreenHandler::OnCapsLockChange(bool enabled) { |
986 if (page_is_ready()) { | 990 if (page_is_ready()) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_SIGNIN)); | 1107 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_SIGNIN)); |
1104 localized_strings->SetString("stringEmptyEmail", | 1108 localized_strings->SetString("stringEmptyEmail", |
1105 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_EMAIL)); | 1109 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_EMAIL)); |
1106 localized_strings->SetString("stringEmptyPassword", | 1110 localized_strings->SetString("stringEmptyPassword", |
1107 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_PASSWORD)); | 1111 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_PASSWORD)); |
1108 localized_strings->SetString("stringError", | 1112 localized_strings->SetString("stringError", |
1109 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_ERROR)); | 1113 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_ERROR)); |
1110 params.Set("localizedStrings", localized_strings); | 1114 params.Set("localizedStrings", localized_strings); |
1111 } | 1115 } |
1112 | 1116 |
1113 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); | 1117 std::string gaia_origin = GaiaUrls::GetInstance()->gaia_origin_url(); |
| 1118 if (!gaia_origin_for_test_.empty()) |
| 1119 gaia_origin = gaia_origin_for_test_; |
| 1120 params.SetString("gaiaOrigin", gaia_origin); |
1114 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1121 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
1115 if (command_line->HasSwitch(::switches::kGaiaUrlPath)) { | 1122 if (command_line->HasSwitch(::switches::kGaiaUrlPath)) { |
1116 params.SetString("gaiaUrlPath", | 1123 params.SetString("gaiaUrlPath", |
1117 command_line->GetSwitchValueASCII(::switches::kGaiaUrlPath)); | 1124 command_line->GetSwitchValueASCII(::switches::kGaiaUrlPath)); |
1118 } | 1125 } |
1119 | 1126 |
1120 // Test automation data: | 1127 // Test automation data: |
1121 if (command_line->HasSwitch(::switches::kAuthExtensionPath)) { | 1128 if (command_line->HasSwitch(::switches::kAuthExtensionPath)) { |
1122 if (!test_user_.empty()) { | 1129 if (!test_user_.empty()) { |
1123 params.SetString("test_email", test_user_); | 1130 params.SetString("test_email", test_user_); |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 if (!cros_settings) | 1755 if (!cros_settings) |
1749 return false; | 1756 return false; |
1750 | 1757 |
1751 // Offline login is allowed only when user pods are hidden. | 1758 // Offline login is allowed only when user pods are hidden. |
1752 bool show_pods; | 1759 bool show_pods; |
1753 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods); | 1760 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods); |
1754 return !show_pods; | 1761 return !show_pods; |
1755 } | 1762 } |
1756 | 1763 |
1757 } // namespace chromeos | 1764 } // namespace chromeos |
OLD | NEW |