Chromium Code Reviews| Index: components/signin/public/interfaces/account_id_traits.h |
| diff --git a/components/signin/public/interfaces/account_id_traits.h b/components/signin/public/interfaces/account_id_traits.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5360345d71e6dc71a56a0126056155f4d6557e19 |
| --- /dev/null |
| +++ b/components/signin/public/interfaces/account_id_traits.h |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_SIGNIN_PUBLIC_INTERFACES_ACCOUNT_ID_TRAITS_H_ |
| +#define COMPONENTS_SIGNIN_PUBLIC_INTERFACES_ACCOUNT_ID_TRAITS_H_ |
| + |
| +#include <string> |
| + |
| +#include "components/signin/core/account_id/account_id.h" |
| +#include "components/signin/public/interfaces/account_id.mojom.h" |
| + |
| +namespace mojo { |
| + |
| +template <> |
| +struct StructTraits<signin::mojom::AccountIdDataView, AccountId> { |
| + static std::string serialized(const AccountId& r) { |
| + return r.Serialize(); |
| + } |
| + static bool Read(signin::mojom::AccountIdDataView data, AccountId* out) { |
| + std::string serialized; |
| + if (!data.ReadSerialized(&serialized)) |
| + return false; |
| + |
| + 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
|
| + return false; |
| + |
| + return out->is_valid(); |
| + } |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // COMPONENTS_SIGNIN_PUBLIC_INTERFACES_ACCOUNT_ID_TRAITS_H_ |