| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_HISTORY_CORE_ANDROID_VISIT_SQL_HANDLER_H_ | |
| 6 #define COMPONENTS_HISTORY_CORE_ANDROID_VISIT_SQL_HANDLER_H_ | |
| 7 | |
| 8 #include "components/history/core/android/sql_handler.h" | |
| 9 | |
| 10 namespace base { | |
| 11 class Time; | |
| 12 } | |
| 13 | |
| 14 namespace history { | |
| 15 | |
| 16 class URLDatabase; | |
| 17 class VisitDatabase; | |
| 18 | |
| 19 // This class is the SQLHandler for visits table. | |
| 20 class VisitSQLHandler : public SQLHandler { | |
| 21 public: | |
| 22 VisitSQLHandler(URLDatabase* url_db, VisitDatabase* visit_db); | |
| 23 virtual ~VisitSQLHandler(); | |
| 24 | |
| 25 // Overriden from SQLHandler. | |
| 26 virtual bool Update(const HistoryAndBookmarkRow& row, | |
| 27 const TableIDRows& ids_set) override; | |
| 28 virtual bool Insert(HistoryAndBookmarkRow* row) override; | |
| 29 virtual bool Delete(const TableIDRows& ids_set) override; | |
| 30 | |
| 31 private: | |
| 32 // Add a row in visit table with the given |url_id| and |visit_time|. | |
| 33 bool AddVisit(URLID url_id, const base::Time& visit_time); | |
| 34 | |
| 35 // Add the given |visit_count| rows for |url_id|. The visit time of each row | |
| 36 // has minium difference and ends with the |last_visit_time|. | |
| 37 bool AddVisitRows(URLID url_id, | |
| 38 int visit_count, | |
| 39 const base::Time& last_visit_time); | |
| 40 | |
| 41 // Delete the visits of the given |url_id|. | |
| 42 bool DeleteVisitsForURL(URLID url_id); | |
| 43 | |
| 44 URLDatabase* url_db_; | |
| 45 VisitDatabase* visit_db_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(VisitSQLHandler); | |
| 48 }; | |
| 49 | |
| 50 } // namespace history. | |
| 51 | |
| 52 #endif // COMPONENTS_HISTORY_CORE_ANDROID_VISIT_SQL_HANDLER_H_ | |
| OLD | NEW |