Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: chrome/browser/extensions/activity_log/counting_policy.h

Issue 18878009: Add functions to clean URLs from the activity log (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added counting policy Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; 29 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE;
30 30
31 virtual void Close() OVERRIDE; 31 virtual void Close() OVERRIDE;
32 32
33 // Gets or sets the amount of time that old records are kept in the database. 33 // Gets or sets the amount of time that old records are kept in the database.
34 const base::TimeDelta& retention_time() const { return retention_time_; } 34 const base::TimeDelta& retention_time() const { return retention_time_; }
35 void set_retention_time(const base::TimeDelta& delta) { 35 void set_retention_time(const base::TimeDelta& delta) {
36 retention_time_ = delta; 36 retention_time_ = delta;
37 } 37 }
38 38
39 // Clean the URL data stored for this policy.
40 virtual void RemoveURLs(const std::vector<GURL>&);
mvrable 2013/08/26 20:38:50 virtual void RemoveURLs(const std::vector<GURL>&)
karenlees 2013/08/26 22:58:36 Done.
41
39 // The main database table, and the name for a read-only view that 42 // The main database table, and the name for a read-only view that
40 // decompresses string values for easier parsing. 43 // decompresses string values for easier parsing.
41 static const char* kTableName; 44 static const char* kTableName;
42 static const char* kReadViewName; 45 static const char* kReadViewName;
43 46
44 protected: 47 protected:
45 // The ActivityDatabase::Delegate interface. These are always called from 48 // The ActivityDatabase::Delegate interface. These are always called from
46 // the database thread. 49 // the database thread.
47 virtual bool InitDatabase(sql::Connection* db) OVERRIDE; 50 virtual bool InitDatabase(sql::Connection* db) OVERRIDE;
48 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE; 51 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE;
(...skipping 10 matching lines...) Expand all
59 // Adds an Action to those to be written out; this is an internal method used 62 // Adds an Action to those to be written out; this is an internal method used
60 // by ProcessAction and is called on the database thread. 63 // by ProcessAction and is called on the database thread.
61 void QueueAction(scoped_refptr<Action> action); 64 void QueueAction(scoped_refptr<Action> action);
62 65
63 // Internal method to read data from the database; called on the database 66 // Internal method to read data from the database; called on the database
64 // thread. 67 // thread.
65 scoped_ptr<Action::ActionVector> DoReadData( 68 scoped_ptr<Action::ActionVector> DoReadData(
66 const std::string& extension_id, 69 const std::string& extension_id,
67 const int days_ago); 70 const int days_ago);
68 71
72 // The implementation of RemoveURLs; this must only run on the database
73 // thread.
74 virtual void DoRemoveURLs(const std::vector<GURL>& restrict_urls);
mvrable 2013/08/26 20:38:50 Doesn't need to be virtual since the method is pri
karenlees 2013/08/26 22:58:36 Done - but should I make it protected instead, inc
mvrable 2013/08/27 17:17:37 Personal opinion: it doesn't need to be as we can
75
69 // Cleans old records from the activity log database. 76 // Cleans old records from the activity log database.
70 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff); 77 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff);
71 78
72 // Cleans unused interned strings from the database. This should be run 79 // Cleans unused interned strings from the database. This should be run
73 // after deleting rows from the main log table to clean out stale values. 80 // after deleting rows from the main log table to clean out stale values.
74 bool CleanStringTables(sql::Connection* db); 81 bool CleanStringTables(sql::Connection* db);
75 82
76 // API calls for which complete arguments should be logged. 83 // API calls for which complete arguments should be logged.
77 std::set<std::string> api_arg_whitelist_; 84 std::set<std::string> api_arg_whitelist_;
78 85
(...skipping 25 matching lines...) Expand all
104 base::Time last_database_cleaning_time_; 111 base::Time last_database_cleaning_time_;
105 112
106 friend class CountingPolicyTest; 113 friend class CountingPolicyTest;
107 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); 114 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring);
108 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); 115 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning);
109 }; 116 };
110 117
111 } // namespace extensions 118 } // namespace extensions
112 119
113 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ 120 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698