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

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

Issue 2498223002: arc: enable use_new_wrapper_types for intent_helper.mojom (Closed)
Patch Set: rebase Created 4 years, 1 month 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.cc
diff --git a/components/arc/intent_helper/intent_filter.cc b/components/arc/intent_helper/intent_filter.cc
index 7c9db064f5af3bcffb304943fdb4df00799fb989..7dea60f1ed08c7c02ae7dd100d99ce48fc362536 100644
--- a/components/arc/intent_helper/intent_filter.cc
+++ b/components/arc/intent_helper/intent_filter.cc
@@ -11,13 +11,18 @@
namespace arc {
IntentFilter::IntentFilter(const mojom::IntentFilterPtr& mojo_intent_filter) {
- for (const mojom::AuthorityEntryPtr& authorityptr :
- mojo_intent_filter->data_authorities) {
- authorities_.emplace_back(authorityptr);
+ // 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);
+ }
}
- for (const mojom::PatternMatcherPtr& pattern :
- mojo_intent_filter->data_paths) {
- paths_.emplace_back(pattern);
+ if (mojo_intent_filter->data_paths.has_value()) {
+ for (const mojom::PatternMatcherPtr& pattern :
+ *mojo_intent_filter->data_paths) {
+ paths_.emplace_back(pattern);
+ }
}
}
@@ -67,7 +72,7 @@ bool IntentFilter::MatchDataAuthority(const GURL& url) const {
IntentFilter::AuthorityEntry::AuthorityEntry(
const mojom::AuthorityEntryPtr& entry)
- : host_(entry->host.get()), port_(entry->port) {
+ : host_(entry->host), port_(entry->port) {
// Wildcards are only allowed at the front of the host string.
wild_ = !host_.empty() && host_[0] == '*';
if (wild_) {
@@ -112,7 +117,7 @@ bool IntentFilter::AuthorityEntry::Match(const GURL& url) const {
IntentFilter::PatternMatcher::PatternMatcher(
const mojom::PatternMatcherPtr& pattern)
- : pattern_(pattern->pattern.get()), match_type_(pattern->type) {}
+ : pattern_(pattern->pattern), match_type_(pattern->type) {}
// Transcribed from android's PatternMatcher#matchPattern.
bool IntentFilter::PatternMatcher::Match(const std::string& str) const {

Powered by Google App Engine
This is Rietveld 408576698