Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/chromeos/login/webui_login_display.cc

Issue 7382001: [ChromeOS] WebUI OOBE/Login refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and address comments in set #1 Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void WebUILoginDisplay::OnUserImageChanged(UserManager::User* user) { 61 void WebUILoginDisplay::OnUserImageChanged(UserManager::User* user) {
62 // TODO(rharrison): Update the user in the user vector 62 // TODO(rharrison): Update the user in the user vector
63 // TODO(rharrison): Push the change to WebUI Login screen 63 // TODO(rharrison): Push the change to WebUI Login screen
64 } 64 }
65 65
66 void WebUILoginDisplay::OnUserRemoved(const std::string& username) { 66 void WebUILoginDisplay::OnUserRemoved(const std::string& username) {
67 // TODO(rharrison): Remove the user from the user vector 67 // TODO(rharrison): Remove the user from the user vector
68 // TODO(rharrison): Push the change to WebUI Login screen 68 // TODO(rharrison): Push the change to WebUI Login screen
69 } 69 }
70 70
71 void WebUILoginDisplay::OnFadeOut() { } 71 void WebUILoginDisplay::OnFadeOut() {
72 }
72 73
73 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { 74 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) {
74 // Send message to WM to enable/disable click on windows. 75 // Send message to WM to enable/disable click on windows.
75 WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE); 76 WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE);
76 message.set_param(0, is_enabled); 77 message.set_param(0, is_enabled);
77 WmIpc::instance()->SendMessage(message); 78 WmIpc::instance()->SendMessage(message);
78 79
79 if (is_enabled) 80 if (is_enabled)
80 login_handler_->ClearAndEnablePassword(); 81 webui_handler_->ClearAndEnablePassword();
81 } 82 }
82 83
83 void WebUILoginDisplay::SelectPod(int index) { 84 void WebUILoginDisplay::SelectPod(int index) {
84 // TODO(rharrison): Figure out what we should be doing here. 85 // TODO(rharrison): Figure out what we should be doing here.
85 } 86 }
86 87
87 void WebUILoginDisplay::ShowError(int error_msg_id, 88 void WebUILoginDisplay::ShowError(int error_msg_id,
88 int login_attempts, 89 int login_attempts,
89 HelpAppLauncher::HelpTopic help_topic_id) { 90 HelpAppLauncher::HelpTopic help_topic_id) {
90 DCHECK(login_handler_); 91 DCHECK(webui_handler_);
91 92
92 std::string error_text; 93 std::string error_text;
93 switch (error_msg_id) { 94 switch (error_msg_id) {
94 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: 95 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED:
95 error_text = l10n_util::GetStringFUTF8( 96 error_text = l10n_util::GetStringFUTF8(
96 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); 97 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME));
97 break; 98 break;
98 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: 99 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL:
99 error_text = l10n_util::GetStringFUTF8( 100 error_text = l10n_util::GetStringFUTF8(
100 error_msg_id, delegate()->GetConnectedNetworkName()); 101 error_msg_id, delegate()->GetConnectedNetworkName());
(...skipping 13 matching lines...) Expand all
114 break; 115 break;
115 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: 116 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED:
116 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); 117 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE);
117 break; 118 break;
118 default: 119 default:
119 if (login_attempts > 1) 120 if (login_attempts > 1)
120 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); 121 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE);
121 break; 122 break;
122 } 123 }
123 124
124 login_handler_->ShowError(error_text, help_link, help_topic_id); 125 webui_handler_->ShowError(error_text, help_link, help_topic_id);
125 } 126 }
126 127
127 // WebUILoginDisplay, LoginUIHandlerDelegate implementation: ------------------- 128 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: --------------
129 void WebUILoginDisplay::SetWebUIHandler(
130 LoginDisplayWebUIHandler* webui_handler) {
131 webui_handler_ = webui_handler;
132 }
128 133
129 void WebUILoginDisplay::Login(const std::string& username, 134 void WebUILoginDisplay::Login(const std::string& username,
130 const std::string& password) { 135 const std::string& password) {
131 DCHECK(delegate_); 136 DCHECK(delegate_);
132 delegate_->Login(username, password); 137 delegate_->Login(username, password);
133 } 138 }
134 139
135 void WebUILoginDisplay::LoginAsGuest() { 140 void WebUILoginDisplay::LoginAsGuest() {
136 DCHECK(delegate_); 141 DCHECK(delegate_);
137 delegate_->LoginAsGuest(); 142 delegate_->LoginAsGuest();
138 } 143 }
139 144
140 // WebUILoginDisplay, private: ------------------------------------------------- 145 // WebUILoginDisplay, private: -------------------------------------------------
141 146
142 // Singleton implementation: --------------------------------------------------- 147 // Singleton implementation: ---------------------------------------------------
143 148
144 WebUILoginDisplay::WebUILoginDisplay() 149 WebUILoginDisplay::WebUILoginDisplay()
145 : LoginDisplay(NULL, gfx::Rect()), 150 : LoginDisplay(NULL, gfx::Rect()),
146 LoginUIHandlerDelegate(), 151 login_window_(NULL),
147 login_window_(NULL) { 152 webui_handler_(NULL) {
148 } 153 }
149 154
150 } // namespace chromeos 155 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698