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_VISITSEGMENT_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_VISITSEGMENT_DATABASE_H_ |
6 #define CHROME_BROWSER_HISTORY_VISITSEGMENT_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_VISITSEGMENT_DATABASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/history/history_types.h" | 10 #include "chrome/browser/history/history_types.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 bool IncreaseSegmentVisitCount(SegmentID segment_id, base::Time ts, | 51 bool IncreaseSegmentVisitCount(SegmentID segment_id, base::Time ts, |
52 int amount); | 52 int amount); |
53 | 53 |
54 // Compute the segment usage since |from_time| using the provided aggregator. | 54 // Compute the segment usage since |from_time| using the provided aggregator. |
55 // A PageUsageData is added in |result| for the highest-scored segments up to | 55 // A PageUsageData is added in |result| for the highest-scored segments up to |
56 // |max_result_count|. | 56 // |max_result_count|. |
57 void QuerySegmentUsage(base::Time from_time, | 57 void QuerySegmentUsage(base::Time from_time, |
58 int max_result_count, | 58 int max_result_count, |
59 std::vector<PageUsageData*>* result); | 59 std::vector<PageUsageData*>* result); |
60 | 60 |
| 61 // Compute the segment usage from |from_time| to |to_time| using the provided |
| 62 // aggregator. A PageUsageData is added in |result| for the highest-scored |
| 63 // segments up to |max_result_count|. |
| 64 void QuerySegmentUsageTimeInterval(base::Time from_time, |
| 65 base::Time to_time, |
| 66 int max_result_count, |
| 67 std::vector<PageUsageData*>* result); |
| 68 |
61 // Delete all the segment usage data which is older than the provided time | 69 // Delete all the segment usage data which is older than the provided time |
62 // stamp. | 70 // stamp. |
63 bool DeleteSegmentData(base::Time older_than); | 71 bool DeleteSegmentData(base::Time older_than); |
64 | 72 |
65 // Change the presentation id for the segment identified by |segment_id| | 73 // Change the presentation id for the segment identified by |segment_id| |
66 bool SetSegmentPresentationIndex(SegmentID segment_id, int index); | 74 bool SetSegmentPresentationIndex(SegmentID segment_id, int index); |
67 | 75 |
68 // Delete the segment currently using the provided url for representation. | 76 // Delete the segment currently using the provided url for representation. |
69 // This will also delete any associated segment usage data. | 77 // This will also delete any associated segment usage data. |
70 bool DeleteSegmentForURL(URLID url_id); | 78 bool DeleteSegmentForURL(URLID url_id); |
71 | 79 |
72 protected: | 80 protected: |
73 // Returns the database for the functions in this interface. | 81 // Returns the database for the functions in this interface. |
74 virtual sql::Connection& GetDB() = 0; | 82 virtual sql::Connection& GetDB() = 0; |
75 | 83 |
76 // Creates the tables used by this class if necessary. Returns true on | 84 // Creates the tables used by this class if necessary. Returns true on |
77 // success. | 85 // success. |
78 bool InitSegmentTables(); | 86 bool InitSegmentTables(); |
79 | 87 |
80 // Deletes all the segment tables, returning true on success. | 88 // Deletes all the segment tables, returning true on success. |
81 bool DropSegmentTables(); | 89 bool DropSegmentTables(); |
82 | 90 |
83 private: | 91 private: |
84 DISALLOW_COPY_AND_ASSIGN(VisitSegmentDatabase); | 92 DISALLOW_COPY_AND_ASSIGN(VisitSegmentDatabase); |
85 }; | 93 }; |
86 | 94 |
87 } // namespace history | 95 } // namespace history |
88 | 96 |
89 #endif // CHROME_BROWSER_HISTORY_VISITSEGMENT_DATABASE_H_ | 97 #endif // CHROME_BROWSER_HISTORY_VISITSEGMENT_DATABASE_H_ |
OLD | NEW |