| Index: components/arc/intent_helper/intent_filter.cc
|
| diff --git a/components/arc/intent_helper/intent_filter.cc b/components/arc/intent_helper/intent_filter.cc
|
| index 85f30b4f204165a6136f372d8d0e015ded071c0e..de104aeccb3a48dca94cc78be020d330f4fb0199 100644
|
| --- a/components/arc/intent_helper/intent_filter.cc
|
| +++ b/components/arc/intent_helper/intent_filter.cc
|
| @@ -6,26 +6,30 @@
|
|
|
| #include "base/compiler_specific.h"
|
| #include "base/strings/string_util.h"
|
| -#include "components/arc/common/intent_helper.mojom.h"
|
| #include "url/gurl.h"
|
|
|
| namespace arc {
|
|
|
| -IntentFilter::IntentFilter() = default;
|
| -IntentFilter::IntentFilter(IntentFilter&& other) = default;
|
| -
|
| -IntentFilter::IntentFilter(
|
| - std::vector<IntentFilter::AuthorityEntry> authorities,
|
| - std::vector<IntentFilter::PatternMatcher> paths)
|
| - : authorities_(std::move(authorities)) {
|
| +IntentFilter::IntentFilter(const mojom::IntentFilterPtr& mojo_intent_filter) {
|
| + // TODO(yusukes): Use mojo typemaps to simplify the constructor.
|
| + if (mojo_intent_filter->data_authorities.has_value()) {
|
| + for (const mojom::AuthorityEntryPtr& authorityptr :
|
| + *mojo_intent_filter->data_authorities) {
|
| + authorities_.emplace_back(authorityptr);
|
| + }
|
| + }
|
| // In order to register a path we need to have at least one authority.
|
| - if (!authorities_.empty())
|
| - paths_ = std::move(paths);
|
| -}
|
| + if (!authorities_.empty() && mojo_intent_filter->data_paths.has_value()) {
|
| + for (const mojom::PatternMatcherPtr& pattern :
|
| + *mojo_intent_filter->data_paths) {
|
| + paths_.emplace_back(pattern);
|
| + }
|
| + }
|
| +}
|
| +
|
| +IntentFilter::IntentFilter(const IntentFilter& other) = default;
|
|
|
| IntentFilter::~IntentFilter() = default;
|
| -
|
| -IntentFilter& IntentFilter::operator=(IntentFilter&& other) = default;
|
|
|
| // Logically, this maps to IntentFilter#match, but this code only deals with
|
| // view intents for http/https URLs and so it really only implements the
|
| @@ -69,15 +73,9 @@
|
| return false;
|
| }
|
|
|
| -IntentFilter::AuthorityEntry::AuthorityEntry() = default;
|
| IntentFilter::AuthorityEntry::AuthorityEntry(
|
| - IntentFilter::AuthorityEntry&& other) = default;
|
| -
|
| -IntentFilter::AuthorityEntry& IntentFilter::AuthorityEntry::operator=(
|
| - IntentFilter::AuthorityEntry&& other) = default;
|
| -
|
| -IntentFilter::AuthorityEntry::AuthorityEntry(const std::string& host, int port)
|
| - : host_(host), port_(port) {
|
| + const mojom::AuthorityEntryPtr& entry)
|
| + : host_(entry->host), port_(entry->port) {
|
| // Wildcards are only allowed at the front of the host string.
|
| wild_ = !host_.empty() && host_[0] == '*';
|
| if (wild_) {
|
| @@ -120,16 +118,9 @@
|
| }
|
| }
|
|
|
| -IntentFilter::PatternMatcher::PatternMatcher() = default;
|
| IntentFilter::PatternMatcher::PatternMatcher(
|
| - IntentFilter::PatternMatcher&& other) = default;
|
| -
|
| -IntentFilter::PatternMatcher::PatternMatcher(const std::string& pattern,
|
| - mojom::PatternType match_type)
|
| - : pattern_(pattern), match_type_(match_type) {}
|
| -
|
| -IntentFilter::PatternMatcher& IntentFilter::PatternMatcher::operator=(
|
| - IntentFilter::PatternMatcher&& other) = default;
|
| + const mojom::PatternMatcherPtr& pattern)
|
| + : pattern_(pattern->pattern), match_type_(pattern->type) {}
|
|
|
| // Transcribed from android's PatternMatcher#matchPattern.
|
| bool IntentFilter::PatternMatcher::Match(const std::string& str) const {
|
|
|