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

Side by Side Diff: components/user_manager/user_manager.cc

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/FindUsingSAML/IsUsingSAML/ Created 5 years 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
« no previous file with comments | « components/user_manager/user_manager.h ('k') | components/user_manager/user_manager_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/user_manager/user_manager.h" 5 #include "components/user_manager/user_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chromeos/login/user_names.h" 8 #include "chromeos/login/user_names.h"
9 #include "components/signin/core/account_id/account_id.h" 9 #include "components/signin/core/account_id/account_id.h"
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return UserManager::instance; 80 return UserManager::instance;
81 } 81 }
82 82
83 // static 83 // static
84 UserManager* UserManager::SetForTesting(UserManager* user_manager) { 84 UserManager* UserManager::SetForTesting(UserManager* user_manager) {
85 UserManager* previous_instance = UserManager::instance; 85 UserManager* previous_instance = UserManager::instance;
86 UserManager::instance = user_manager; 86 UserManager::instance = user_manager;
87 return previous_instance; 87 return previous_instance;
88 } 88 }
89 89
90 // static
91 AccountId UserManager::GetKnownUserAccountId(const std::string& user_email,
92 const std::string& gaia_id) {
93 // In tests empty accounts are possible.
94 if (user_email.empty() && gaia_id.empty())
95 return EmptyAccountId();
96
97 if (user_email == chromeos::login::kStubUser)
98 return chromeos::login::StubAccountId();
99
100 if (user_email == chromeos::login::kGuestUserName)
101 return chromeos::login::GuestAccountId();
102
103 UserManager* user_manager = Get();
104 if (user_manager)
105 return user_manager->GetKnownUserAccountIdImpl(user_email, gaia_id);
106
107 // This is fallback for tests.
108 return (gaia_id.empty()
109 ? AccountId::FromUserEmail(user_email)
110 : AccountId::FromUserEmailGaiaId(user_email, gaia_id));
111 }
112
113 } // namespace user_manager 90 } // namespace user_manager
OLDNEW
« no previous file with comments | « components/user_manager/user_manager.h ('k') | components/user_manager/user_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698