| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui_login_display.h" | 5 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/login/webui_login_view.h" | 7 #include "chrome/browser/chromeos/login/webui_login_view.h" |
| 8 #include "chrome/browser/chromeos/wm_ipc.h" | 8 #include "chrome/browser/chromeos/wm_ipc.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 void WebUILoginDisplay::OnFadeOut() { } | 71 void WebUILoginDisplay::OnFadeOut() { } |
| 72 | 72 |
| 73 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { | 73 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { |
| 74 // Send message to WM to enable/disable click on windows. | 74 // Send message to WM to enable/disable click on windows. |
| 75 WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE); | 75 WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE); |
| 76 message.set_param(0, is_enabled); | 76 message.set_param(0, is_enabled); |
| 77 WmIpc::instance()->SendMessage(message); | 77 WmIpc::instance()->SendMessage(message); |
| 78 | 78 |
| 79 if (is_enabled) | 79 if (is_enabled) |
| 80 login_handler_->ClearAndEnablePassword(); | 80 webui_handler_->ClearAndEnablePassword(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void WebUILoginDisplay::SelectPod(int index) { | 83 void WebUILoginDisplay::SelectPod(int index) { |
| 84 // TODO(rharrison): Figure out what we should be doing here. | 84 // TODO(rharrison): Figure out what we should be doing here. |
| 85 } | 85 } |
| 86 | 86 |
| 87 void WebUILoginDisplay::ShowError(int error_msg_id, | 87 void WebUILoginDisplay::ShowError(int error_msg_id, |
| 88 int login_attempts, | 88 int login_attempts, |
| 89 HelpAppLauncher::HelpTopic help_topic_id) { | 89 HelpAppLauncher::HelpTopic help_topic_id) { |
| 90 DCHECK(login_handler_); | 90 DCHECK(webui_handler_); |
| 91 | 91 |
| 92 std::string error_text; | 92 std::string error_text; |
| 93 switch (error_msg_id) { | 93 switch (error_msg_id) { |
| 94 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: | 94 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: |
| 95 error_text = l10n_util::GetStringFUTF8( | 95 error_text = l10n_util::GetStringFUTF8( |
| 96 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); | 96 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); |
| 97 break; | 97 break; |
| 98 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: | 98 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: |
| 99 error_text = l10n_util::GetStringFUTF8( | 99 error_text = l10n_util::GetStringFUTF8( |
| 100 error_msg_id, delegate()->GetConnectedNetworkName()); | 100 error_msg_id, delegate()->GetConnectedNetworkName()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 114 break; | 114 break; |
| 115 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: | 115 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: |
| 116 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); | 116 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); |
| 117 break; | 117 break; |
| 118 default: | 118 default: |
| 119 if (login_attempts > 1) | 119 if (login_attempts > 1) |
| 120 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); | 120 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); |
| 121 break; | 121 break; |
| 122 } | 122 } |
| 123 | 123 |
| 124 login_handler_->ShowError(error_text, help_link, help_topic_id); | 124 webui_handler_->ShowError(error_text, help_link, help_topic_id); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // WebUILoginDisplay, LoginUIHandlerDelegate implementation: ------------------- | 127 // WebUILoginDisplay, LoginUIHandlerDelegate implementation: ------------------- |
| 128 | 128 |
| 129 void WebUILoginDisplay::Login(const std::string& username, | 129 void WebUILoginDisplay::Login(const std::string& username, |
| 130 const std::string& password) { | 130 const std::string& password) { |
| 131 DCHECK(delegate_); | 131 DCHECK(delegate_); |
| 132 delegate_->Login(username, password); | 132 delegate_->Login(username, password); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void WebUILoginDisplay::LoginAsGuest() { | 135 void WebUILoginDisplay::LoginAsGuest() { |
| 136 DCHECK(delegate_); | 136 DCHECK(delegate_); |
| 137 delegate_->LoginAsGuest(); | 137 delegate_->LoginAsGuest(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 // WebUILoginDisplay, private: ------------------------------------------------- | 140 // WebUILoginDisplay, private: ------------------------------------------------- |
| 141 | 141 |
| 142 // Singleton implementation: --------------------------------------------------- | 142 // Singleton implementation: --------------------------------------------------- |
| 143 | 143 |
| 144 WebUILoginDisplay::WebUILoginDisplay() | 144 WebUILoginDisplay::WebUILoginDisplay() |
| 145 : LoginDisplay(NULL, gfx::Rect()), | 145 : LoginDisplay(NULL, gfx::Rect()), |
| 146 LoginUIHandlerDelegate(), | 146 SigninScreenHandlerDelegate(), |
| 147 login_window_(NULL) { | 147 login_window_(NULL) { |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace chromeos | 150 } // namespace chromeos |
| OLD | NEW |