| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 bool operator!=(const AccountId& other) const; | 26 bool operator!=(const AccountId& other) const; |
| 27 bool operator<(const AccountId& right) const; | 27 bool operator<(const AccountId& right) const; |
| 28 | 28 |
| 29 // empty() is deprecated. Use !is_valid() instead. | 29 // empty() is deprecated. Use !is_valid() instead. |
| 30 bool empty() const; | 30 bool empty() const; |
| 31 bool is_valid() const; | 31 bool is_valid() const; |
| 32 void clear(); | 32 void clear(); |
| 33 | 33 |
| 34 const std::string& GetAccountType() const; | 34 const std::string& GetAccountType() const; |
| 35 const std::string& GetGaiaId() const; | 35 const std::string& GetGaiaId() const; |
| 36 // Users of AccountId should make no assumptions on the format of email. |
| 37 // I.e. it cannot be used as account identifier, because it is (in general) |
| 38 // non-comparable. |
| 36 const std::string& GetUserEmail() const; | 39 const std::string& GetUserEmail() const; |
| 37 | 40 |
| 38 // This returns prefixed GaiaId string to be used as a storage key. | 41 // This returns prefixed some string that can be used as a storage key. |
| 39 const std::string GetGaiaIdKey() const; | 42 // You should make no assumptions on the format of this string. |
| 43 const std::string GetAccountIdKey() const; |
| 40 | 44 |
| 41 void SetGaiaId(const std::string& gaia_id); | 45 void SetGaiaId(const std::string& gaia_id); |
| 42 void SetUserEmail(const std::string& email); | 46 void SetUserEmail(const std::string& email); |
| 43 | 47 |
| 44 // This method is to be used during transition period only. | 48 // This method is to be used during transition period only. |
| 45 static AccountId FromUserEmail(const std::string& user_email); | 49 static AccountId FromUserEmail(const std::string& user_email); |
| 46 // This method is to be used during transition period only. | 50 // This method is to be used during transition period only. |
| 47 static AccountId FromGaiaId(const std::string& gaia_id); | 51 static AccountId FromGaiaId(const std::string& gaia_id); |
| 48 // This method is the preferred way to construct AccountId if you have | 52 // This method is the preferred way to construct AccountId if you have |
| 49 // full account information. | 53 // full account information. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 | 77 |
| 74 // Implement hashing of AccountId, so it can be used as a key in STL containers. | 78 // Implement hashing of AccountId, so it can be used as a key in STL containers. |
| 75 template <> | 79 template <> |
| 76 struct hash<AccountId> { | 80 struct hash<AccountId> { |
| 77 std::size_t operator()(const AccountId& user_id) const; | 81 std::size_t operator()(const AccountId& user_id) const; |
| 78 }; | 82 }; |
| 79 | 83 |
| 80 } // namespace BASE_HASH_NAMESPACE | 84 } // namespace BASE_HASH_NAMESPACE |
| 81 | 85 |
| 82 #endif // COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_ | 86 #endif // COMPONENTS_SIGNIN_CORE_ACCOUNT_ID_ACCOUNT_ID_H_ |
| OLD | NEW |