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_ACTIVITY_LOG_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // An abstract class for processing and summarizing activity log data. | 33 // An abstract class for processing and summarizing activity log data. |
34 // Subclasses will generally store data in an SQLite database (the | 34 // Subclasses will generally store data in an SQLite database (the |
35 // ActivityLogDatabasePolicy subclass includes some helper methods to assist | 35 // ActivityLogDatabasePolicy subclass includes some helper methods to assist |
36 // with this case), but this is not absolutely required. | 36 // with this case), but this is not absolutely required. |
37 // | 37 // |
38 // Implementations should support: | 38 // Implementations should support: |
39 // (1) Receiving Actions to process, and summarizing, compression, and storing | 39 // (1) Receiving Actions to process, and summarizing, compression, and storing |
40 // these as appropriate. | 40 // these as appropriate. |
41 // (2) Reading Actions back from storage. | 41 // (2) Reading Actions back from storage. |
| 42 // (3) Cleaning of URLs |
42 // | 43 // |
43 // Implementations based on a database should likely implement | 44 // Implementations based on a database should likely implement |
44 // ActivityDatabase::Delegate, which provides hooks on database events and | 45 // ActivityDatabase::Delegate, which provides hooks on database events and |
45 // allows the database to periodically request that actions (which the policy | 46 // allows the database to periodically request that actions (which the policy |
46 // is responsible for queueing) be flushed to storage. | 47 // is responsible for queueing) be flushed to storage. |
47 // | 48 // |
48 // Since every policy implementation might summarize data differently, the | 49 // Since every policy implementation might summarize data differently, the |
49 // database implementation is policy-specific and therefore completely | 50 // database implementation is policy-specific and therefore completely |
50 // encapsulated in the policy class. All the member functions can be called | 51 // encapsulated in the policy class. All the member functions can be called |
51 // on the UI thread. | 52 // on the UI thread. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Gets all actions that match the specified fields. URLs are treated like | 92 // Gets all actions that match the specified fields. URLs are treated like |
92 // prefixes; other fields are exact matches. Empty strings are not matched to | 93 // prefixes; other fields are exact matches. Empty strings are not matched to |
93 // anything. | 94 // anything. |
94 virtual void ReadFilteredData( | 95 virtual void ReadFilteredData( |
95 const std::string& extension_id, | 96 const std::string& extension_id, |
96 const Action::ActionType type, | 97 const Action::ActionType type, |
97 const std::string& api_name, | 98 const std::string& api_name, |
98 const std::string& page_url, | 99 const std::string& page_url, |
99 const std::string& arg_url, | 100 const std::string& arg_url, |
100 const base::Callback | 101 const base::Callback |
101 <void(scoped_ptr<Action::ActionVector>)>& callback) = 0; | 102 <void(scoped_ptr<Action::ActionVector>)>& callback) = 0; |
| 103 |
| 104 // Clean the relevant URL data. The cleaning may need to be different for |
| 105 // different policies. If restrict_urls is empty then all URLs are removed. |
| 106 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) = 0; |
102 | 107 |
103 // For unit testing only. | 108 // For unit testing only. |
104 void SetClockForTesting(scoped_ptr<base::Clock> clock); | 109 void SetClockForTesting(scoped_ptr<base::Clock> clock); |
105 | 110 |
106 // A collection of methods that are useful for implementing policies. These | 111 // A collection of methods that are useful for implementing policies. These |
107 // are all static methods; the ActivityLogPolicy::Util class cannot be | 112 // are all static methods; the ActivityLogPolicy::Util class cannot be |
108 // instantiated. This is nested within ActivityLogPolicy to make calling | 113 // instantiated. This is nested within ActivityLogPolicy to make calling |
109 // these methods more convenient from within a policy, but they are public. | 114 // these methods more convenient from within a policy, but they are public. |
110 class Util { | 115 class Util { |
111 public: | 116 public: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 222 |
218 private: | 223 private: |
219 // See the comments for the ActivityDatabase class for a discussion of how | 224 // See the comments for the ActivityDatabase class for a discussion of how |
220 // database cleanup runs. | 225 // database cleanup runs. |
221 ActivityDatabase* db_; | 226 ActivityDatabase* db_; |
222 }; | 227 }; |
223 | 228 |
224 } // namespace extensions | 229 } // namespace extensions |
225 | 230 |
226 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ | 231 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
OLD | NEW |