Index: components/arc/intent_helper/intent_filter_unittest.cc |
diff --git a/components/arc/intent_helper/intent_filter_unittest.cc b/components/arc/intent_helper/intent_filter_unittest.cc |
index 1e0113f1a8e97fef941585fda871d86ceaa25b4d..1205c2e529ccc0f812673ad478a5d0ecd65c8da9 100644 |
--- a/components/arc/intent_helper/intent_filter_unittest.cc |
+++ b/components/arc/intent_helper/intent_filter_unittest.cc |
@@ -20,41 +20,32 @@ namespace { |
class IntentFilterBuilder { |
public: |
- IntentFilterBuilder(): |
- filter_spec_(mojom::IntentFilter::New()) { |
- } |
+ IntentFilterBuilder() = default; |
IntentFilterBuilder& authority(const std::string& host) { |
return authority(host, -1); |
} |
IntentFilterBuilder& authority(const std::string& host, int port) { |
- mojom::AuthorityEntryPtr ae = mojom::AuthorityEntry::New(); |
- ae->host = host; |
- ae->port = port; |
- if (!filter_spec_->data_authorities.has_value()) |
- filter_spec_->data_authorities = std::vector<mojom::AuthorityEntryPtr>(); |
- filter_spec_->data_authorities->push_back(std::move(ae)); |
+ authorities_.emplace_back(host, port); |
return *this; |
} |
IntentFilterBuilder& path(const std::string& path, |
const mojom::PatternType& type) { |
- mojom::PatternMatcherPtr p = mojom::PatternMatcher::New(); |
- p->pattern = path; |
- p->type = type; |
- if (!filter_spec_->data_paths.has_value()) |
- filter_spec_->data_paths = std::vector<mojom::PatternMatcherPtr>(); |
- filter_spec_->data_paths->push_back(std::move(p)); |
+ paths_.emplace_back(path, type); |
return *this; |
} |
- operator IntentFilter() const { |
- return std::move(IntentFilter(filter_spec_)); |
+ operator IntentFilter() { |
+ return IntentFilter(std::move(authorities_), std::move(paths_)); |
} |
private: |
- mojom::IntentFilterPtr filter_spec_; |
+ std::vector<IntentFilter::AuthorityEntry> authorities_; |
+ std::vector<IntentFilter::PatternMatcher> paths_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(IntentFilterBuilder); |
}; |
} // namespace |