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 URL_MOJO_ORIGIN_STRUCT_TRAITS_H_ | 5 #ifndef URL_MOJO_ORIGIN_STRUCT_TRAITS_H_ |
6 #define URL_MOJO_ORIGIN_STRUCT_TRAITS_H_ | 6 #define URL_MOJO_ORIGIN_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "url/mojo/origin.mojom.h" | 9 #include "url/mojo/origin.mojom.h" |
10 #include "url/origin.h" | 10 #include "url/origin.h" |
11 | 11 |
12 namespace mojo { | 12 namespace mojo { |
13 | 13 |
14 template <> | 14 template <> |
15 struct StructTraits<url::mojom::Origin, url::Origin> { | 15 struct StructTraits<url::mojom::OriginDataView, url::Origin> { |
16 static const std::string& scheme(const url::Origin& r) { return r.scheme(); } | 16 static const std::string& scheme(const url::Origin& r) { return r.scheme(); } |
17 static const std::string& host(const url::Origin& r) { return r.host(); } | 17 static const std::string& host(const url::Origin& r) { return r.host(); } |
18 static uint16_t port(const url::Origin& r) { | 18 static uint16_t port(const url::Origin& r) { |
19 return r.port(); | 19 return r.port(); |
20 } | 20 } |
21 static bool unique(const url::Origin& r) { | 21 static bool unique(const url::Origin& r) { |
22 return r.unique(); | 22 return r.unique(); |
23 } | 23 } |
24 static bool Read(url::mojom::OriginDataView data, url::Origin* out) { | 24 static bool Read(url::mojom::OriginDataView data, url::Origin* out) { |
25 if (data.unique()) { | 25 if (data.unique()) { |
(...skipping 13 matching lines...) Expand all Loading... |
39 if (!data.unique() && out->unique()) | 39 if (!data.unique() && out->unique()) |
40 return false; | 40 return false; |
41 | 41 |
42 return true; | 42 return true; |
43 } | 43 } |
44 }; | 44 }; |
45 | 45 |
46 } | 46 } |
47 | 47 |
48 #endif // URL_MOJO_ORIGIN_STRUCT_TRAITS_H_ | 48 #endif // URL_MOJO_ORIGIN_STRUCT_TRAITS_H_ |
OLD | NEW |