OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/history/history_types.h" | 9 #include "chrome/browser/history/history_types.h" |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 int* count, | 165 int* count, |
166 base::Time* first_visit); | 166 base::Time* first_visit); |
167 | 167 |
168 // Get the time of the first item in our database. | 168 // Get the time of the first item in our database. |
169 bool GetStartDate(base::Time* first_visit); | 169 bool GetStartDate(base::Time* first_visit); |
170 | 170 |
171 // Get the source information about the given visits. | 171 // Get the source information about the given visits. |
172 void GetVisitsSource(const VisitVector& visits, | 172 void GetVisitsSource(const VisitVector& visits, |
173 VisitSourceMap* sources); | 173 VisitSourceMap* sources); |
174 | 174 |
| 175 // Obtains BriefVisitInfo for the specified number of most recent visits |
| 176 // from the visit database. |
| 177 void GetBriefVisitInfoOfMostRecentVisits( |
| 178 int max_visits, |
| 179 std::vector<BriefVisitInfo>* result_vector); |
| 180 |
175 protected: | 181 protected: |
176 // Returns the database for the functions in this interface. | 182 // Returns the database for the functions in this interface. |
177 virtual sql::Connection& GetDB() = 0; | 183 virtual sql::Connection& GetDB() = 0; |
178 | 184 |
179 // Called by the derived classes on initialization to make sure the tables | 185 // Called by the derived classes on initialization to make sure the tables |
180 // and indices are properly set up. Must be called before anything else. | 186 // and indices are properly set up. Must be called before anything else. |
181 bool InitVisitTable(); | 187 bool InitVisitTable(); |
182 | 188 |
183 // Convenience to fill a VisitRow. Assumes the visit values are bound starting | 189 // Convenience to fill a VisitRow. Assumes the visit values are bound starting |
184 // at index 0. | 190 // at index 0. |
185 static void FillVisitRow(sql::Statement& statement, VisitRow* visit); | 191 static void FillVisitRow(sql::Statement& statement, VisitRow* visit); |
186 | 192 |
187 // Convenience to fill a VisitVector. Assumes that statement.step() | 193 // Convenience to fill a VisitVector. Assumes that statement.step() |
188 // hasn't happened yet. | 194 // hasn't happened yet. |
189 static bool FillVisitVector(sql::Statement& statement, VisitVector* visits); | 195 static bool FillVisitVector(sql::Statement& statement, VisitVector* visits); |
190 | 196 |
191 // Called by the derived classes to migrate the older visits table which | 197 // Called by the derived classes to migrate the older visits table which |
192 // don't have visit_duration column yet. | 198 // don't have visit_duration column yet. |
193 bool MigrateVisitsWithoutDuration(); | 199 bool MigrateVisitsWithoutDuration(); |
194 | 200 |
195 private: | 201 private: |
196 | 202 |
197 DISALLOW_COPY_AND_ASSIGN(VisitDatabase); | 203 DISALLOW_COPY_AND_ASSIGN(VisitDatabase); |
198 }; | 204 }; |
199 | 205 |
200 } // history | 206 } // history |
201 | 207 |
202 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_ | 208 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_ |
OLD | NEW |