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

Side by Side Diff: components/signin/public/interfaces/account_id_traits.h

Issue 2617763003: Add a mojo interface for AccountId (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « components/signin/public/interfaces/account_id.typemap ('k') | components/typemaps.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « components/signin/public/interfaces/account_id.typemap ('k') | components/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698