| 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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/history/history_types.h" | 10 #include "chrome/browser/history/history_types.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 int* count, | 166 int* count, |
| 167 base::Time* first_visit); | 167 base::Time* first_visit); |
| 168 | 168 |
| 169 // Get the time of the first item in our database. | 169 // Get the time of the first item in our database. |
| 170 bool GetStartDate(base::Time* first_visit); | 170 bool GetStartDate(base::Time* first_visit); |
| 171 | 171 |
| 172 // Get the source information about the given visits. | 172 // Get the source information about the given visits. |
| 173 void GetVisitsSource(const VisitVector& visits, | 173 void GetVisitsSource(const VisitVector& visits, |
| 174 VisitSourceMap* sources); | 174 VisitSourceMap* sources); |
| 175 | 175 |
| 176 // Update the visit_details table with the duration information. |
| 177 bool UpdateVisitDetails(VisitID visit_id, const base::TimeDelta duration); |
| 178 |
| 179 // Get the visit details about the given visits. |
| 180 void GetVisitDetails(const VisitVector& visits, VisitDetailMap* details); |
| 181 |
| 176 protected: | 182 protected: |
| 177 // Returns the database for the functions in this interface. | 183 // Returns the database for the functions in this interface. |
| 178 virtual sql::Connection& GetDB() = 0; | 184 virtual sql::Connection& GetDB() = 0; |
| 179 | 185 |
| 180 // Called by the derived classes on initialization to make sure the tables | 186 // Called by the derived classes on initialization to make sure the tables |
| 181 // and indices are properly set up. Must be called before anything else. | 187 // and indices are properly set up. Must be called before anything else. |
| 182 bool InitVisitTable(); | 188 bool InitVisitTable(); |
| 183 | 189 |
| 184 // Convenience to fill a VisitRow. Assumes the visit values are bound starting | 190 // Convenience to fill a VisitRow. Assumes the visit values are bound starting |
| 185 // at index 0. | 191 // at index 0. |
| 186 static void FillVisitRow(sql::Statement& statement, VisitRow* visit); | 192 static void FillVisitRow(sql::Statement& statement, VisitRow* visit); |
| 187 | 193 |
| 188 // Convenience to fill a VisitVector. Assumes that statement.step() | 194 // Convenience to fill a VisitVector. Assumes that statement.step() |
| 189 // hasn't happened yet. | 195 // hasn't happened yet. |
| 190 static bool FillVisitVector(sql::Statement& statement, VisitVector* visits); | 196 static bool FillVisitVector(sql::Statement& statement, VisitVector* visits); |
| 191 | 197 |
| 192 private: | 198 private: |
| 193 class VisitAnalysis; | 199 class VisitAnalysis; |
| 194 scoped_ptr<VisitAnalysis> visit_analysis_; | 200 scoped_ptr<VisitAnalysis> visit_analysis_; |
| 195 | 201 |
| 196 DISALLOW_COPY_AND_ASSIGN(VisitDatabase); | 202 DISALLOW_COPY_AND_ASSIGN(VisitDatabase); |
| 197 }; | 203 }; |
| 198 | 204 |
| 199 } // history | 205 } // history |
| 200 | 206 |
| 201 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_ | 207 #endif // CHROME_BROWSER_HISTORY_VISIT_DATABASE_H_ |
| OLD | NEW |