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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/history/history_types.h" | 10 #include "chrome/browser/history/history_types.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Fills in the given vector with all of the visits for the given page ID, | 56 // Fills in the given vector with all of the visits for the given page ID, |
57 // sorted in ascending order of date. Returns true on success (although there | 57 // sorted in ascending order of date. Returns true on success (although there |
58 // may still be no matches). | 58 // may still be no matches). |
59 bool GetVisitsForURL(URLID url_id, VisitVector* visits); | 59 bool GetVisitsForURL(URLID url_id, VisitVector* visits); |
60 | 60 |
61 // Fills in the given vector with all of the visits for the given page ID that | 61 // Fills in the given vector with all of the visits for the given page ID that |
62 // have the |is_indexed| field set to true, in no particular order. | 62 // have the |is_indexed| field set to true, in no particular order. |
63 // Returns true on success (although there may still be no matches). | 63 // Returns true on success (although there may still be no matches). |
64 bool GetIndexedVisitsForURL(URLID url_id, VisitVector* visits); | 64 bool GetIndexedVisitsForURL(URLID url_id, VisitVector* visits); |
65 | 65 |
| 66 // Fills in the given vector with the visits for the given page ID which |
| 67 // match the set of options passed, sorted in ascending order of date. |
| 68 // |
| 69 // Returns true if there are more results available, i.e. if the number of |
| 70 // results was restricted by |options.max_count|. |
| 71 bool GetVisitsForURLWithOptions(URLID url_id, |
| 72 const QueryOptions& options, |
| 73 VisitVector* visits); |
| 74 |
66 // Fills the vector with all visits with times in the given list. | 75 // Fills the vector with all visits with times in the given list. |
67 // | 76 // |
68 // The results will be in no particular order. Also, no duplicate | 77 // The results will be in no particular order. Also, no duplicate |
69 // detection is performed, so if |times| has duplicate times, | 78 // detection is performed, so if |times| has duplicate times, |
70 // |visits| may have duplicate visits. | 79 // |visits| may have duplicate visits. |
71 bool GetVisitsForTimes(const std::vector<base::Time>& times, | 80 bool GetVisitsForTimes(const std::vector<base::Time>& times, |
72 VisitVector* visits); | 81 VisitVector* visits); |
73 | 82 |
74 // Fills all visits in the time range [begin, end) to the given vector. Either | 83 // Fills all visits in the time range [begin, end) to the given vector. Either |
75 // time can be is_null(), in which case the times in that direction are | 84 // time can be is_null(), in which case the times in that direction are |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 bool InitVisitTable(); | 204 bool InitVisitTable(); |
196 | 205 |
197 // Convenience to fill a VisitRow. Assumes the visit values are bound starting | 206 // Convenience to fill a VisitRow. Assumes the visit values are bound starting |
198 // at index 0. | 207 // at index 0. |
199 static void FillVisitRow(sql::Statement& statement, VisitRow* visit); | 208 static void FillVisitRow(sql::Statement& statement, VisitRow* visit); |
200 | 209 |
201 // Convenience to fill a VisitVector. Assumes that statement.step() | 210 // Convenience to fill a VisitVector. Assumes that statement.step() |
202 // hasn't happened yet. | 211 // hasn't happened yet. |
203 static bool FillVisitVector(sql::Statement& statement, VisitVector* visits); | 212 static bool FillVisitVector(sql::Statement& statement, VisitVector* visits); |
204 | 213 |
| 214 // Convenience to fill a VisitVector while respecting the set of options. |
| 215 // Assumes that statement.step() hasn't happened yet. |
| 216 static bool FillVisitVectorWithOptions(sql::Statement& statement, |
| 217 const QueryOptions& options, |
| 218 VisitVector* visits); |
| 219 |
205 // Called by the derived classes to migrate the older visits table which | 220 // Called by the derived classes to migrate the older visits table which |
206 // don't have visit_duration column yet. | 221 // don't have visit_duration column yet. |
207 bool MigrateVisitsWithoutDuration(); | 222 bool MigrateVisitsWithoutDuration(); |
208 | 223 |
209 private: | 224 private: |
210 | 225 |
211 DISALLOW_COPY_AND_ASSIGN(VisitDatabase); | 226 DISALLOW_COPY_AND_ASSIGN(VisitDatabase); |
212 }; | 227 }; |
213 | 228 |
214 // Rows, in order, of the visit table. | 229 // Rows, in order, of the visit table. |
215 #define HISTORY_VISIT_ROW_FIELDS \ | 230 #define HISTORY_VISIT_ROW_FIELDS \ |
216 " id,url,visit_time,from_visit,transition,segment_id,is_indexed," \ | 231 " id,url,visit_time,from_visit,transition,segment_id,is_indexed," \ |
217 "visit_duration " | 232 "visit_duration " |
218 | 233 |
219 } // history | 234 } // namespace history |
220 | 235 |
221 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_ | 236 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_ |
OLD | NEW |