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/chromeos/login/app_launch_signin_screen.h" | 5 #include "chrome/browser/chromeos/login/app_launch_signin_screen.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 8 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
9 #include "chrome/browser/chromeos/login/login_utils.h" | 9 #include "chrome/browser/chromeos/login/login_utils.h" |
| 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| 11 #include "chrome/browser/signin/screenlock_bridge.h" |
10 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 12 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
13 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
15 | 17 |
16 namespace chromeos { | 18 namespace chromeos { |
17 | 19 |
18 UserManager* AppLaunchSigninScreen::test_user_manager_ = NULL; | 20 UserManager* AppLaunchSigninScreen::test_user_manager_ = NULL; |
19 | 21 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 webui_handler_ = webui_handler; | 146 webui_handler_ = webui_handler; |
145 } | 147 } |
146 | 148 |
147 void AppLaunchSigninScreen::ShowSigninScreenForCreds( | 149 void AppLaunchSigninScreen::ShowSigninScreenForCreds( |
148 const std::string& username, | 150 const std::string& username, |
149 const std::string& password) { | 151 const std::string& password) { |
150 NOTREACHED(); | 152 NOTREACHED(); |
151 } | 153 } |
152 | 154 |
153 const UserList& AppLaunchSigninScreen::GetUsers() const { | 155 const UserList& AppLaunchSigninScreen::GetUsers() const { |
| 156 if (test_user_manager_) { |
| 157 return test_user_manager_->GetUsers(); |
| 158 } |
154 return owner_user_list_; | 159 return owner_user_list_; |
155 } | 160 } |
156 | 161 |
157 bool AppLaunchSigninScreen::IsShowGuest() const { | 162 bool AppLaunchSigninScreen::IsShowGuest() const { |
158 return false; | 163 return false; |
159 } | 164 } |
160 | 165 |
161 bool AppLaunchSigninScreen::IsShowUsers() const { | 166 bool AppLaunchSigninScreen::IsShowUsers() const { |
162 return true; | 167 return true; |
163 } | 168 } |
164 | 169 |
165 bool AppLaunchSigninScreen::IsShowNewUser() const { | |
166 return false; | |
167 } | |
168 | |
169 bool AppLaunchSigninScreen::IsSigninInProgress() const { | 170 bool AppLaunchSigninScreen::IsSigninInProgress() const { |
170 // Return true to suppress network processing in the signin screen. | 171 // Return true to suppress network processing in the signin screen. |
171 return true; | 172 return true; |
172 } | 173 } |
173 | 174 |
174 bool AppLaunchSigninScreen::IsUserSigninCompleted() const { | 175 bool AppLaunchSigninScreen::IsUserSigninCompleted() const { |
175 return false; | 176 return false; |
176 } | 177 } |
177 | 178 |
178 void AppLaunchSigninScreen::SetDisplayEmail(const std::string& email) { | 179 void AppLaunchSigninScreen::SetDisplayEmail(const std::string& email) { |
(...skipping 16 matching lines...) Expand all Loading... |
195 0, | 196 0, |
196 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING_KIOSK), | 197 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING_KIOSK), |
197 std::string(), | 198 std::string(), |
198 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); | 199 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); |
199 } | 200 } |
200 | 201 |
201 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context) { | 202 void AppLaunchSigninScreen::OnLoginSuccess(const UserContext& user_context) { |
202 delegate_->OnOwnerSigninSuccess(); | 203 delegate_->OnOwnerSigninSuccess(); |
203 } | 204 } |
204 | 205 |
| 206 void AppLaunchSigninScreen::HandleGetUsers() { |
| 207 base::ListValue users_list; |
| 208 const UserList& users = GetUsers(); |
| 209 |
| 210 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| 211 ScreenlockBridge::LockHandler::AuthType initial_auth_type = |
| 212 UserSelectionScreen::ShouldForceOnlineSignIn(*it) |
| 213 ? ScreenlockBridge::LockHandler::ONLINE_SIGN_IN |
| 214 : ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| 215 base::DictionaryValue* user_dict = new base::DictionaryValue(); |
| 216 UserSelectionScreen::FillUserDictionary( |
| 217 *it, true, false, initial_auth_type, user_dict); |
| 218 users_list.Append(user_dict); |
| 219 } |
| 220 |
| 221 webui_handler_->LoadUsers(users_list, false, false); |
| 222 } |
| 223 |
| 224 void AppLaunchSigninScreen::SetAuthType( |
| 225 const std::string& username, |
| 226 ScreenlockBridge::LockHandler::AuthType auth_type) { |
| 227 return; |
| 228 } |
| 229 |
| 230 ScreenlockBridge::LockHandler::AuthType AppLaunchSigninScreen::GetAuthType( |
| 231 const std::string& username) const { |
| 232 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| 233 } |
| 234 |
205 } // namespace chromeos | 235 } // namespace chromeos |
OLD | NEW |