Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SIGNIN_PUBLIC_INTERFACES_ACCOUNT_ID_TRAITS_H_ | |
| 6 #define COMPONENTS_SIGNIN_PUBLIC_INTERFACES_ACCOUNT_ID_TRAITS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "components/signin/core/account_id/account_id.h" | |
| 11 #include "components/signin/public/interfaces/account_id.mojom.h" | |
| 12 | |
| 13 namespace mojo { | |
| 14 | |
| 15 template <> | |
| 16 struct StructTraits<signin::mojom::AccountIdDataView, AccountId> { | |
| 17 static std::string serialized(const AccountId& r) { | |
| 18 return r.Serialize(); | |
| 19 } | |
| 20 static bool Read(signin::mojom::AccountIdDataView data, AccountId* out) { | |
| 21 std::string serialized; | |
| 22 if (!data.ReadSerialized(&serialized)) | |
| 23 return false; | |
| 24 | |
| 25 if (!AccountId::Deserialize(serialized, out)) | |
|
Tom Sepez
2017/01/05 23:53:28
Is this ever called on the browser side or in anot
xiyuan
2017/01/06 00:22:47
This runs in browser and (ash process in mash). Cu
xiyuan
2017/01/06 16:41:57
Let me change signin.mojom.AccountId to a similar
| |
| 26 return false; | |
| 27 | |
| 28 return out->is_valid(); | |
| 29 } | |
| 30 }; | |
| 31 | |
| 32 } // namespace mojo | |
| 33 | |
| 34 #endif // COMPONENTS_SIGNIN_PUBLIC_INTERFACES_ACCOUNT_ID_TRAITS_H_ | |
| OLD | NEW |