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