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

Unified Diff: url/url_util.cc

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Move IsFragmentAddedOrUpdated from net/ to url∕ 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
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util.cc
diff --git a/url/url_util.cc b/url/url_util.cc
index 9a2cce47aa116c047e8d49cc6235941be944075d..ef3f72fa8cef6d666dd8fae79468d9c6d71514ef 100644
--- a/url/url_util.cc
+++ b/url/url_util.cc
@@ -683,6 +683,16 @@ bool HostIsIPAddress(base::StringPiece host) {
return host_info.IsIPAddress();
}
+bool IsFragmentAddedOrUpdated(const GURL& old_url, const GURL& new_url) {
+ if (!new_url.has_ref() || old_url == new_url)
+ return false;
+
+ url::Replacements<char> replacements;
+ replacements.ClearRef();
+ return old_url.ReplaceComponents(replacements) ==
+ new_url.ReplaceComponents(replacements);
+}
+
bool Canonicalize(const char* spec,
int spec_len,
bool trim_path_end,
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698