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

Side by Side Diff: chrome/browser/chromeos/login/users/fake_user_manager.cc

Issue 312023002: Sync starting language and input method preferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/users/fake_user_manager.h" 5 #include "chrome/browser/chromeos/login/users/fake_user_manager.h"
6 6
7 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" 7 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h"
8 #include "chrome/browser/chromeos/profiles/profile_helper.h" 8 #include "chrome/browser/chromeos/profiles/profile_helper.h"
9 #include "components/user_manager/user_type.h" 9 #include "components/user_manager/user_type.h"
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void FakeUserManager::UserLoggedIn(const std::string& email, 77 void FakeUserManager::UserLoggedIn(const std::string& email,
78 const std::string& username_hash, 78 const std::string& username_hash,
79 bool browser_restart) { 79 bool browser_restart) {
80 for (UserList::const_iterator it = user_list_.begin(); 80 for (UserList::const_iterator it = user_list_.begin();
81 it != user_list_.end(); 81 it != user_list_.end();
82 ++it) { 82 ++it) {
83 if ((*it)->username_hash() == username_hash) { 83 if ((*it)->username_hash() == username_hash) {
84 (*it)->set_is_logged_in(true); 84 (*it)->set_is_logged_in(true);
85 logged_in_users_.push_back(*it); 85 logged_in_users_.push_back(*it);
86 (*it)->set_is_active(true);
dzhioev (left Google) 2014/07/23 11:02:20 Same true for these lines. Could you please rebase
michaelpg 2014/07/25 23:49:08 Done and done.
87 active_user_id_ = (*it)->email();
86 88
87 if (!primary_user_) 89 if (!primary_user_)
88 primary_user_ = *it; 90 primary_user_ = *it;
89 break; 91 break;
90 } 92 }
91 } 93 }
92 } 94 }
93 95
94 User* FakeUserManager::GetActiveUserInternal() const { 96 User* FakeUserManager::GetActiveUserInternal() const {
95 if (user_list_.size()) { 97 if (user_list_.size()) {
(...skipping 12 matching lines...) Expand all
108 const User* FakeUserManager::GetActiveUser() const { 110 const User* FakeUserManager::GetActiveUser() const {
109 return GetActiveUserInternal(); 111 return GetActiveUserInternal();
110 } 112 }
111 113
112 User* FakeUserManager::GetActiveUser() { 114 User* FakeUserManager::GetActiveUser() {
113 return GetActiveUserInternal(); 115 return GetActiveUserInternal();
114 } 116 }
115 117
116 void FakeUserManager::SwitchActiveUser(const std::string& email) { 118 void FakeUserManager::SwitchActiveUser(const std::string& email) {
117 active_user_id_ = email; 119 active_user_id_ = email;
120 if (user_list_.size() && !active_user_id_.empty()) {
121 for (UserList::const_iterator it = user_list_.begin();
122 it != user_list_.end(); ++it) {
123 if ((*it)->email() == active_user_id_)
124 (*it)->set_is_active(true);
dzhioev (left Google) 2014/07/24 20:31:34 Currently active user should be marked as inactive
michaelpg 2014/07/25 23:49:08 Done.
125 }
126 }
118 } 127 }
119 128
120 void FakeUserManager::SaveUserDisplayName( 129 void FakeUserManager::SaveUserDisplayName(
121 const std::string& username, 130 const std::string& username,
122 const base::string16& display_name) { 131 const base::string16& display_name) {
123 for (UserList::iterator it = user_list_.begin(); 132 for (UserList::iterator it = user_list_.begin();
124 it != user_list_.end(); ++it) { 133 it != user_list_.end(); ++it) {
125 if ((*it)->email() == username) { 134 if ((*it)->email() == username) {
126 (*it)->set_display_name(display_name); 135 (*it)->set_display_name(display_name);
127 return; 136 return;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 272
264 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const { 273 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const {
265 return NULL; 274 return NULL;
266 } 275 }
267 276
268 bool FakeUserManager::AreLocallyManagedUsersAllowed() const { 277 bool FakeUserManager::AreLocallyManagedUsersAllowed() const {
269 return true; 278 return true;
270 } 279 }
271 280
272 } // namespace chromeos 281 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698