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

Side by Side Diff: components/signin/core/account_id/account_id.h

Issue 1454153002: Revert of This CL replaces e-mail with AccountId on user selection screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 #ifndef COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_ 5 #ifndef COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_
6 #define COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_ 6 #define COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 // This method is to be used during transition period only. 39 // This method is to be used during transition period only.
40 static AccountId FromUserEmail(const std::string& user_email); 40 static AccountId FromUserEmail(const std::string& user_email);
41 // This method is to be used during transition period only. 41 // This method is to be used during transition period only.
42 static AccountId FromGaiaId(const std::string& gaia_id); 42 static AccountId FromGaiaId(const std::string& gaia_id);
43 // This method is the preferred way to construct AccountId if you have 43 // This method is the preferred way to construct AccountId if you have
44 // full account information. 44 // full account information.
45 static AccountId FromUserEmailGaiaId(const std::string& user_email, 45 static AccountId FromUserEmailGaiaId(const std::string& user_email,
46 const std::string& gaia_id); 46 const std::string& gaia_id);
47 47
48 // These are (for now) unstable and cannot be used to store serialized data to 48 // std::string Serialize() const;
49 // persistent storage. Only in-memory storage is safe. 49 // static AccountId Deserialize(const std::string& serialized);
50 // Serialize() returns JSON dictionary,
51 // Deserialize() restores AccountId after serialization.
52 std::string Serialize() const;
53 static bool Deserialize(const std::string& serialized,
54 AccountId* out_account_id);
55 50
56 private: 51 private:
57 AccountId(); 52 AccountId();
58 AccountId(const std::string& gaia_id, const std::string& user_email); 53 AccountId(const std::string& gaia_id, const std::string& user_email);
59 54
60 std::string gaia_id_; 55 std::string gaia_id_;
61 std::string user_email_; 56 std::string user_email_;
62 }; 57 };
63 58
64 // Returns a reference to a singleton. 59 // Returns a reference to a singleton.
65 const AccountId& EmptyAccountId(); 60 const AccountId& EmptyAccountId();
66 61
67 namespace BASE_HASH_NAMESPACE { 62 namespace BASE_HASH_NAMESPACE {
68 63
69 // Implement hashing of AccountId, so it can be used as a key in STL containers. 64 // Implement hashing of AccountId, so it can be used as a key in STL containers.
70 template <> 65 template <>
71 struct hash<AccountId> { 66 struct hash<AccountId> {
72 std::size_t operator()(const AccountId& user_id) const; 67 std::size_t operator()(const AccountId& user_id) const;
73 }; 68 };
74 69
75 } // namespace BASE_HASH_NAMESPACE 70 } // namespace BASE_HASH_NAMESPACE
76 71
77 #endif // COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_ 72 #endif // COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_
OLDNEW
« no previous file with comments | « components/login/base_screen_handler_utils.cc ('k') | components/signin/core/account_id/account_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698