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

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

Issue 2721553004: Remove auto raw pointer deduction from non-linux specific code. (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_chrome_user_manager.h" 5 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return users_; 355 return users_;
356 } 356 }
357 357
358 user_manager::UserList FakeChromeUserManager::GetUnlockUsers() const { 358 user_manager::UserList FakeChromeUserManager::GetUnlockUsers() const {
359 return users_; 359 return users_;
360 } 360 }
361 361
362 void FakeChromeUserManager::UserLoggedIn(const AccountId& account_id, 362 void FakeChromeUserManager::UserLoggedIn(const AccountId& account_id,
363 const std::string& username_hash, 363 const std::string& username_hash,
364 bool browser_restart) { 364 bool browser_restart) {
365 for (const auto& user : users_) { 365 for (auto* user : users_) {
danakj 2017/02/28 15:33:30 const?
vmpstr 2017/02/28 21:48:27 Can't here, assigning it to primary_user_ which is
366 if (user->username_hash() == username_hash) { 366 if (user->username_hash() == username_hash) {
367 user->set_is_logged_in(true); 367 user->set_is_logged_in(true);
368 user->set_profile_is_created(); 368 user->set_profile_is_created();
369 logged_in_users_.push_back(user); 369 logged_in_users_.push_back(user);
370 370
371 if (!primary_user_) 371 if (!primary_user_)
372 primary_user_ = user; 372 primary_user_ = user;
373 break; 373 break;
374 } 374 }
375 } 375 }
376 } 376 }
377 377
378 void FakeChromeUserManager::SwitchToLastActiveUser() { 378 void FakeChromeUserManager::SwitchToLastActiveUser() {
379 NOTREACHED(); 379 NOTREACHED();
380 } 380 }
381 381
382 bool FakeChromeUserManager::IsKnownUser(const AccountId& account_id) const { 382 bool FakeChromeUserManager::IsKnownUser(const AccountId& account_id) const {
383 return true; 383 return true;
384 } 384 }
385 385
386 const user_manager::User* FakeChromeUserManager::FindUser( 386 const user_manager::User* FakeChromeUserManager::FindUser(
387 const AccountId& account_id) const { 387 const AccountId& account_id) const {
388 if (active_user_ != nullptr && active_user_->GetAccountId() == account_id) 388 if (active_user_ != nullptr && active_user_->GetAccountId() == account_id)
389 return active_user_; 389 return active_user_;
390 390
391 const user_manager::UserList& users = GetUsers(); 391 const user_manager::UserList& users = GetUsers();
392 for (const auto& user : users) { 392 for (auto* user : users) {
danakj 2017/02/28 15:33:30 const?
vmpstr 2017/02/28 21:48:27 Done.
393 if (user->GetAccountId() == account_id) 393 if (user->GetAccountId() == account_id)
394 return user; 394 return user;
395 } 395 }
396 396
397 return nullptr; 397 return nullptr;
398 } 398 }
399 399
400 user_manager::User* FakeChromeUserManager::FindUserAndModify( 400 user_manager::User* FakeChromeUserManager::FindUserAndModify(
401 const AccountId& account_id) { 401 const AccountId& account_id) {
402 return nullptr; 402 return nullptr;
(...skipping 18 matching lines...) Expand all
421 } 421 }
422 422
423 void FakeChromeUserManager::SaveForceOnlineSignin(const AccountId& account_id, 423 void FakeChromeUserManager::SaveForceOnlineSignin(const AccountId& account_id,
424 bool force_online_signin) { 424 bool force_online_signin) {
425 NOTREACHED(); 425 NOTREACHED();
426 } 426 }
427 427
428 void FakeChromeUserManager::SaveUserDisplayName( 428 void FakeChromeUserManager::SaveUserDisplayName(
429 const AccountId& account_id, 429 const AccountId& account_id,
430 const base::string16& display_name) { 430 const base::string16& display_name) {
431 for (const auto& user : users_) { 431 for (auto* user : users_) {
432 if (user->GetAccountId() == account_id) { 432 if (user->GetAccountId() == account_id) {
433 user->set_display_name(display_name); 433 user->set_display_name(display_name);
434 return; 434 return;
435 } 435 }
436 } 436 }
437 } 437 }
438 438
439 base::string16 FakeChromeUserManager::GetUserDisplayName( 439 base::string16 FakeChromeUserManager::GetUserDisplayName(
440 const AccountId& account_id) const { 440 const AccountId& account_id) const {
441 return base::string16(); 441 return base::string16();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return false; 617 return false;
618 } 618 }
619 619
620 user_manager::User* FakeChromeUserManager::GetActiveUserInternal() const { 620 user_manager::User* FakeChromeUserManager::GetActiveUserInternal() const {
621 if (active_user_ != nullptr) 621 if (active_user_ != nullptr)
622 return active_user_; 622 return active_user_;
623 623
624 if (users_.empty()) 624 if (users_.empty())
625 return nullptr; 625 return nullptr;
626 if (active_account_id_.is_valid()) { 626 if (active_account_id_.is_valid()) {
627 for (const auto& user : users_) { 627 for (auto* user : users_) {
628 if (user->GetAccountId() == active_account_id_) 628 if (user->GetAccountId() == active_account_id_)
629 return user; 629 return user;
630 } 630 }
631 } 631 }
632 return users_[0]; 632 return users_[0];
633 } 633 }
634 634
635 } // namespace chromeos 635 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698