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

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: Changes in progress, probably broken... Created 6 years, 6 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 8
9 namespace { 9 namespace {
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void FakeUserManager::UserLoggedIn(const std::string& email, 71 void FakeUserManager::UserLoggedIn(const std::string& email,
72 const std::string& username_hash, 72 const std::string& username_hash,
73 bool browser_restart) { 73 bool browser_restart) {
74 for (UserList::const_iterator it = user_list_.begin(); 74 for (UserList::const_iterator it = user_list_.begin();
75 it != user_list_.end(); 75 it != user_list_.end();
76 ++it) { 76 ++it) {
77 if ((*it)->username_hash() == username_hash) { 77 if ((*it)->username_hash() == username_hash) {
78 (*it)->set_is_logged_in(true); 78 (*it)->set_is_logged_in(true);
79 logged_in_users_.push_back(*it); 79 logged_in_users_.push_back(*it);
80 (*it)->set_is_active(true);
81 active_user_id_ = (*it)->email();
80 82
81 if (!primary_user_) 83 if (!primary_user_)
82 primary_user_ = *it; 84 primary_user_ = *it;
83 break; 85 break;
84 } 86 }
85 } 87 }
86 } 88 }
87 89
88 User* FakeUserManager::GetActiveUserInternal() const { 90 User* FakeUserManager::GetActiveUserInternal() const {
89 if (user_list_.size()) { 91 if (user_list_.size()) {
(...skipping 12 matching lines...) Expand all
102 const User* FakeUserManager::GetActiveUser() const { 104 const User* FakeUserManager::GetActiveUser() const {
103 return GetActiveUserInternal(); 105 return GetActiveUserInternal();
104 } 106 }
105 107
106 User* FakeUserManager::GetActiveUser() { 108 User* FakeUserManager::GetActiveUser() {
107 return GetActiveUserInternal(); 109 return GetActiveUserInternal();
108 } 110 }
109 111
110 void FakeUserManager::SwitchActiveUser(const std::string& email) { 112 void FakeUserManager::SwitchActiveUser(const std::string& email) {
111 active_user_id_ = email; 113 active_user_id_ = email;
114 if (user_list_.size() && !active_user_id_.empty()) {
115 for (UserList::const_iterator it = user_list_.begin();
116 it != user_list_.end(); ++it) {
117 if ((*it)->email() == active_user_id_)
118 (*it)->set_is_active(true);
119 }
120 }
112 } 121 }
113 122
114 void FakeUserManager::SaveUserDisplayName( 123 void FakeUserManager::SaveUserDisplayName(
115 const std::string& username, 124 const std::string& username,
116 const base::string16& display_name) { 125 const base::string16& display_name) {
117 for (UserList::iterator it = user_list_.begin(); 126 for (UserList::iterator it = user_list_.begin();
118 it != user_list_.end(); ++it) { 127 it != user_list_.end(); ++it) {
119 if ((*it)->email() == username) { 128 if ((*it)->email() == username) {
120 (*it)->set_display_name(display_name); 129 (*it)->set_display_name(display_name);
121 return; 130 return;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 304 }
296 305
297 bool FakeUserManager::RespectLocalePreference( 306 bool FakeUserManager::RespectLocalePreference(
298 Profile* profile, 307 Profile* profile,
299 const User* user, 308 const User* user,
300 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { 309 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const {
301 return false; 310 return false;
302 } 311 }
303 312
304 } // namespace chromeos 313 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698