Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
| index 82feaa80f293e6038cd63a9ab82991e415c855b2..65f5213ab5defbd3c691d24ba44183abfd763371 100644 |
| --- a/content/renderer/render_thread_impl.cc |
| +++ b/content/renderer/render_thread_impl.cc |
| @@ -22,6 +22,7 @@ |
| #include "base/single_thread_task_runner.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/string_number_conversions.h" |
| +#include "base/strings/string_split.h" |
| #include "base/strings/string_tokenizer.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -131,6 +132,7 @@ |
| #include "mojo/common/common_type_converters.h" |
| #include "net/base/net_errors.h" |
| #include "net/base/port_util.h" |
| +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| #include "skia/ext/event_tracer_impl.h" |
| #include "skia/ext/skia_memory_dump_provider.h" |
| #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
| @@ -288,6 +290,36 @@ std::string HostToCustomHistogramSuffix(const std::string& host) { |
| return ".inbox"; |
| if (host == "www.youtube.com") |
| return ".youtube"; |
| + |
| + // The Top10 sites have different TLD and/or subdomains |
| + // depending on the localization |
| + if (host == "sina.com.cn") |
| + return ".top10"; |
| + |
| + std::string domain = |
| + net::registry_controlled_domains::GetDomainAndRegistry( |
| + host, |
| + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
| + |
| + if (!domain.empty()) { |
| + std::vector<base::StringPiece> host_tokens = base::SplitStringPiece( |
| + domain, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| + |
| + if (host_tokens.size() >= 2) { |
|
jochen (gone - plz use gerrit)
2015/10/23 12:16:21
why >= 2?
what's wrong with e.g. amazon.com?
giv
battre
2015/10/23 17:49:59
Do you expect that the traffic to sites not owned
Michael Hablich
2015/10/26 13:10:39
on '.size() >= 2':
Well, it will trigger for 'amaz
|
| + if ((host_tokens[0] == "facebook") || |
| + (host_tokens[0] == "baidu") || |
| + (host_tokens[0] == "yahoo") || |
| + (host_tokens[0] == "amazon") || |
| + (host_tokens[0] == "qq") || |
| + (host_tokens[0] == "twitter") || |
| + (host_tokens[0] == "taobao") || |
| + (host_tokens[0] == "live") || |
| + (host_tokens[0] == "wikipedia")) { |
| + return ".top10"; |
|
Alexei Svitkine (slow)
2015/10/22 16:43:06
Can you make a helper function IsAlexaTop10Site()
Michael Hablich
2015/10/26 13:10:39
Done.
|
| + } |
| + } |
| + } |
| + |
| return std::string(); |
| } |