| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/ui/webui_login_display.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 7 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" | 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 10 #include "chrome/browser/chromeos/login/signin_screen_controller.h" | 10 #include "chrome/browser/chromeos/login/signin_screen_controller.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 int login_attempts, | 108 int login_attempts, |
| 109 HelpAppLauncher::HelpTopic help_topic_id) { | 109 HelpAppLauncher::HelpTopic help_topic_id) { |
| 110 VLOG(1) << "Show error, error_id: " << error_msg_id | 110 VLOG(1) << "Show error, error_id: " << error_msg_id |
| 111 << ", attempts:" << login_attempts | 111 << ", attempts:" << login_attempts |
| 112 << ", help_topic_id: " << help_topic_id; | 112 << ", help_topic_id: " << help_topic_id; |
| 113 if (!webui_handler_) | 113 if (!webui_handler_) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 std::string error_text; | 116 std::string error_text; |
| 117 switch (error_msg_id) { | 117 switch (error_msg_id) { |
| 118 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: | |
| 119 error_text = l10n_util::GetStringFUTF8( | |
| 120 error_msg_id, l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME)); | |
| 121 break; | |
| 122 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: | 118 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: |
| 123 error_text = l10n_util::GetStringFUTF8( | 119 error_text = l10n_util::GetStringFUTF8( |
| 124 error_msg_id, delegate()->GetConnectedNetworkName()); | 120 error_msg_id, delegate()->GetConnectedNetworkName()); |
| 125 break; | 121 break; |
| 126 default: | 122 default: |
| 127 error_text = l10n_util::GetStringUTF8(error_msg_id); | 123 error_text = l10n_util::GetStringUTF8(error_msg_id); |
| 128 break; | 124 break; |
| 129 } | 125 } |
| 130 | 126 |
| 131 // Only display hints about keyboard layout if the error is authentication- | 127 // Only display hints about keyboard layout if the error is authentication- |
| (...skipping 13 matching lines...) Expand all Loading... |
| 145 | 141 |
| 146 // Display a hint to switch keyboards if there are other active input | 142 // Display a hint to switch keyboards if there are other active input |
| 147 // methods. | 143 // methods. |
| 148 if (ime_manager->GetActiveIMEState()->GetNumActiveInputMethods() > 1) { | 144 if (ime_manager->GetActiveIMEState()->GetNumActiveInputMethods() > 1) { |
| 149 error_text += "\n" + | 145 error_text += "\n" + |
| 150 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_KEYBOARD_SWITCH_HINT); | 146 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_KEYBOARD_SWITCH_HINT); |
| 151 } | 147 } |
| 152 } | 148 } |
| 153 | 149 |
| 154 std::string help_link; | 150 std::string help_link; |
| 155 switch (error_msg_id) { | 151 if (login_attempts > 1) |
| 156 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: | 152 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); |
| 157 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); | |
| 158 break; | |
| 159 default: | |
| 160 if (login_attempts > 1) | |
| 161 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); | |
| 162 break; | |
| 163 } | |
| 164 | 153 |
| 165 webui_handler_->ShowError(login_attempts, error_text, help_link, | 154 webui_handler_->ShowError(login_attempts, error_text, help_link, |
| 166 help_topic_id); | 155 help_topic_id); |
| 167 } | 156 } |
| 168 | 157 |
| 169 void WebUILoginDisplay::ShowErrorScreen(LoginDisplay::SigninError error_id) { | 158 void WebUILoginDisplay::ShowErrorScreen(LoginDisplay::SigninError error_id) { |
| 170 VLOG(1) << "Show error screen, error_id: " << error_id; | 159 VLOG(1) << "Show error screen, error_id: " << error_id; |
| 171 if (!webui_handler_) | 160 if (!webui_handler_) |
| 172 return; | 161 return; |
| 173 webui_handler_->ShowErrorScreen(error_id); | 162 webui_handler_->ShowErrorScreen(error_id); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 328 } |
| 340 | 329 |
| 341 bool WebUILoginDisplay::IsUserWhitelisted(const AccountId& account_id) { | 330 bool WebUILoginDisplay::IsUserWhitelisted(const AccountId& account_id) { |
| 342 DCHECK(delegate_); | 331 DCHECK(delegate_); |
| 343 if (delegate_) | 332 if (delegate_) |
| 344 return delegate_->IsUserWhitelisted(account_id); | 333 return delegate_->IsUserWhitelisted(account_id); |
| 345 return true; | 334 return true; |
| 346 } | 335 } |
| 347 | 336 |
| 348 } // namespace chromeos | 337 } // namespace chromeos |
| OLD | NEW |