| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Add/remove observer: the activityLogPrivate API only listens when the | 63 // Add/remove observer: the activityLogPrivate API only listens when the |
| 64 // ActivityLog extension is registered for an event. | 64 // ActivityLog extension is registered for an event. |
| 65 void AddObserver(Observer* observer); | 65 void AddObserver(Observer* observer); |
| 66 void RemoveObserver(Observer* observer); | 66 void RemoveObserver(Observer* observer); |
| 67 | 67 |
| 68 // Log a successful API call made by an extension. | 68 // Log a successful API call made by an extension. |
| 69 // This will create an APIAction for storage in the database. | 69 // This will create an APIAction for storage in the database. |
| 70 // (Note: implemented as a wrapper for LogAPIActionInternal.) | 70 // (Note: implemented as a wrapper for LogAPIActionInternal.) |
| 71 void LogAPIAction(const std::string& extension_id, | 71 void LogAPIAction(const std::string& extension_id, |
| 72 const std::string& name, // e.g., tabs.get | 72 const std::string& name, // e.g., tabs.get |
| 73 ListValue* args, // the argument values e.g. 46 | 73 base::ListValue* args, // the argument values e.g. 46 |
| 74 const std::string& extra); // any extra logging info | 74 const std::string& extra); // any extra logging info |
| 75 | 75 |
| 76 // Log an event notification delivered to an extension. | 76 // Log an event notification delivered to an extension. |
| 77 // This will create an APIAction for storage in the database. | 77 // This will create an APIAction for storage in the database. |
| 78 // (Note: implemented as a wrapper for LogAPIActionInternal.) | 78 // (Note: implemented as a wrapper for LogAPIActionInternal.) |
| 79 void LogEventAction(const std::string& extension_id, | 79 void LogEventAction(const std::string& extension_id, |
| 80 const std::string& name, // e.g., tabs.onUpdate | 80 const std::string& name, // e.g., tabs.onUpdate |
| 81 ListValue* args, // arguments to the callback | 81 base::ListValue* args, // arguments to the callback |
| 82 const std::string& extra); // any extra logging info | 82 const std::string& extra); // any extra logging info |
| 83 | 83 |
| 84 // Log a blocked API call made by an extension. | 84 // Log a blocked API call made by an extension. |
| 85 // This will create a BlockedAction for storage in the database. | 85 // This will create a BlockedAction for storage in the database. |
| 86 void LogBlockedAction(const std::string& extension_id, | 86 void LogBlockedAction(const std::string& extension_id, |
| 87 const std::string& blocked_call, // e.g., tabs.get | 87 const std::string& blocked_call, // e.g., tabs.get |
| 88 ListValue* args, // argument values | 88 base::ListValue* args, // argument values |
| 89 BlockedAction::Reason reason, // why it's blocked | 89 BlockedAction::Reason reason, // why it's blocked |
| 90 const std::string& extra); // extra logging info | 90 const std::string& extra); // extra logging info |
| 91 | 91 |
| 92 // Log an interaction between an extension and a URL. | 92 // Log an interaction between an extension and a URL. |
| 93 // This will create a DOMAction for storage in the database. | 93 // This will create a DOMAction for storage in the database. |
| 94 void LogDOMAction(const std::string& extension_id, | 94 void LogDOMAction(const std::string& extension_id, |
| 95 const GURL& url, // target URL | 95 const GURL& url, // target URL |
| 96 const string16& url_title, // title of the URL | 96 const string16& url_title, // title of the URL |
| 97 const std::string& api_call, // api call | 97 const std::string& api_call, // api call |
| 98 const ListValue* args, // arguments | 98 const base::ListValue* args, // arguments |
| 99 DomActionType::Type call_type, // type of the call | 99 DomActionType::Type call_type, // type of the call |
| 100 const std::string& extra); // extra logging info | 100 const std::string& extra); // extra logging info |
| 101 | 101 |
| 102 // Log a use of the WebRequest API to redirect, cancel, or modify page | 102 // Log a use of the WebRequest API to redirect, cancel, or modify page |
| 103 // headers. | 103 // headers. |
| 104 void LogWebRequestAction(const std::string& extension_id, | 104 void LogWebRequestAction(const std::string& extension_id, |
| 105 const GURL& url, | 105 const GURL& url, |
| 106 const std::string& api_call, | 106 const std::string& api_call, |
| 107 scoped_ptr<base::DictionaryValue> details, | 107 scoped_ptr<base::DictionaryValue> details, |
| 108 const std::string& extra); | 108 const std::string& extra); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 friend class ActivityLogFactory; | 161 friend class ActivityLogFactory; |
| 162 | 162 |
| 163 explicit ActivityLog(Profile* profile); | 163 explicit ActivityLog(Profile* profile); |
| 164 virtual ~ActivityLog(); | 164 virtual ~ActivityLog(); |
| 165 | 165 |
| 166 // We log callbacks and API calls very similarly, so we handle them the same | 166 // We log callbacks and API calls very similarly, so we handle them the same |
| 167 // way internally. | 167 // way internally. |
| 168 void LogAPIActionInternal( | 168 void LogAPIActionInternal( |
| 169 const std::string& extension_id, | 169 const std::string& extension_id, |
| 170 const std::string& api_call, | 170 const std::string& api_call, |
| 171 ListValue* args, | 171 base::ListValue* args, |
| 172 const std::string& extra, | 172 const std::string& extra, |
| 173 const APIAction::Type type); | 173 const APIAction::Type type); |
| 174 | 174 |
| 175 // TabHelper::ScriptExecutionObserver implementation. | 175 // TabHelper::ScriptExecutionObserver implementation. |
| 176 // Fires when a ContentScript is executed. | 176 // Fires when a ContentScript is executed. |
| 177 virtual void OnScriptsExecuted( | 177 virtual void OnScriptsExecuted( |
| 178 const content::WebContents* web_contents, | 178 const content::WebContents* web_contents, |
| 179 const ExecutingScriptsMap& extension_ids, | 179 const ExecutingScriptsMap& extension_ids, |
| 180 int32 page_id, | 180 int32 page_id, |
| 181 const GURL& on_url) OVERRIDE; | 181 const GURL& on_url) OVERRIDE; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 virtual content::BrowserContext* GetBrowserContextToUse( | 232 virtual content::BrowserContext* GetBrowserContextToUse( |
| 233 content::BrowserContext* context) const OVERRIDE; | 233 content::BrowserContext* context) const OVERRIDE; |
| 234 | 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); | 235 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 | 238 |
| 239 } // namespace extensions | 239 } // namespace extensions |
| 240 | 240 |
| 241 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 241 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
| OLD | NEW |