Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Unified Diff: components/arc/intent_helper/intent_filter_unittest.cc

Issue 2557703002: Revert of Use mojo typemaps to simplify arc::IntentFilter::IntentFilter() (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1205c2e529ccc0f812673ad478a5d0ecd65c8da9..1e0113f1a8e97fef941585fda871d86ceaa25b4d 100644
--- a/components/arc/intent_helper/intent_filter_unittest.cc
+++ b/components/arc/intent_helper/intent_filter_unittest.cc
@@ -20,32 +20,41 @@
class IntentFilterBuilder {
public:
- IntentFilterBuilder() = default;
+ IntentFilterBuilder():
+ filter_spec_(mojom::IntentFilter::New()) {
+ }
IntentFilterBuilder& authority(const std::string& host) {
return authority(host, -1);
}
IntentFilterBuilder& authority(const std::string& host, int port) {
- authorities_.emplace_back(host, 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));
return *this;
}
IntentFilterBuilder& path(const std::string& path,
const mojom::PatternType& type) {
- paths_.emplace_back(path, 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));
return *this;
}
- operator IntentFilter() {
- return IntentFilter(std::move(authorities_), std::move(paths_));
+ operator IntentFilter() const {
+ return std::move(IntentFilter(filter_spec_));
}
private:
- std::vector<IntentFilter::AuthorityEntry> authorities_;
- std::vector<IntentFilter::PatternMatcher> paths_;
-
- DISALLOW_COPY_AND_ASSIGN(IntentFilterBuilder);
+ mojom::IntentFilterPtr filter_spec_;
};
} // namespace
« no previous file with comments | « components/arc/intent_helper/intent_filter_struct_traits.cc ('k') | components/arc/intent_helper/local_activity_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698