Index: components/arc/intent_helper/intent_filter_struct_traits.h |
diff --git a/components/arc/intent_helper/intent_filter_struct_traits.h b/components/arc/intent_helper/intent_filter_struct_traits.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca9ba9c1dc93c4c42f72542825d13402d67079a1 |
--- /dev/null |
+++ b/components/arc/intent_helper/intent_filter_struct_traits.h |
@@ -0,0 +1,79 @@ |
+// Copyright 2016 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 COMPONENT_ARC_INTENT_FILTER_INTENT_FILTER_STRUCT_TRAITS_H_ |
+#define COMPONENT_ARC_INTENT_FILTER_INTENT_FILTER_STRUCT_TRAITS_H_ |
+ |
+#include "components/arc/common/intent_helper.mojom.h" |
+#include "components/arc/intent_helper/intent_filter.h" |
+ |
+namespace mojo { |
+ |
+template <> |
+struct StructTraits<arc::mojom::IntentFilterDataView, arc::IntentFilter> { |
+ static const mojo::CArray<std::string> actions(const arc::IntentFilter& r) { |
+ // Returns an empty array. |
+ return mojo::CArray<std::string>(); |
+ } |
+ static const mojo::CArray<std::string> categories( |
+ const arc::IntentFilter& r) { |
+ // Returns an empty array. |
+ return mojo::CArray<std::string>(); |
+ } |
+ static const mojo::CArray<std::string> data_schemes( |
+ const arc::IntentFilter& r) { |
+ // Returns an empty array. |
+ return mojo::CArray<std::string>(); |
+ } |
+ static const std::vector<arc::IntentFilter::AuthorityEntry>& data_authorities( |
+ const arc::IntentFilter& r) { |
+ return r.authorities(); |
+ } |
+ static const std::vector<arc::IntentFilter::PatternMatcher>& data_paths( |
+ const arc::IntentFilter& r) { |
+ return r.paths(); |
+ } |
+ static const mojo::CArray<arc::IntentFilter::PatternMatcher> |
+ deprecated_data_scheme_specific_parts(const arc::IntentFilter& r) { |
+ // Returns an empty array. |
+ return mojo::CArray<arc::IntentFilter::PatternMatcher>(); |
+ } |
+ |
+ static bool Read(arc::mojom::IntentFilterDataView data, |
+ arc::IntentFilter* out); |
+}; |
+ |
+template <> |
+struct StructTraits<arc::mojom::AuthorityEntryDataView, |
+ arc::IntentFilter::AuthorityEntry> { |
+ static const std::string& host(const arc::IntentFilter::AuthorityEntry& r) { |
+ return r.host(); |
+ } |
+ static int32_t port(const arc::IntentFilter::AuthorityEntry& r) { |
+ return r.port(); |
+ } |
+ |
+ static bool Read(arc::mojom::AuthorityEntryDataView data, |
+ arc::IntentFilter::AuthorityEntry* out); |
+}; |
+ |
+template <> |
+struct StructTraits<arc::mojom::PatternMatcherDataView, |
+ arc::IntentFilter::PatternMatcher> { |
+ static const std::string& pattern( |
+ const arc::IntentFilter::PatternMatcher& r) { |
+ return r.pattern(); |
+ } |
+ static arc::mojom::PatternType type( |
+ const arc::IntentFilter::PatternMatcher& r) { |
+ return r.match_type(); |
+ } |
+ |
+ static bool Read(arc::mojom::PatternMatcherDataView data, |
+ arc::IntentFilter::PatternMatcher* out); |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // COMPONENT_ARC_INTENT_FILTER_INTENT_FILTER_STRUCT_TRAITS_H_ |