| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Add/remove observer: the activityLogPrivate API only listens when the | 57 // Add/remove observer: the activityLogPrivate API only listens when the |
| 58 // ActivityLog extension is registered for an event. | 58 // ActivityLog extension is registered for an event. |
| 59 void AddObserver(Observer* observer); | 59 void AddObserver(Observer* observer); |
| 60 void RemoveObserver(Observer* observer); | 60 void RemoveObserver(Observer* observer); |
| 61 | 61 |
| 62 // Logs an extension action: passes it to any installed policy to be logged | 62 // Logs an extension action: passes it to any installed policy to be logged |
| 63 // to the database, to any observers, and logs to the console if in testing | 63 // to the database, to any observers, and logs to the console if in testing |
| 64 // mode. | 64 // mode. |
| 65 void LogAction(scoped_refptr<Action> action); | 65 void LogAction(scoped_refptr<Action> action); |
| 66 | 66 |
| 67 // Retrieves the list of actions for a given extension on a specific day. | |
| 68 // Today is 0, yesterday is 1, etc. Returns one day at a time. | |
| 69 // Response is sent to the method/function in the callback. | |
| 70 // Use base::Bind to create the callback. | |
| 71 void GetActions(const std::string& extension_id, | |
| 72 const int day, | |
| 73 const base::Callback | |
| 74 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& | |
| 75 callback); | |
| 76 | |
| 77 // Gets all actions that match the specified fields. URLs are treated like | 67 // Gets all actions that match the specified fields. URLs are treated like |
| 78 // prefixes; other fields are exact matches. Empty strings are not matched to | 68 // prefixes; other fields are exact matches. Empty strings are not matched to |
| 79 // anything. | 69 // anything. For daysAgo, today is 0, yesterday is 1, etc.; a negative number |
| 70 // of days is treated as a missing parameter. |
| 80 void GetFilteredActions( | 71 void GetFilteredActions( |
| 81 const std::string& extension_id, | 72 const std::string& extension_id, |
| 82 const Action::ActionType type, | 73 const Action::ActionType type, |
| 83 const std::string& api_name, | 74 const std::string& api_name, |
| 84 const std::string& page_url, | 75 const std::string& page_url, |
| 85 const std::string& arg_url, | 76 const std::string& arg_url, |
| 77 const int days_ago, |
| 86 const base::Callback | 78 const base::Callback |
| 87 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback); | 79 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback); |
| 88 | 80 |
| 89 // Extension::InstallObserver | 81 // Extension::InstallObserver |
| 90 // We keep track of whether the whitelisted extension is installed; if it is, | 82 // We keep track of whether the whitelisted extension is installed; if it is, |
| 91 // we want to recompute whether to have logging enabled. | 83 // we want to recompute whether to have logging enabled. |
| 92 virtual void OnExtensionInstalled(const Extension* extension) OVERRIDE {} | 84 virtual void OnExtensionInstalled(const Extension* extension) OVERRIDE {} |
| 93 virtual void OnExtensionLoaded(const Extension* extension) OVERRIDE; | 85 virtual void OnExtensionLoaded(const Extension* extension) OVERRIDE; |
| 94 virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE; | 86 virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE; |
| 95 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE; | 87 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 virtual content::BrowserContext* GetBrowserContextToUse( | 219 virtual content::BrowserContext* GetBrowserContextToUse( |
| 228 content::BrowserContext* context) const OVERRIDE; | 220 content::BrowserContext* context) const OVERRIDE; |
| 229 | 221 |
| 230 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); | 222 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); |
| 231 }; | 223 }; |
| 232 | 224 |
| 233 | 225 |
| 234 } // namespace extensions | 226 } // namespace extensions |
| 235 | 227 |
| 236 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 228 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
| OLD | NEW |