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

Unified Diff: url/url_util.h

Issue 2287483002: Provide the equivalent of GURL::DomainIs for url::Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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: url/url_util.h
diff --git a/url/url_util.h b/url/url_util.h
index a209a61c76029bed62f70c471e53bbfedd848332..baae84a400fe7ca52c68c3f24112d0f543341d83 100644
--- a/url/url_util.h
+++ b/url/url_util.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/strings/string16.h"
+#include "base/strings/string_piece.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_canon.h"
#include "url/url_constants.h"
@@ -217,6 +218,16 @@ URL_EXPORT void EncodeURIComponent(const char* input,
int length,
CanonOutput* output);
+// Returns true if the |canonicalized_host| matches or is in the same domain as
engedy 2016/08/26 16:48:14 I'd argue this should go into a new section before
pkalinnikov 2016/08/29 09:53:00 Done.
+// the given |lower_ascii_domain| string. For example, if the canonicalized
+// hostname is "www.google.com", this will return true for "com", "google.com",
+// and "www.google.com" domains.
+//
+// The input domain should be a non-empty lower-case ASCII string to match the
+// canonicalized host. The host should be non-empty as well.
+URL_EXPORT bool DomainIs(base::StringPiece canonicalized_host,
+ base::StringPiece lower_ascii_domain);
+
} // namespace url
#endif // URL_URL_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698