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

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

Issue 2511883003: 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 10881fae85f93fd1aa2fbb40f37bd5e15e1ccd70..85c48ecb69fee691ad9c2c6636f4000d8a645280 100644
--- a/components/arc/intent_helper/intent_filter_unittest.cc
+++ b/components/arc/intent_helper/intent_filter_unittest.cc
@@ -20,32 +20,22 @@ namespace {
class IntentFilterBuilder {
public:
- IntentFilterBuilder():
- filter_spec_(mojom::IntentFilter::New()) {
- }
+ IntentFilterBuilder() {}
Yusuke Sato 2016/11/30 21:47:16 = default;
yoshiki 2016/12/02 19:34:28 Done.
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));
+ IntentFilter::AuthorityEntry ae(host, port);
+ filter_spec_.authorities().emplace_back(std::move(ae));
Luis Héctor Chávez 2016/11/30 23:05:00 nit: filter_spec_.authorities().emplace_back(host,
yoshiki 2016/12/02 19:34:28 Done.
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));
+ IntentFilter::PatternMatcher p(path, type);
+ filter_spec_.paths().emplace_back(std::move(p));
Luis Héctor Chávez 2016/11/30 23:05:00 nit: filter_spec_.paths().emplace_back(path, type)
yoshiki 2016/12/02 19:34:28 Done.
return *this;
}
@@ -54,7 +44,7 @@ class IntentFilterBuilder {
}
private:
- mojom::IntentFilterPtr filter_spec_;
+ IntentFilter filter_spec_;
hidehiko 2016/12/01 02:06:33 DISALLOW_COPY_AND_ASSIGN?
yoshiki 2016/12/02 19:34:28 Done.
};
} // namespace

Powered by Google App Engine
This is Rietveld 408576698