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

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

Issue 23629015: Add deletion to the activityLogPrivate API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undoing last commit 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 30 matching lines...) Expand all
41 41
42 // Gets or sets the amount of time that old records are kept in the database. 42 // Gets or sets the amount of time that old records are kept in the database.
43 const base::TimeDelta& retention_time() const { return retention_time_; } 43 const base::TimeDelta& retention_time() const { return retention_time_; }
44 void set_retention_time(const base::TimeDelta& delta) { 44 void set_retention_time(const base::TimeDelta& delta) {
45 retention_time_ = delta; 45 retention_time_ = delta;
46 } 46 }
47 47
48 // Clean the URL data stored for this policy. 48 // Clean the URL data stored for this policy.
49 virtual void RemoveURLs(const std::vector<GURL>&) OVERRIDE; 49 virtual void RemoveURLs(const std::vector<GURL>&) OVERRIDE;
50 50
51 // Delete everything in the database.
52 virtual void DeleteDatabase() OVERRIDE;
53
51 // The main database table, and the name for a read-only view that 54 // The main database table, and the name for a read-only view that
52 // decompresses string values for easier parsing. 55 // decompresses string values for easier parsing.
53 static const char* kTableName; 56 static const char* kTableName;
54 static const char* kReadViewName; 57 static const char* kReadViewName;
55 58
56 protected: 59 protected:
57 // The ActivityDatabase::Delegate interface. These are always called from 60 // The ActivityDatabase::Delegate interface. These are always called from
58 // the database thread. 61 // the database thread.
59 virtual bool InitDatabase(sql::Connection* db) OVERRIDE; 62 virtual bool InitDatabase(sql::Connection* db) OVERRIDE;
60 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE; 63 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE;
(...skipping 23 matching lines...) Expand all
84 const std::string& extension_id, 87 const std::string& extension_id,
85 const Action::ActionType type, 88 const Action::ActionType type,
86 const std::string& api_name, 89 const std::string& api_name,
87 const std::string& page_url, 90 const std::string& page_url,
88 const std::string& arg_url); 91 const std::string& arg_url);
89 92
90 // The implementation of RemoveURLs; this must only run on the database 93 // The implementation of RemoveURLs; this must only run on the database
91 // thread. 94 // thread.
92 void DoRemoveURLs(const std::vector<GURL>& restrict_urls); 95 void DoRemoveURLs(const std::vector<GURL>& restrict_urls);
93 96
97 // The implementation of DeleteDatabase; called on the database thread.
98 void DoDeleteDatabase();
99
94 // Cleans old records from the activity log database. 100 // Cleans old records from the activity log database.
95 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff); 101 bool CleanOlderThan(sql::Connection* db, const base::Time& cutoff);
96 102
97 // Cleans unused interned strings from the database. This should be run 103 // Cleans unused interned strings from the database. This should be run
98 // after deleting rows from the main log table to clean out stale values. 104 // after deleting rows from the main log table to clean out stale values.
99 bool CleanStringTables(sql::Connection* db); 105 bool CleanStringTables(sql::Connection* db);
100 106
101 // API calls for which complete arguments should be logged. 107 // API calls for which complete arguments should be logged.
102 std::set<std::string> api_arg_whitelist_; 108 std::set<std::string> api_arg_whitelist_;
103 109
(...skipping 26 matching lines...) Expand all
130 136
131 friend class CountingPolicyTest; 137 friend class CountingPolicyTest;
132 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush); 138 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, EarlyFlush);
133 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring); 139 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, MergingAndExpiring);
134 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning); 140 FRIEND_TEST_ALL_PREFIXES(CountingPolicyTest, StringTableCleaning);
135 }; 141 };
136 142
137 } // namespace extensions 143 } // namespace extensions
138 144
139 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_ 145 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_COUNTING_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698