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

Unified Diff: components/url_formatter/url_formatter.h

Issue 2939423003: URL Formatter: Add StripSubdomain method that preserves eTLD + 1. (Closed)
Patch Set: Return std::string instead of base::StringPiece (which makes no sense) Created 3 years, 6 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 | « components/ssl_errors/error_classification.cc ('k') | components/url_formatter/url_formatter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/url_formatter/url_formatter.h
diff --git a/components/url_formatter/url_formatter.h b/components/url_formatter/url_formatter.h
index 90f2bbf9b73128e35a080382b35fe91d08db3d09..0f0eb683795224ab926e2c2c617c6588711ce5fe 100644
--- a/components/url_formatter/url_formatter.h
+++ b/components/url_formatter/url_formatter.h
@@ -137,11 +137,18 @@ void AppendFormattedHost(const GURL& url, base::string16* output);
base::string16 IDNToUnicode(base::StringPiece host);
// If |text| starts with "www." it is removed, otherwise |text| is returned
-// unmodified.
+// unmodified. Both |text| and the returned value are arbitrary strings and
+// are not guaranteed to be navigable hostnames.
base::string16 StripWWW(const base::string16& text);
-// Runs |url|'s host through StripWWW(). |url| must be valid.
-base::string16 StripWWWFromHost(const GURL& url);
+// Returns the host of |url| with subdomains specified by |subdomains|
+// removed. |url| must be valid. If the |url| host is already an eTLD+1,
+// the host is returned unmodified.
+typedef uint32_t StripSubdomainType;
+typedef uint32_t StripSubdomainTypes;
+constexpr StripSubdomainType kStripWWW = 1 << 0;
+constexpr StripSubdomainType kStripM = 1 << 1;
+std::string StripSubdomains(const GURL& url, StripSubdomainTypes subdomains);
} // namespace url_formatter
« no previous file with comments | « components/ssl_errors/error_classification.cc ('k') | components/url_formatter/url_formatter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698