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

Side by Side Diff: services/shell/public/cpp/identity_struct_traits.h

Issue 2419063003: Move services/shell to services/service_manager (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2016 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 SERVICES_SHELL_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
7
8 #include "services/shell/public/cpp/identity.h"
9 #include "services/shell/public/interfaces/connector.mojom.h"
10
11 namespace mojo {
12
13 template <>
14 struct StructTraits<shell::mojom::IdentityDataView, shell::Identity> {
15 static const std::string& name(const shell::Identity& identity) {
16 return identity.name();
17 }
18 static const std::string& user_id(const shell::Identity& identity) {
19 return identity.user_id();
20 }
21 static const std::string& instance(const shell::Identity& identity) {
22 return identity.instance();
23 }
24 static bool Read(shell::mojom::IdentityDataView data, shell::Identity* out) {
25 std::string name, user_id, instance;
26 if (!data.ReadName(&name))
27 return false;
28
29 if (!data.ReadUserId(&user_id))
30 return false;
31
32 if (!data.ReadInstance(&instance))
33 return false;
34
35 *out = shell::Identity(name, user_id, instance);
36 return true;
37 }
38 };
39
40 } // namespace mojo
41
42 #endif // SERVICES_SHELL_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/identity.typemap ('k') | services/shell/public/cpp/interface_binder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698