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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_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: Fix some comments Created 7 years, 5 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_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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 namespace extensions { 24 namespace extensions {
25 25
26 class Extension; 26 class Extension;
27 27
28 // Abstract class for summarizing data and storing it into the database. Any 28 // Abstract class for summarizing data and storing it into the database. Any
29 // subclass should implement the following functionality: 29 // subclass should implement the following functionality:
30 // 30 //
31 // (1) Summarization (and possibly) compression of data 31 // (1) Summarization (and possibly) compression of data
32 // (2) Periodical saving of the in-memory state with the database 32 // (2) Periodical saving of the in-memory state with the database
33 // (3) Periodical database cleanup 33 // (3) Periodical database cleanup
34 // (4) Cleaning of URLs
34 // 35 //
35 // Since every policy implementation might summarize data differently, the 36 // Since every policy implementation might summarize data differently, the
36 // database implementation is policy-specific and therefore completely 37 // database implementation is policy-specific and therefore completely
37 // encapsulated in the policy class. All the member functions can be called 38 // encapsulated in the policy class. All the member functions can be called
38 // on the UI thread, because all DB operations are dispatched via the 39 // on the UI thread, because all DB operations are dispatched via the
39 // ActivityDatabase. 40 // ActivityDatabase.
40 class ActivityLogPolicy { 41 class ActivityLogPolicy {
41 public: 42 public:
42 enum PolicyType { 43 enum PolicyType {
43 POLICY_FULLSTREAM, 44 POLICY_FULLSTREAM,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // TODO(felt,dbabic) This is overly specific to the current implementation 100 // TODO(felt,dbabic) This is overly specific to the current implementation
100 // of the FullStreamUIPolicy. We should refactor it to use the above 101 // of the FullStreamUIPolicy. We should refactor it to use the above
101 // more general member function. 102 // more general member function.
102 virtual void ReadData( 103 virtual void ReadData(
103 const std::string& extension_id, 104 const std::string& extension_id,
104 const int day, 105 const int day,
105 const base::Callback 106 const base::Callback
106 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) 107 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback)
107 const {} 108 const {}
108 109
110 // Clean the relevant URL data. The cleaning may be different for different
111 // policies. An empty vector signifies all URLs should be cleaned up.
112 virtual void RemoveURLs(const std::vector<GURL>& gurls) = 0;
mvrable 2013/07/17 16:41:23 You could simplify the code by just providing a si
karenlees 2013/08/08 23:36:37 Done.
113 virtual void RemoveURL(const GURL& gurl) = 0;
114
109 virtual std::string GetKey(KeyType key_id) const; 115 virtual std::string GetKey(KeyType key_id) const;
110 116
111 protected: 117 protected:
112 // An ActivityLogPolicy is not directly destroyed. Instead, call Close() 118 // An ActivityLogPolicy is not directly destroyed. Instead, call Close()
113 // which will cause the object to be deleted when it is safe. 119 // which will cause the object to be deleted when it is safe.
114 virtual ~ActivityLogPolicy(); 120 virtual ~ActivityLogPolicy();
115 121
116 // The Schedule methods dispatch the calls to the database on a 122 // The Schedule methods dispatch the calls to the database on a
117 // separate thread. We dispatch to the UI thread if the DB thread doesn't 123 // separate thread. We dispatch to the UI thread if the DB thread doesn't
118 // exist, which should only happen in tests where there is no DB thread. 124 // exist, which should only happen in tests where there is no DB thread.
(...skipping 24 matching lines...) Expand all
143 149
144 base::FilePath profile_base_path_; 150 base::FilePath profile_base_path_;
145 151
146 private: 152 private:
147 DISALLOW_COPY_AND_ASSIGN(ActivityLogPolicy); 153 DISALLOW_COPY_AND_ASSIGN(ActivityLogPolicy);
148 }; 154 };
149 155
150 } // namespace extensions 156 } // namespace extensions
151 157
152 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_ 158 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698