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

Unified Diff: url/gurl.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Rebase. Created 3 years, 11 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/gurl.cc
diff --git a/url/gurl.cc b/url/gurl.cc
index 43f30528593ffe1a0d0ecf4a6a9e69cca8b9a956..d35a5b30d33d97ba0e8236b05fd2611bbbc768ae 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -467,6 +467,14 @@ bool GURL::DomainIs(base::StringPiece lower_ascii_domain) const {
return url::DomainIs(host_piece(), lower_ascii_domain);
}
+// static
+bool GURL::EqualsIgnoringRef(const GURL& x, const GURL& y) {
+ int ref_position_x = x.parsed_.CountCharactersBefore(url::Parsed::REF, true);
+ int ref_position_y = y.parsed_.CountCharactersBefore(url::Parsed::REF, true);
+ return base::StringPiece(x.spec_).substr(0, ref_position_x) ==
+ base::StringPiece(y.spec_).substr(0, ref_position_y);
+}
+
void GURL::Swap(GURL* other) {
spec_.swap(other->spec_);
std::swap(is_valid_, other->is_valid_);

Powered by Google App Engine
This is Rietveld 408576698