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_FULLSTREAM_UI_POLICY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/activity_log/activity_database.h" | 10 #include "chrome/browser/extensions/activity_log/activity_database.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // including some data that could be privacy sensitive (full URLs including | 21 // including some data that could be privacy sensitive (full URLs including |
22 // incognito URLs, full headers when WebRequest is used, etc.). It should not | 22 // incognito URLs, full headers when WebRequest is used, etc.). It should not |
23 // be used during normal browsing if users care about privacy. | 23 // be used during normal browsing if users care about privacy. |
24 class FullStreamUIPolicy : public ActivityLogDatabasePolicy { | 24 class FullStreamUIPolicy : public ActivityLogDatabasePolicy { |
25 public: | 25 public: |
26 // For more info about these member functions, see the super class. | 26 // For more info about these member functions, see the super class. |
27 explicit FullStreamUIPolicy(Profile* profile); | 27 explicit FullStreamUIPolicy(Profile* profile); |
28 | 28 |
29 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; | 29 virtual void ProcessAction(scoped_refptr<Action> action) OVERRIDE; |
30 | 30 |
31 // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy. | |
32 // It assumes that the callback can return a sorted vector of actions. Some | |
33 // policies might not do that. For instance, imagine a trivial policy that | |
34 // just counts the frequency of certain actions within some time period, | |
35 // this call would be meaningless, as it couldn't return anything useful. | |
36 virtual void ReadData( | |
37 const std::string& extension_id, | |
38 const int day, | |
39 const base::Callback | |
40 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; | |
41 | |
42 virtual void ReadFilteredData( | 31 virtual void ReadFilteredData( |
43 const std::string& extension_id, | 32 const std::string& extension_id, |
44 const Action::ActionType type, | 33 const Action::ActionType type, |
45 const std::string& api_name, | 34 const std::string& api_name, |
46 const std::string& page_url, | 35 const std::string& page_url, |
47 const std::string& arg_url, | 36 const std::string& arg_url, |
| 37 const int days_ago, |
48 const base::Callback | 38 const base::Callback |
49 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; | 39 <void(scoped_ptr<Action::ActionVector>)>& callback) OVERRIDE; |
50 | 40 |
51 virtual void Close() OVERRIDE; | 41 virtual void Close() OVERRIDE; |
52 | 42 |
53 // Clean the URL data stored for this policy. | 43 // Clean the URL data stored for this policy. |
54 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) OVERRIDE; | 44 virtual void RemoveURLs(const std::vector<GURL>& restrict_urls) OVERRIDE; |
55 | 45 |
56 // Delete everything in the database. | 46 // Delete everything in the database. |
57 virtual void DeleteDatabase() OVERRIDE; | 47 virtual void DeleteDatabase() OVERRIDE; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 80 |
91 // Tracks any pending updates to be written to the database, if write | 81 // Tracks any pending updates to be written to the database, if write |
92 // batching is turned on. Should only be accessed from the database thread. | 82 // batching is turned on. Should only be accessed from the database thread. |
93 Action::ActionVector queued_actions_; | 83 Action::ActionVector queued_actions_; |
94 | 84 |
95 private: | 85 private: |
96 // Adds an Action to queued_actions_; this should be invoked only on the | 86 // Adds an Action to queued_actions_; this should be invoked only on the |
97 // database thread. | 87 // database thread. |
98 void QueueAction(scoped_refptr<Action> action); | 88 void QueueAction(scoped_refptr<Action> action); |
99 | 89 |
100 // The implementation of ReadData; this must only run on the database thread. | |
101 scoped_ptr<Action::ActionVector> DoReadData(const std::string& extension_id, | |
102 const int days_ago); | |
103 | |
104 // 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 |
105 // thread. | 91 // thread. |
106 scoped_ptr<Action::ActionVector> DoReadFilteredData( | 92 scoped_ptr<Action::ActionVector> DoReadFilteredData( |
107 const std::string& extension_id, | 93 const std::string& extension_id, |
108 const Action::ActionType type, | 94 const Action::ActionType type, |
109 const std::string& api_name, | 95 const std::string& api_name, |
110 const std::string& page_url, | 96 const std::string& page_url, |
111 const std::string& arg_url); | 97 const std::string& arg_url, |
| 98 const int days_ago); |
112 }; | 99 }; |
113 | 100 |
114 } // namespace extensions | 101 } // namespace extensions |
115 | 102 |
116 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | 103 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ |
OLD | NEW |