OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ | 5 #ifndef CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ |
6 #define CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ | 6 #define CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ |
7 | 7 |
8 #include "chrome/browser/history/history_types.h" | 8 #include "chrome/browser/history/history_types.h" |
9 | 9 |
10 struct sqlite3; | 10 struct sqlite3; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 GURL* to_url); | 112 GURL* to_url); |
113 | 113 |
114 // Returns the number of visits to all urls on the scheme/host/post | 114 // Returns the number of visits to all urls on the scheme/host/post |
115 // identified by url. This is only valid for http and https urls (all other | 115 // identified by url. This is only valid for http and https urls (all other |
116 // schemes are ignored and false is returned). | 116 // schemes are ignored and false is returned). |
117 // count is set to the number of visits, first_visit is set to the first time | 117 // count is set to the number of visits, first_visit is set to the first time |
118 // the host was visited. Returns true on success. | 118 // the host was visited. Returns true on success. |
119 bool GetVisitCountToHost(const GURL& url, int* count, | 119 bool GetVisitCountToHost(const GURL& url, int* count, |
120 base::Time* first_visit); | 120 base::Time* first_visit); |
121 | 121 |
| 122 // Get the time of the first item in our database. |
| 123 bool GetStartDate(base::Time* first_visit); |
| 124 |
122 protected: | 125 protected: |
123 // Returns the database and statement cache for the functions in this | 126 // Returns the database and statement cache for the functions in this |
124 // interface. The decendent of this class implements these functions to | 127 // interface. The decendent of this class implements these functions to |
125 // return its objects. | 128 // return its objects. |
126 virtual sqlite3* GetDB() = 0; | 129 virtual sqlite3* GetDB() = 0; |
127 virtual SqliteStatementCache& GetStatementCache() = 0; | 130 virtual SqliteStatementCache& GetStatementCache() = 0; |
128 | 131 |
129 // Called by the derived classes on initialization to make sure the tables | 132 // Called by the derived classes on initialization to make sure the tables |
130 // and indices are properly set up. Must be called before anything else. | 133 // and indices are properly set up. Must be called before anything else. |
131 bool InitVisitTable(); | 134 bool InitVisitTable(); |
132 | 135 |
133 // Convenience to fill a VisitRow. Assumes the visit values are bound starting | 136 // Convenience to fill a VisitRow. Assumes the visit values are bound starting |
134 // at index 0. | 137 // at index 0. |
135 static void FillVisitRow(SQLStatement& statement, VisitRow* visit); | 138 static void FillVisitRow(SQLStatement& statement, VisitRow* visit); |
136 | 139 |
137 // Convenience to fill a VisitVector. Assumes that statement.step() | 140 // Convenience to fill a VisitVector. Assumes that statement.step() |
138 // hasn't happened yet. | 141 // hasn't happened yet. |
139 static void FillVisitVector(SQLStatement& statement, VisitVector* visits); | 142 static void FillVisitVector(SQLStatement& statement, VisitVector* visits); |
140 | 143 |
141 private: | 144 private: |
142 DISALLOW_EVIL_CONSTRUCTORS(VisitDatabase); | 145 DISALLOW_EVIL_CONSTRUCTORS(VisitDatabase); |
143 }; | 146 }; |
144 | 147 |
145 } // history | 148 } // history |
146 | 149 |
147 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ | 150 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H__ |
OLD | NEW |