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

Unified Diff: url/gurl.cc

Issue 185133005: Move referrer stripping into GURL::GetAsReferrer(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/gurl_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 8eb2d6132db5ef0c7636ab5a73dc87b843f7d5ae..5dc65a7f133dd67279bcae5e8dfbaf56a9453133 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -320,6 +320,18 @@ GURL GURL::GetOrigin() const {
return ReplaceComponents(replacements);
}
+GURL GURL::GetAsReferrer() const {
+ if (!is_valid_ ||
+ (!has_ref() && !has_username() && !has_password()))
brettw 2014/03/07 18:08:10 You can just put the first ( on this line right un
ppi 2014/03/13 19:33:24 Done.
+ return GURL(*this);
+
+ url_canon::Replacements<char> replacements;
+ replacements.ClearRef();
+ replacements.ClearUsername();
+ replacements.ClearPassword();
+ return ReplaceComponents(replacements);
+}
+
GURL GURL::GetWithEmptyPath() const {
// This doesn't make sense for invalid or nonstandard URLs, so return
// the empty URL.
« no previous file with comments | « url/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698