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

Unified Diff: components/history/core/browser/history_database.cc

Issue 2298093002: Top Hosts computation should not use redirected urls and subframe urls (Closed)
Patch Set: Created 4 years, 4 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/history/core/browser/history_backend_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/history_database.cc
diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc
index 0c0859d0da22863989db42298e6f40d6c04c4b8f..64d5831ec93786f7acf2178406a2a29bcbce3e99 100644
--- a/components/history/core/browser/history_database.cc
+++ b/components/history/core/browser/history_database.cc
@@ -198,8 +198,19 @@ TopHostsList HistoryDatabase::TopHosts(size_t num_hosts) {
std::max(base::Time::Now() - base::TimeDelta::FromDays(30), base::Time());
sql::Statement url_sql(db_.GetUniqueStatement(
- "SELECT url, visit_count FROM urls WHERE last_visit_time > ?"));
+ "SELECT u.url, u.visit_count "
+ "FROM urls u JOIN visits v ON u.id = v.url "
+ "WHERE last_visit_time > ? "
+ "AND (v.transition & ?) != 0 " // CHAIN_END
+ "AND (transition & ?) NOT IN (?, ?, ?)")); // NO SUBFRAME or
+ // KEYWORD_GENERATED
+
url_sql.BindInt64(0, one_month_ago.ToInternalValue());
+ url_sql.BindInt(1, ui::PAGE_TRANSITION_CHAIN_END);
+ url_sql.BindInt(2, ui::PAGE_TRANSITION_CORE_MASK);
+ url_sql.BindInt(3, ui::PAGE_TRANSITION_AUTO_SUBFRAME);
+ url_sql.BindInt(4, ui::PAGE_TRANSITION_MANUAL_SUBFRAME);
+ url_sql.BindInt(5, ui::PAGE_TRANSITION_KEYWORD_GENERATED);
// Collect a map from host to visit count.
base::hash_map<std::string, int> host_count;
« no previous file with comments | « components/history/core/browser/history_backend_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698