Chromium Code Reviews| Index: components/arc/intent_helper/intent_filter.h |
| diff --git a/components/arc/intent_helper/intent_filter.h b/components/arc/intent_helper/intent_filter.h |
| index eb07523432deb312d8cfc597ec493e4ef28a67e7..45c55d154ad3f5f576241cb1981982e8470272d8 100644 |
| --- a/components/arc/intent_helper/intent_filter.h |
| +++ b/components/arc/intent_helper/intent_filter.h |
| @@ -8,55 +8,90 @@ |
| #include <string> |
| #include <vector> |
| -#include "components/arc/common/intent_helper.mojom.h" |
| +#include "base/macros.h" |
| class GURL; |
| namespace arc { |
| +namespace mojom { |
| +enum class PatternType; |
| +} // namespace mojom |
| + |
| // A chrome-side implementation of Android's IntentFilter class. This is used |
| // to approximate the intent filtering and determine whether a given URL is |
| // likely to be handled by any android-side apps, prior to making expensive IPC |
| // calls. |
| class IntentFilter { |
| public: |
| - explicit IntentFilter(const mojom::IntentFilterPtr& mojo_intent_filter); |
| - IntentFilter(const IntentFilter& other); |
| - ~IntentFilter(); |
| - |
| - bool Match(const GURL& url) const; |
| - |
| - private: |
| // A helper class for handling matching of the host part of the URL. |
| class AuthorityEntry { |
| public: |
| - explicit AuthorityEntry(const mojom::AuthorityEntryPtr& entry); |
| + AuthorityEntry(); |
| + AuthorityEntry(AuthorityEntry&& other); |
| + AuthorityEntry(std::string host, int port); |
|
dcheng
2016/12/03 01:09:05
Nit: I think it's still much more typical to pass
Yusuke Sato
2016/12/03 02:05:22
yoshiki@, let's switch to const std::string& then.
yoshiki
2016/12/06 07:07:38
dcheng, yusuke, thank you. Done.
|
| + |
| + AuthorityEntry& operator=(AuthorityEntry&& other) = default; |
|
Luis Héctor Chávez
2016/12/03 01:13:45
nit: since these classes are not templated, the de
yoshiki
2016/12/06 07:07:38
Done.
|
| + |
| bool Match(const GURL& url) const; |
| + const std::string& host() const { return host_; } |
| + int port() const { return port_; } |
| + |
| private: |
| std::string host_; |
| bool wild_; |
| int port_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AuthorityEntry); |
| }; |
| // A helper class for handling matching of various patterns in the URL. |
| class PatternMatcher { |
| public: |
| - explicit PatternMatcher(const mojom::PatternMatcherPtr& pattern); |
| + PatternMatcher(); |
| + PatternMatcher(PatternMatcher&& other); |
| + PatternMatcher(std::string pattern, mojom::PatternType match_type); |
|
Yusuke Sato
2016/12/03 02:05:22
same
yoshiki
2016/12/06 07:07:38
Done.
|
| + |
| + PatternMatcher& operator=(PatternMatcher&& other) = default; |
| + |
| bool Match(const std::string& match) const; |
| + const std::string& pattern() const { return pattern_; } |
| + mojom::PatternType match_type() const { return match_type_; } |
| + |
| private: |
| bool MatchGlob(const std::string& match) const; |
| std::string pattern_; |
| mojom::PatternType match_type_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PatternMatcher); |
| }; |
| + IntentFilter(); |
| + IntentFilter(IntentFilter&& other); |
| + IntentFilter(std::vector<AuthorityEntry> authorities, |
|
Yusuke Sato
2016/12/03 02:05:22
this one seems fine as-is.
yoshiki
2016/12/06 07:07:38
Acknowledged.
|
| + std::vector<PatternMatcher> paths); |
| + ~IntentFilter(); |
| + |
| + IntentFilter& operator=(IntentFilter&& other) = default; |
| + |
| + bool Match(const GURL& url) const; |
| + |
| + const std::vector<AuthorityEntry>& authorities() const { |
| + return authorities_; |
| + } |
| + const std::vector<PatternMatcher>& paths() const { return paths_; } |
| + |
| + private: |
| bool MatchDataAuthority(const GURL& url) const; |
| bool HasDataPath(const GURL& url) const; |
| std::vector<AuthorityEntry> authorities_; |
| std::vector<PatternMatcher> paths_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(IntentFilter); |
| }; |
| } // namespace arc |