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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/signin/public/interfaces/account_id.typemap ('k') | components/typemaps.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« 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