OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Gets or sets the amount of time that old records are kept in the database. | 42 // Gets or sets the amount of time that old records are kept in the database. |
43 const base::TimeDelta& retention_time() const { return retention_time_; } | 43 const base::TimeDelta& retention_time() const { return retention_time_; } |
44 void set_retention_time(const base::TimeDelta& delta) { | 44 void set_retention_time(const base::TimeDelta& delta) { |
45 retention_time_ = delta; | 45 retention_time_ = delta; |
46 } | 46 } |
47 | 47 |
48 // Clean the URL data stored for this policy. | 48 // Clean the URL data stored for this policy. |
49 virtual void RemoveURLs(const std::vector<GURL>&) OVERRIDE; | 49 virtual void RemoveURLs(const std::vector<GURL>&) OVERRIDE; |
50 | 50 |
51 // Clean the data related to this extension for this policy. | |
52 virtual void RemoveExtensionData(const std::string& extension_id) OVERRIDE; | |
53 | |
54 // Delete everything in the database. | 51 // Delete everything in the database. |
55 virtual void DeleteDatabase() OVERRIDE; | 52 virtual void DeleteDatabase() OVERRIDE; |
56 | 53 |
57 // The main database table, and the name for a read-only view that | 54 // The main database table, and the name for a read-only view that |
58 // decompresses string values for easier parsing. | 55 // decompresses string values for easier parsing. |
59 static const char* kTableName; | 56 static const char* kTableName; |
60 static const char* kReadViewName; | 57 static const char* kReadViewName; |
61 | 58 |
62 protected: | 59 protected: |
63 // The ActivityDatabase::Delegate interface. These are always called from | 60 // The ActivityDatabase::Delegate interface. These are always called from |
(...skipping 21 matching lines...) Expand all Loading... |
85 const Action::ActionType type, | 82 const Action::ActionType type, |
86 const std::string& api_name, | 83 const std::string& api_name, |
87 const std::string& page_url, | 84 const std::string& page_url, |
88 const std::string& arg_url, | 85 const std::string& arg_url, |
89 const int days_ago); | 86 const int days_ago); |
90 | 87 |
91 // The implementation of RemoveURLs; this must only run on the database | 88 // The implementation of RemoveURLs; this must only run on the database |
92 // thread. | 89 // thread. |
93 void DoRemoveURLs(const std::vector<GURL>& restrict_urls); | 90 void DoRemoveURLs(const std::vector<GURL>& restrict_urls); |
94 | 91 |
95 // The implementation of RemoveExtensionData; this must only run on the | |
96 // database thread. | |
97 void DoRemoveExtensionData(const std::string& extension_id); | |
98 | |
99 // The implementation of DeleteDatabase; called on the database thread. | 92 // The implementation of DeleteDatabase; called on the database thread. |
100 void DoDeleteDatabase(); | 93 void DoDeleteDatabase(); |
101 | 94 |
102 // Cleans old records from the activity log database. | 95 // Cleans old records from the activity log database. |
103 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff); | 96 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff); |
104 | 97 |
105 // Cleans unused interned strings from the database. This should be run | 98 // Cleans unused interned strings from the database. This should be run |
106 // after deleting rows from the main log table to clean out stale values. | 99 // after deleting rows from the main log table to clean out stale values. |
107 bool CleanStringTables(sql::Connection* db); | 100 bool CleanStringTables(sql::Connection* db); |
108 | 101 |
(...skipping 29 matching lines...) Expand all Loading... |
138 | 131 |
139 friend class CountingPolicyTest; | 132 friend class CountingPolicyTest; |
140 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); | 133 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); |
141 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); | 134 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); |
142 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); | 135 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); |
143 }; | 136 }; |
144 | 137 |
145 } // namespace extensions | 138 } // namespace extensions |
146 | 139 |
147 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ | 140 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ |
OLD | NEW |