Chromium Code Reviews| Index: components/history/core/browser/url_utils.cc |
| diff --git a/components/history/core/browser/url_utils.cc b/components/history/core/browser/url_utils.cc |
| index a993619be392f9d842a1a11a0647b0494dab4b54..a6e86c097eedfdcaa654800d1e9e1c5f52a379f4 100644 |
| --- a/components/history/core/browser/url_utils.cc |
| +++ b/components/history/core/browser/url_utils.cc |
| @@ -6,6 +6,7 @@ |
| #include <algorithm> |
| +#include "base/strings/string_util.h" |
| #include "url/gurl.h" |
| namespace history { |
| @@ -85,4 +86,11 @@ GURL ToggleHTTPAndHTTPS(const GURL& url) { |
| return url.ReplaceComponents(replacement); |
| } |
| +std::string HostForTopHosts(const GURL& url) { |
| + std::string host = url.host(); |
| + if (StartsWithASCII(host, "www.", true)) |
| + host.assign(host, 4, std::string::npos); |
|
sky
2015/06/15 17:28:17
nit: no need to reassign to host, just return the
twifkak
2015/06/16 20:25:24
Was trying to make use of NRVO. Returning just the
|
| + return host; |
| +} |
| + |
| } // namespace history |