OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Add/remove observer: the activityLogPrivate API only listens when the | 67 // Add/remove observer: the activityLogPrivate API only listens when the |
68 // ActivityLog extension is registered for an event. | 68 // ActivityLog extension is registered for an event. |
69 void AddObserver(Observer* observer); | 69 void AddObserver(Observer* observer); |
70 void RemoveObserver(Observer* observer); | 70 void RemoveObserver(Observer* observer); |
71 | 71 |
72 // Logs an extension action: passes it to any installed policy to be logged | 72 // Logs an extension action: passes it to any installed policy to be logged |
73 // to the database, to any observers, and logs to the console if in testing | 73 // to the database, to any observers, and logs to the console if in testing |
74 // mode. | 74 // mode. |
75 void LogAction(scoped_refptr<Action> action); | 75 void LogAction(scoped_refptr<Action> action); |
76 | 76 |
77 // Retrieves the list of actions for a given extension on a specific day. | |
78 // Today is 0, yesterday is 1, etc. Returns one day at a time. | |
79 // Response is sent to the method/function in the callback. | |
80 // Use base::Bind to create the callback. | |
81 void GetActions(const std::string& extension_id, | |
82 const int day, | |
83 const base::Callback | |
84 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& | |
85 callback); | |
86 | |
87 // Gets all actions that match the specified fields. URLs are treated like | 77 // Gets all actions that match the specified fields. URLs are treated like |
88 // prefixes; other fields are exact matches. Empty strings are not matched to | 78 // prefixes; other fields are exact matches. Empty strings are not matched to |
89 // anything. | 79 // anything. For daysAgo, today is 0, yesterday is 1, etc.; a negative number |
| 80 // of days is treated as a missing parameter. |
90 void GetFilteredActions( | 81 void GetFilteredActions( |
91 const std::string& extension_id, | 82 const std::string& extension_id, |
92 const Action::ActionType type, | 83 const Action::ActionType type, |
93 const std::string& api_name, | 84 const std::string& api_name, |
94 const std::string& page_url, | 85 const std::string& page_url, |
95 const std::string& arg_url, | 86 const std::string& arg_url, |
| 87 const int days_ago, |
96 const base::Callback | 88 const base::Callback |
97 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback); | 89 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback); |
98 | 90 |
99 // Extension::InstallObserver | 91 // Extension::InstallObserver |
100 // We keep track of whether the whitelisted extension is installed; if it is, | 92 // We keep track of whether the whitelisted extension is installed; if it is, |
101 // we want to recompute whether to have logging enabled. | 93 // we want to recompute whether to have logging enabled. |
102 virtual void OnExtensionInstalled(const Extension* extension) OVERRIDE {} | 94 virtual void OnExtensionInstalled(const Extension* extension) OVERRIDE {} |
103 virtual void OnExtensionLoaded(const Extension* extension) OVERRIDE; | 95 virtual void OnExtensionLoaded(const Extension* extension) OVERRIDE; |
104 virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE; | 96 virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE; |
105 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE {} | 97 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE {} |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 virtual content::BrowserContext* GetBrowserContextToUse( | 209 virtual content::BrowserContext* GetBrowserContextToUse( |
218 content::BrowserContext* context) const OVERRIDE; | 210 content::BrowserContext* context) const OVERRIDE; |
219 | 211 |
220 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); | 212 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); |
221 }; | 213 }; |
222 | 214 |
223 | 215 |
224 } // namespace extensions | 216 } // namespace extensions |
225 | 217 |
226 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 218 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
OLD | NEW |