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

Unified Diff: url/gurl.cc

Issue 2681113002: Add GURL::EqualsIgnoringRef(). (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « url/gurl.h ('k') | url/url_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/gurl.cc
diff --git a/url/gurl.cc b/url/gurl.cc
index 041001a75480c19327a1568158a3b93328e73a7b..f521692f931da535b50bc5b48aef21d71a6e9ba7 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -468,6 +468,14 @@ bool GURL::DomainIs(base::StringPiece lower_ascii_domain) const {
return url::DomainIs(host_piece(), lower_ascii_domain);
}
+bool GURL::EqualsIgnoringRef(const GURL& other) const {
+ int ref_position = parsed_.CountCharactersBefore(url::Parsed::REF, true);
+ int ref_position_other =
+ other.parsed_.CountCharactersBefore(url::Parsed::REF, true);
+ return base::StringPiece(spec_).substr(0, ref_position) ==
+ base::StringPiece(other.spec_).substr(0, ref_position_other);
+}
+
void GURL::Swap(GURL* other) {
spec_.swap(other->spec_);
std::swap(is_valid_, other->is_valid_);
« no previous file with comments | « url/gurl.h ('k') | url/url_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698