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

Unified Diff: chrome/browser/history/visit_database.cc

Issue 6990074: Change GetVisitCountToHost() to GetVisibleVisitCountToHost(), and restrict it to returning "user-... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | « chrome/browser/history/visit_database.h ('k') | chrome/browser/page_info_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/visit_database.cc
===================================================================
--- chrome/browser/history/visit_database.cc (revision 86341)
+++ chrome/browser/history/visit_database.cc (working copy)
@@ -432,9 +432,9 @@
return true;
}
-bool VisitDatabase::GetVisitCountToHost(const GURL& url,
- int* count,
- base::Time* first_visit) {
+bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url,
+ int* count,
+ base::Time* first_visit) {
if (!url.SchemeIs(chrome::kHttpScheme) && !url.SchemeIs(chrome::kHttpsScheme))
return false;
@@ -445,24 +445,29 @@
// The query becomes:
// 'url >= http://google.com/' and url < http://google.com0'.
// 0 is used as it is one character greater than '/'.
- GURL search_url(url);
- const std::string host_query_min = search_url.GetOrigin().spec();
-
+ const std::string host_query_min = url.GetOrigin().spec();
if (host_query_min.empty())
return false;
- std::string host_query_max = host_query_min;
- host_query_max[host_query_max.size() - 1] = '0';
-
+ // We also want to restrict ourselves to main frame navigations that are not
+ // in the middle of redirect chains, hence the transition checks.
sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
"SELECT MIN(v.visit_time), COUNT(*) "
"FROM visits v INNER JOIN urls u ON v.url = u.id "
- "WHERE (u.url >= ? AND u.url < ?)"));
+ "WHERE u.url >= ? AND u.url < ? "
+ "AND (transition & ?) != 0 "
+ "AND (transition & ?) NOT IN (?, ?, ?)"));
if (!statement)
return false;
statement.BindString(0, host_query_min);
- statement.BindString(1, host_query_max);
+ statement.BindString(1,
+ host_query_min.substr(0, host_query_min.size() - 1) + '0');
+ statement.BindInt(2, PageTransition::CHAIN_END);
+ statement.BindInt(3, PageTransition::CORE_MASK);
+ statement.BindInt(4, PageTransition::AUTO_SUBFRAME);
+ statement.BindInt(5, PageTransition::MANUAL_SUBFRAME);
+ statement.BindInt(6, PageTransition::KEYWORD_GENERATED);
if (!statement.Step()) {
// We've never been to this page before.
« no previous file with comments | « chrome/browser/history/visit_database.h ('k') | chrome/browser/page_info_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698