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 #include "components/signin/core/account_id/account_id.h" | 5 #include "components/signin/core/account_id/account_id.h" |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 case AccountType::UNKNOWN: | 313 case AccountType::UNKNOWN: |
314 if (!found_user_email) | 314 if (!found_user_email) |
315 return false; | 315 return false; |
316 *account_id = FromUserEmail(user_email); | 316 *account_id = FromUserEmail(user_email); |
317 return true; | 317 return true; |
318 } | 318 } |
319 return false; | 319 return false; |
320 } | 320 } |
321 | 321 |
| 322 std::ostream& operator<<(std::ostream& stream, const AccountId& account_id) { |
| 323 stream << "{id: " << account_id.id_ << ", email: " << account_id.user_email_ |
| 324 << ", type: " |
| 325 << static_cast< |
| 326 std::underlying_type<decltype(account_id.account_type_)>::type>( |
| 327 account_id.account_type_) |
| 328 << "}"; |
| 329 return stream; |
| 330 } |
| 331 |
322 const AccountId& EmptyAccountId() { | 332 const AccountId& EmptyAccountId() { |
323 return AccountId::EmptyAccountId::GetInstance()->user_id; | 333 return AccountId::EmptyAccountId::GetInstance()->user_id; |
324 } | 334 } |
325 | 335 |
326 namespace BASE_HASH_NAMESPACE { | 336 namespace BASE_HASH_NAMESPACE { |
327 | 337 |
328 std::size_t hash<AccountId>::operator()(const AccountId& user_id) const { | 338 std::size_t hash<AccountId>::operator()(const AccountId& user_id) const { |
329 return hash<std::string>()(user_id.GetUserEmail()); | 339 return hash<std::string>()(user_id.GetUserEmail()); |
330 } | 340 } |
331 | 341 |
332 } // namespace BASE_HASH_NAMESPACE | 342 } // namespace BASE_HASH_NAMESPACE |
OLD | NEW |