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

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

Issue 398753004: [cros] Move User class to user_manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 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" 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
(...skipping 23 matching lines...) Expand all
34 InitOwnerUserList(); 34 InitOwnerUserList();
35 oobe_ui_->web_ui()->CallJavascriptFunction( 35 oobe_ui_->web_ui()->CallJavascriptFunction(
36 "login.AccountPickerScreen.setShouldShowApps", 36 "login.AccountPickerScreen.setShouldShowApps",
37 base::FundamentalValue(false)); 37 base::FundamentalValue(false));
38 oobe_ui_->ShowSigninScreen(LoginScreenContext(), this, NULL); 38 oobe_ui_->ShowSigninScreen(LoginScreenContext(), this, NULL);
39 } 39 }
40 40
41 void AppLaunchSigninScreen::InitOwnerUserList() { 41 void AppLaunchSigninScreen::InitOwnerUserList() {
42 UserManager* user_manager = GetUserManager(); 42 UserManager* user_manager = GetUserManager();
43 const std::string& owner_email = user_manager->GetOwnerEmail(); 43 const std::string& owner_email = user_manager->GetOwnerEmail();
44 const UserList& all_users = user_manager->GetUsers(); 44 const user_manager::UserList& all_users = user_manager->GetUsers();
45 45
46 owner_user_list_.clear(); 46 owner_user_list_.clear();
47 for (UserList::const_iterator it = all_users.begin(); 47 for (user_manager::UserList::const_iterator it = all_users.begin();
48 it != all_users.end(); 48 it != all_users.end();
49 ++it) { 49 ++it) {
50 User* user = *it; 50 user_manager::User* user = *it;
51 if (user->email() == owner_email) { 51 if (user->email() == owner_email) {
52 owner_user_list_.push_back(user); 52 owner_user_list_.push_back(user);
53 break; 53 break;
54 } 54 }
55 } 55 }
56 } 56 }
57 57
58 // static 58 // static
59 void AppLaunchSigninScreen::SetUserManagerForTesting( 59 void AppLaunchSigninScreen::SetUserManagerForTesting(
60 UserManager* user_manager) { 60 UserManager* user_manager) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 LoginDisplayWebUIHandler* webui_handler) { 134 LoginDisplayWebUIHandler* webui_handler) {
135 webui_handler_ = webui_handler; 135 webui_handler_ = webui_handler;
136 } 136 }
137 137
138 void AppLaunchSigninScreen::ShowSigninScreenForCreds( 138 void AppLaunchSigninScreen::ShowSigninScreenForCreds(
139 const std::string& username, 139 const std::string& username,
140 const std::string& password) { 140 const std::string& password) {
141 NOTREACHED(); 141 NOTREACHED();
142 } 142 }
143 143
144 const UserList& AppLaunchSigninScreen::GetUsers() const { 144 const user_manager::UserList& AppLaunchSigninScreen::GetUsers() const {
145 if (test_user_manager_) { 145 if (test_user_manager_) {
146 return test_user_manager_->GetUsers(); 146 return test_user_manager_->GetUsers();
147 } 147 }
148 return owner_user_list_; 148 return owner_user_list_;
149 } 149 }
150 150
151 bool AppLaunchSigninScreen::IsShowGuest() const { 151 bool AppLaunchSigninScreen::IsShowGuest() const {
152 return false; 152 return false;
153 } 153 }
154 154
(...skipping 27 matching lines...) Expand all
182 std::string(), 182 std::string(),
183 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE); 183 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE);
184 } 184 }
185 185
186 void AppLaunchSigninScreen::OnAuthSuccess(const UserContext& user_context) { 186 void AppLaunchSigninScreen::OnAuthSuccess(const UserContext& user_context) {
187 delegate_->OnOwnerSigninSuccess(); 187 delegate_->OnOwnerSigninSuccess();
188 } 188 }
189 189
190 void AppLaunchSigninScreen::HandleGetUsers() { 190 void AppLaunchSigninScreen::HandleGetUsers() {
191 base::ListValue users_list; 191 base::ListValue users_list;
192 const UserList& users = GetUsers(); 192 const user_manager::UserList& users = GetUsers();
193 193
194 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { 194 for (user_manager::UserList::const_iterator it = users.begin();
195 it != users.end();
196 ++it) {
195 ScreenlockBridge::LockHandler::AuthType initial_auth_type = 197 ScreenlockBridge::LockHandler::AuthType initial_auth_type =
196 UserSelectionScreen::ShouldForceOnlineSignIn(*it) 198 UserSelectionScreen::ShouldForceOnlineSignIn(*it)
197 ? ScreenlockBridge::LockHandler::ONLINE_SIGN_IN 199 ? ScreenlockBridge::LockHandler::ONLINE_SIGN_IN
198 : ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; 200 : ScreenlockBridge::LockHandler::OFFLINE_PASSWORD;
199 base::DictionaryValue* user_dict = new base::DictionaryValue(); 201 base::DictionaryValue* user_dict = new base::DictionaryValue();
200 UserSelectionScreen::FillUserDictionary( 202 UserSelectionScreen::FillUserDictionary(
201 *it, true, false, initial_auth_type, user_dict); 203 *it, true, false, initial_auth_type, user_dict);
202 users_list.Append(user_dict); 204 users_list.Append(user_dict);
203 } 205 }
204 206
205 webui_handler_->LoadUsers(users_list, false); 207 webui_handler_->LoadUsers(users_list, false);
206 } 208 }
207 209
208 void AppLaunchSigninScreen::SetAuthType( 210 void AppLaunchSigninScreen::SetAuthType(
209 const std::string& username, 211 const std::string& username,
210 ScreenlockBridge::LockHandler::AuthType auth_type) { 212 ScreenlockBridge::LockHandler::AuthType auth_type) {
211 return; 213 return;
212 } 214 }
213 215
214 ScreenlockBridge::LockHandler::AuthType AppLaunchSigninScreen::GetAuthType( 216 ScreenlockBridge::LockHandler::AuthType AppLaunchSigninScreen::GetAuthType(
215 const std::string& username) const { 217 const std::string& username) const {
216 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; 218 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD;
217 } 219 }
218 220
219 } // namespace chromeos 221 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698