| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 void ProcessAction(scoped_refptr<Action> action) override; | 31 void ProcessAction(scoped_refptr<Action> action) override; |
| 32 | 32 |
| 33 void ReadFilteredData( | 33 void ReadFilteredData( |
| 34 const std::string& extension_id, | 34 const std::string& extension_id, |
| 35 const Action::ActionType type, | 35 const Action::ActionType type, |
| 36 const std::string& api_name, | 36 const std::string& api_name, |
| 37 const std::string& page_url, | 37 const std::string& page_url, |
| 38 const std::string& arg_url, | 38 const std::string& arg_url, |
| 39 const int days_ago, | 39 const int days_ago, |
| 40 const base::Callback<void(scoped_ptr<Action::ActionVector>)>& callback) | 40 const base::Callback<void(std::unique_ptr<Action::ActionVector>)>& |
| 41 override; | 41 callback) override; |
| 42 | 42 |
| 43 void Close() override; | 43 void Close() override; |
| 44 | 44 |
| 45 // Gets or sets the amount of time that old records are kept in the database. | 45 // Gets or sets the amount of time that old records are kept in the database. |
| 46 const base::TimeDelta& retention_time() const { return retention_time_; } | 46 const base::TimeDelta& retention_time() const { return retention_time_; } |
| 47 void set_retention_time(const base::TimeDelta& delta) { | 47 void set_retention_time(const base::TimeDelta& delta) { |
| 48 retention_time_ = delta; | 48 retention_time_ = delta; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Remove actions (rows) which IDs are specified in the action_ids array. | 51 // Remove actions (rows) which IDs are specified in the action_ids array. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 int, | 82 int, |
| 83 ActionComparatorExcludingTimeAndActionId> | 83 ActionComparatorExcludingTimeAndActionId> |
| 84 ActionQueue; | 84 ActionQueue; |
| 85 | 85 |
| 86 // Adds an Action to those to be written out; this is an internal method used | 86 // Adds an Action to those to be written out; this is an internal method used |
| 87 // by ProcessAction and is called on the database thread. | 87 // by ProcessAction and is called on the database thread. |
| 88 void QueueAction(scoped_refptr<Action> action); | 88 void QueueAction(scoped_refptr<Action> action); |
| 89 | 89 |
| 90 // Internal method to read data from the database; called on the database | 90 // Internal method to read data from the database; called on the database |
| 91 // thread. | 91 // thread. |
| 92 scoped_ptr<Action::ActionVector> DoReadFilteredData( | 92 std::unique_ptr<Action::ActionVector> DoReadFilteredData( |
| 93 const std::string& extension_id, | 93 const std::string& extension_id, |
| 94 const Action::ActionType type, | 94 const Action::ActionType type, |
| 95 const std::string& api_name, | 95 const std::string& api_name, |
| 96 const std::string& page_url, | 96 const std::string& page_url, |
| 97 const std::string& arg_url, | 97 const std::string& arg_url, |
| 98 const int days_ago); | 98 const int days_ago); |
| 99 | 99 |
| 100 // The implementation of RemoveActions; this must only run on the database | 100 // The implementation of RemoveActions; this must only run on the database |
| 101 // thread. | 101 // thread. |
| 102 void DoRemoveActions(const std::vector<int64_t>& action_ids); | 102 void DoRemoveActions(const std::vector<int64_t>& action_ids); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 friend class CountingPolicyTest; | 152 friend class CountingPolicyTest; |
| 153 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); | 153 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); |
| 154 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); | 154 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); |
| 155 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); | 155 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 } // namespace extensions | 158 } // namespace extensions |
| 159 | 159 |
| 160 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ | 160 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ |
| OLD | NEW |