OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_ |
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_ | 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "services/service_manager/public/cpp/identity.h" | 8 #include "services/service_manager/public/cpp/identity.h" |
9 #include "services/service_manager/public/interfaces/connector.mojom.h" | 9 #include "services/service_manager/public/interfaces/connector.mojom.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 | 12 |
13 template <> | 13 template <> |
14 struct StructTraits<shell::mojom::IdentityDataView, shell::Identity> { | 14 struct StructTraits<service_manager::mojom::IdentityDataView, |
15 static const std::string& name(const shell::Identity& identity) { | 15 service_manager::Identity> { |
| 16 static const std::string& name(const service_manager::Identity& identity) { |
16 return identity.name(); | 17 return identity.name(); |
17 } | 18 } |
18 static const std::string& user_id(const shell::Identity& identity) { | 19 static const std::string& user_id(const service_manager::Identity& identity) { |
19 return identity.user_id(); | 20 return identity.user_id(); |
20 } | 21 } |
21 static const std::string& instance(const shell::Identity& identity) { | 22 static const std::string& instance( |
| 23 const service_manager::Identity& identity) { |
22 return identity.instance(); | 24 return identity.instance(); |
23 } | 25 } |
24 static bool Read(shell::mojom::IdentityDataView data, shell::Identity* out) { | 26 static bool Read(service_manager::mojom::IdentityDataView data, |
| 27 service_manager::Identity* out) { |
25 std::string name, user_id, instance; | 28 std::string name, user_id, instance; |
26 if (!data.ReadName(&name)) | 29 if (!data.ReadName(&name)) |
27 return false; | 30 return false; |
28 | 31 |
29 if (!data.ReadUserId(&user_id)) | 32 if (!data.ReadUserId(&user_id)) |
30 return false; | 33 return false; |
31 | 34 |
32 if (!data.ReadInstance(&instance)) | 35 if (!data.ReadInstance(&instance)) |
33 return false; | 36 return false; |
34 | 37 |
35 *out = shell::Identity(name, user_id, instance); | 38 *out = service_manager::Identity(name, user_id, instance); |
36 return true; | 39 return true; |
37 } | 40 } |
38 }; | 41 }; |
39 | 42 |
40 } // namespace mojo | 43 } // namespace mojo |
41 | 44 |
42 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_ | 45 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_ |
OLD | NEW |