Index: extensions/common/url_pattern.cc |
diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc |
index 735e71e9fa0298704005aa12e3f11fd8fabbc86e..9bec70150aea76b988a31b4c9c193563963af696 100644 |
--- a/extensions/common/url_pattern.cc |
+++ b/extensions/common/url_pattern.cc |
@@ -466,6 +466,23 @@ bool URLPattern::ImpliesAllHosts() const { |
return registry_length > 0; |
} |
+bool URLPattern::IsOrigin() const { |
+ // We ignore the port because it's not all that interesting. |
not at google - send to devlin
2014/08/13 22:59:17
Actually a better explanation would be
// Strictl
gpdavis
2014/08/13 23:23:06
Done.
|
+ return !ImpliesAllHosts() && scheme_ != "*" && !match_subdomains_; |
+} |
+ |
+GURL URLPattern::ToOrigin() const { |
+ if (!IsOrigin()) |
+ return GURL(); |
+ |
+ URLPattern origin(valid_schemes()); |
+ origin.SetScheme(scheme()); |
+ origin.SetHost(host()); |
+ origin.SetPort(port()); |
+ origin.SetPath("/*"); |
+ return GURL(origin.GetAsString()); |
+} |
+ |
bool URLPattern::MatchesPath(const std::string& test) const { |
// Make the behaviour of OverlapsWith consistent with MatchesURL, which is |
// need to match hosted apps on e.g. 'google.com' also run on 'google.com/'. |