Index: components/history/core/browser/visit_database.cc |
diff --git a/components/history/core/browser/visit_database.cc b/components/history/core/browser/visit_database.cc |
index 6d5819c36621ae11058b478811aaca64af2736e8..85cae3819bf976cb6dbe5b782c1dc0fd085a88ab 100644 |
--- a/components/history/core/browser/visit_database.cc |
+++ b/components/history/core/browser/visit_database.cc |
@@ -536,6 +536,29 @@ bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url, |
return true; |
} |
+int VisitDatabase::GetCountOfURLsWithVisibleVisit() { |
lwchkg
2015/08/11 15:54:51
Please discuss the naming of this function. It sho
lwchkg
2015/08/12 17:47:30
@sdefrense and @sky: Please check the code here. T
Mike Lerman
2015/08/13 14:56:33
I think GetCountHistoryEntries extends well to thi
|
+ sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
+ "SELECT COUNT(*) FROM (" |
+ "SELECT DISTINCT url, " |
+ // Convert unit of timestamp from the numbers of microseconds since |
+ // Windows Epoch to the number of seconds from Unix Epoch. |
+ "DATE(visit_time/1000000-11644473600, 'localtime', 'unixepoch') " |
+ "FROM visits " |
+ "WHERE (transition & ?) != 0 " // CHAIN_END |
+ "AND (transition & ?) NOT IN (?, ?, ?)" // NO SUBFRAME or |
+ // KEYWORD_GENERATED |
+ ")")); |
+ |
+ statement.BindInt(0, ui::PAGE_TRANSITION_CHAIN_END); |
+ statement.BindInt(1, ui::PAGE_TRANSITION_CORE_MASK); |
+ statement.BindInt(2, ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
+ statement.BindInt(3, ui::PAGE_TRANSITION_MANUAL_SUBFRAME); |
+ statement.BindInt(4, ui::PAGE_TRANSITION_KEYWORD_GENERATED); |
+ |
+ statement.Step(); |
+ return statement.ColumnInt(0); |
+} |
+ |
bool VisitDatabase::GetStartDate(base::Time* first_visit) { |
sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
"SELECT MIN(visit_time) FROM visits WHERE visit_time != 0")); |