| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Instead of a public destructor, ActivityLogPolicy objects have a Close() | 67 // Instead of a public destructor, ActivityLogPolicy objects have a Close() |
| 68 // method which will cause the object to be deleted (but may do so on another | 68 // method which will cause the object to be deleted (but may do so on another |
| 69 // thread or in a deferred fashion). | 69 // thread or in a deferred fashion). |
| 70 virtual void Close() = 0; | 70 virtual void Close() = 0; |
| 71 | 71 |
| 72 // Updates the internal state of the model summarizing actions and possibly | 72 // Updates the internal state of the model summarizing actions and possibly |
| 73 // writes to the database. Implements the default policy storing internal | 73 // writes to the database. Implements the default policy storing internal |
| 74 // state to memory every 5 min. | 74 // state to memory every 5 min. |
| 75 virtual void ProcessAction(scoped_refptr<Action> action) = 0; | 75 virtual void ProcessAction(scoped_refptr<Action> action) = 0; |
| 76 | 76 |
| 77 // Gets all actions for a given extension for the specified day. 0 = today, | |
| 78 // 1 = yesterday, etc. Only returns 1 day at a time. Actions are sorted from | |
| 79 // newest to oldest. Results as passed to the specified callback when | |
| 80 // available. | |
| 81 // | |
| 82 // TODO(felt,dbabic) This is overly specific to the current implementation of | |
| 83 // the FullStreamUIPolicy. We should refactor it to use a more generic read | |
| 84 // function, for example one that takes a dictionary of query parameters | |
| 85 // (extension_id, time range, etc.). | |
| 86 virtual void ReadData( | |
| 87 const std::string& extension_id, | |
| 88 const int day, | |
| 89 const base::Callback | |
| 90 <void(scoped_ptr<Action::ActionVector>)>& callback) = 0; | |
| 91 | |
| 92 // Gets all actions that match the specified fields. URLs are treated like | 77 // Gets all actions that match the specified fields. URLs are treated like |
| 93 // prefixes; other fields are exact matches. Empty strings are not matched to | 78 // prefixes; other fields are exact matches. Empty strings are not matched to |
| 94 // anything. | 79 // anything. For the date: 0 = today, 1 = yesterday, etc.; if the data is |
| 80 // negative, it will be treated as missing. |
| 95 virtual void ReadFilteredData( | 81 virtual void ReadFilteredData( |
| 96 const std::string& extension_id, | 82 const std::string& extension_id, |
| 97 const Action::ActionType type, | 83 const Action::ActionType type, |
| 98 const std::string& api_name, | 84 const std::string& api_name, |
| 99 const std::string& page_url, | 85 const std::string& page_url, |
| 100 const std::string& arg_url, | 86 const std::string& arg_url, |
| 87 const int days_ago, |
| 101 const base::Callback | 88 const base::Callback |
| 102 <void(scoped_ptr<Action::ActionVector>)>& callback) = 0; | 89 <void(scoped_ptr<Action::ActionVector>)>& callback) = 0; |
| 103 | 90 |
| 104 // Clean the relevant URL data. The cleaning may need to be different for | 91 // 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. | 92 // different policies. If restrict_urls is empty then all URLs are removed. |
| 106 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) = 0; | 93 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) = 0; |
| 107 | 94 |
| 108 // For unit testing only. | 95 // For unit testing only. |
| 109 void SetClockForTesting(scoped_ptr<base::Clock> clock); | 96 void SetClockForTesting(scoped_ptr<base::Clock> clock); |
| 110 | 97 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 209 |
| 223 private: | 210 private: |
| 224 // See the comments for the ActivityDatabase class for a discussion of how | 211 // See the comments for the ActivityDatabase class for a discussion of how |
| 225 // database cleanup runs. | 212 // database cleanup runs. |
| 226 ActivityDatabase* db_; | 213 ActivityDatabase* db_; |
| 227 }; | 214 }; |
| 228 | 215 |
| 229 } // namespace extensions | 216 } // namespace extensions |
| 230 | 217 |
| 231 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ | 218 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ |
| OLD | NEW |