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" |
11 #include "chrome/browser/extensions/activity_log/activity_database.h" | 11 #include "chrome/browser/extensions/activity_log/activity_database.h" |
12 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" | 12 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" |
13 #include "chrome/browser/extensions/activity_log/database_string_table.h" | 13 #include "chrome/browser/extensions/activity_log/database_string_table.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 // A policy for logging the stream of actions, but without arguments. | 17 // A policy for logging the stream of actions, but with most arguments stripped |
| 18 // out (to improve privacy and reduce database size) and with multiple |
| 19 // identical rows combined together using a count column to track the total |
| 20 // number of repetitions. Identical rows within the same day are merged, but |
| 21 // actions on separate days are kept distinct. Data is kept for up to a few |
| 22 // days then deleted. |
18 class CountingPolicy : public ActivityLogDatabasePolicy { | 23 class CountingPolicy : public ActivityLogDatabasePolicy { |
19 public: | 24 public: |
20 explicit CountingPolicy(Profile* profile); | 25 explicit CountingPolicy(Profile* profile); |
21 virtual ~CountingPolicy(); | 26 virtual ~CountingPolicy(); |
22 | 27 |
23 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; | 28 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; |
24 | 29 |
25 virtual void ReadData( | 30 virtual void ReadData( |
26 const std::string& extension_id, | 31 const std::string& extension_id, |
27 const int day, | 32 const int day, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 141 |
137 friend class CountingPolicyTest; | 142 friend class CountingPolicyTest; |
138 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); | 143 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); |
139 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); | 144 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); |
140 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); | 145 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); |
141 }; | 146 }; |
142 | 147 |
143 } // namespace extensions | 148 } // namespace extensions |
144 | 149 |
145 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ | 150 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ |
OLD | NEW |