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 |
51 // Delete everything in the database. | 54 // Delete everything in the database. |
52 virtual void DeleteDatabase() OVERRIDE; | 55 virtual void DeleteDatabase() OVERRIDE; |
53 | 56 |
54 // The main database table, and the name for a read-only view that | 57 // The main database table, and the name for a read-only view that |
55 // decompresses string values for easier parsing. | 58 // decompresses string values for easier parsing. |
56 static const char* kTableName; | 59 static const char* kTableName; |
57 static const char* kReadViewName; | 60 static const char* kReadViewName; |
58 | 61 |
59 protected: | 62 protected: |
60 // The ActivityDatabase::Delegate interface. These are always called from | 63 // The ActivityDatabase::Delegate interface. These are always called from |
(...skipping 21 matching lines...) Expand all Loading... |
82 const Action::ActionType type, | 85 const Action::ActionType type, |
83 const std::string& api_name, | 86 const std::string& api_name, |
84 const std::string& page_url, | 87 const std::string& page_url, |
85 const std::string& arg_url, | 88 const std::string& arg_url, |
86 const int days_ago); | 89 const int days_ago); |
87 | 90 |
88 // The implementation of RemoveURLs; this must only run on the database | 91 // The implementation of RemoveURLs; this must only run on the database |
89 // thread. | 92 // thread. |
90 void DoRemoveURLs(const std::vector<GURL>& restrict_urls); | 93 void DoRemoveURLs(const std::vector<GURL>& restrict_urls); |
91 | 94 |
| 95 // The implementation of RemoveExtensionData; this must only run on the |
| 96 // database thread. |
| 97 void DoRemoveExtensionData(const std::string& extension_id); |
| 98 |
92 // The implementation of DeleteDatabase; called on the database thread. | 99 // The implementation of DeleteDatabase; called on the database thread. |
93 void DoDeleteDatabase(); | 100 void DoDeleteDatabase(); |
94 | 101 |
95 // Cleans old records from the activity log database. | 102 // Cleans old records from the activity log database. |
96 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff); | 103 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff); |
97 | 104 |
98 // Cleans unused interned strings from the database. This should be run | 105 // Cleans unused interned strings from the database. This should be run |
99 // after deleting rows from the main log table to clean out stale values. | 106 // after deleting rows from the main log table to clean out stale values. |
100 bool CleanStringTables(sql::Connection* db); | 107 bool CleanStringTables(sql::Connection* db); |
101 | 108 |
(...skipping 29 matching lines...) Expand all Loading... |
131 | 138 |
132 friend class CountingPolicyTest; | 139 friend class CountingPolicyTest; |
133 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); | 140 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); |
134 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); | 141 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); |
135 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); | 142 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); |
136 }; | 143 }; |
137 | 144 |
138 } // namespace extensions | 145 } // namespace extensions |
139 | 146 |
140 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ | 147 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ |
OLD | NEW |