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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc

Issue 172353002: Fix double wallpaper animation for public pods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 10 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
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ui/webui/chromeos/login/signin_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 void SigninScreenHandler::SendUserList(bool animated) { 1283 void SigninScreenHandler::SendUserList(bool animated) {
1284 if (!delegate_) 1284 if (!delegate_)
1285 return; 1285 return;
1286 TRACE_EVENT_ASYNC_STEP_INTO0("ui", 1286 TRACE_EVENT_ASYNC_STEP_INTO0("ui",
1287 "ShowLoginWebUI", 1287 "ShowLoginWebUI",
1288 LoginDisplayHostImpl::kShowLoginWebUIid, 1288 LoginDisplayHostImpl::kShowLoginWebUIid,
1289 "SendUserList"); 1289 "SendUserList");
1290 BootTimesLoader::Get()->RecordCurrentStats("login-send-user-list"); 1290 BootTimesLoader::Get()->RecordCurrentStats("login-send-user-list");
1291 1291
1292 base::ListValue users_list; 1292 base::ListValue users_list;
1293 size_t first_non_public_account_index = 0;
1294 const UserList& users = delegate_->GetUsers(); 1293 const UserList& users = delegate_->GetUsers();
1295 1294
1296 // TODO(nkostylev): Move to a separate method in UserManager. 1295 // TODO(nkostylev): Move to a separate method in UserManager.
1297 // http://crbug.com/230852 1296 // http://crbug.com/230852
1298 bool is_signin_to_add = LoginDisplayHostImpl::default_host() && 1297 bool is_signin_to_add = LoginDisplayHostImpl::default_host() &&
1299 UserManager::Get()->IsUserLoggedIn(); 1298 UserManager::Get()->IsUserLoggedIn();
1300 1299
1301 bool single_user = users.size() == 1; 1300 bool single_user = users.size() == 1;
1302 std::string owner; 1301 std::string owner;
1303 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); 1302 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner);
1304 bool has_owner = owner.size() > 0; 1303 bool has_owner = owner.size() > 0;
1305 // if public accounts available, that means there's no device owner
1306 size_t max_non_owner_users = has_owner ? kMaxUsers - 1 : kMaxUsers; 1304 size_t max_non_owner_users = has_owner ? kMaxUsers - 1 : kMaxUsers;
1307 size_t non_owner_count = 0; 1305 size_t non_owner_count = 0;
1308 1306
1309 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { 1307 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) {
1310 const std::string& email = (*it)->email(); 1308 const std::string& email = (*it)->email();
1311 bool is_owner = (email == owner); 1309 bool is_owner = (email == owner);
1312 bool is_public_account = 1310 bool is_public_account =
1313 ((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT); 1311 ((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT);
1314 1312
1315 if (is_public_account || non_owner_count < max_non_owner_users || 1313 if (is_public_account || non_owner_count < max_non_owner_users ||
1316 is_owner) { 1314 is_owner) {
1317 base::DictionaryValue* user_dict = new base::DictionaryValue(); 1315 base::DictionaryValue* user_dict = new base::DictionaryValue();
1318 FillUserDictionary(*it, is_owner, is_signin_to_add, user_dict); 1316 FillUserDictionary(*it, is_owner, is_signin_to_add, user_dict);
1319 bool signed_in = (*it)->is_logged_in(); 1317 bool signed_in = (*it)->is_logged_in();
1320 // Single user check here is necessary because owner info might not be 1318 // Single user check here is necessary because owner info might not be
1321 // available when running into login screen on first boot. 1319 // available when running into login screen on first boot.
1322 // See http://crosbug.com/12723 1320 // See http://crosbug.com/12723
1323 bool can_remove_user = !single_user && !email.empty() && !is_owner && 1321 bool can_remove_user = !single_user && !email.empty() && !is_owner &&
1324 !is_public_account && !signed_in && !is_signin_to_add; 1322 !is_public_account && !signed_in && !is_signin_to_add;
1325 user_dict->SetBoolean(kKeyCanRemove, can_remove_user); 1323 user_dict->SetBoolean(kKeyCanRemove, can_remove_user);
1326 1324
1327 if (!is_owner) 1325 if (!is_owner)
1328 ++non_owner_count; 1326 ++non_owner_count;
1329 // public accounts come first in the list 1327
1330 if (is_public_account) { 1328 users_list.Append(user_dict);
1331 users_list.Insert(first_non_public_account_index++, user_dict);
1332 } else {
1333 users_list.Append(user_dict);
1334 }
1335 } 1329 }
1336 } 1330 }
1337 while (users_list.GetSize() > kMaxUsers) 1331 while (users_list.GetSize() > kMaxUsers)
1338 users_list.Remove(kMaxUsers, NULL); 1332 users_list.Remove(kMaxUsers, NULL);
1339 1333
1340 CallJS("login.AccountPickerScreen.loadUsers", users_list, animated, 1334 CallJS("login.AccountPickerScreen.loadUsers", users_list, animated,
1341 delegate_->IsShowGuest()); 1335 delegate_->IsShowGuest());
1342 } 1336 }
1343 1337
1344 void SigninScreenHandler::HandleAccountPickerReady() { 1338 void SigninScreenHandler::HandleAccountPickerReady() {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 DCHECK(gaia_screen_handler_); 1722 DCHECK(gaia_screen_handler_);
1729 return gaia_screen_handler_->frame_state(); 1723 return gaia_screen_handler_->frame_state();
1730 } 1724 }
1731 1725
1732 net::Error SigninScreenHandler::FrameError() const { 1726 net::Error SigninScreenHandler::FrameError() const {
1733 DCHECK(gaia_screen_handler_); 1727 DCHECK(gaia_screen_handler_);
1734 return gaia_screen_handler_->frame_error(); 1728 return gaia_screen_handler_->frame_error();
1735 } 1729 }
1736 1730
1737 } // namespace chromeos 1731 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698