Chromium Code Reviews| 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..b804d885de75ff6a7982048b8b4f5f49d39b1f57 |
| --- /dev/null |
| +++ b/components/arc/intent_helper/intent_filter_struct_traits.h |
| @@ -0,0 +1,78 @@ |
| +// 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( |
|
Yusuke Sato
2016/11/30 21:47:15
Do we really have to return a copy of the vector h
yoshiki
2016/12/02 19:34:28
Done.
|
| + const arc::IntentFilter& r) { |
| + return r.authorities(); |
| + } |
| + static const std::vector<arc::IntentFilter::PatternMatcher> data_paths( |
|
Yusuke Sato
2016/11/30 21:47:15
same, const reference?
yoshiki
2016/12/02 19:34:28
Done.
|
| + 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) { |
|
Yusuke Sato
2016/11/30 21:47:15
same
yoshiki
2016/12/02 19:34:28
Done.
|
| + 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) { |
|
Yusuke Sato
2016/11/30 21:47:15
same
yoshiki
2016/12/02 19:34:28
Done.
|
| + 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_ |