| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Log a blocked API call made by an extension. | 93 // Log a blocked API call made by an extension. |
| 94 // This will create a BlockedAction for storage in the database. | 94 // This will create a BlockedAction for storage in the database. |
| 95 void LogBlockedAction(const Extension* extension, | 95 void LogBlockedAction(const Extension* extension, |
| 96 const std::string& blocked_call, // e.g., tabs.get | 96 const std::string& blocked_call, // e.g., tabs.get |
| 97 ListValue* args, // argument values | 97 ListValue* args, // argument values |
| 98 const BlockedAction::Reason reason, // why it's blocked | 98 const BlockedAction::Reason reason, // why it's blocked |
| 99 const std::string& extra); // extra logging info | 99 const std::string& extra); // extra logging info |
| 100 | 100 |
| 101 // Log an interaction between an extension and a URL. | 101 // Log an interaction between an extension and a URL. |
| 102 // This will create a DOMAction for storage in the database. | 102 // This will create a DOMAction for storage in the database. |
| 103 // The technical message might be the list of content scripts that have been | |
| 104 // injected, or the DOM API call; it's what's shown under "More". | |
| 105 void LogDOMAction(const Extension* extension, | 103 void LogDOMAction(const Extension* extension, |
| 106 const GURL& url, // target URL | 104 const GURL& url, // target URL |
| 107 const string16& url_title, // title of the URL | 105 const string16& url_title, // title of the URL |
| 108 const std::string& api_call, // api call | 106 const std::string& api_call, // api call |
| 109 const ListValue* args, // arguments | 107 const ListValue* args, // arguments |
| 108 DOMAction::DOMActionType verb, // type of the call |
| 110 const std::string& extra); // extra logging info | 109 const std::string& extra); // extra logging info |
| 111 | 110 |
| 112 // Log a use of the WebRequest API to redirect, cancel, or modify page | 111 // Log a use of the WebRequest API to redirect, cancel, or modify page |
| 113 // headers. | 112 // headers. |
| 114 void LogWebRequestAction(const Extension* extension, | 113 void LogWebRequestAction(const Extension* extension, |
| 115 const GURL& url, | 114 const GURL& url, |
| 116 const std::string& api_call, | 115 const std::string& api_call, |
| 117 scoped_ptr<base::DictionaryValue> details, | 116 scoped_ptr<base::DictionaryValue> details, |
| 118 const std::string& extra); | 117 const std::string& extra); |
| 119 | 118 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 142 | 141 |
| 143 // We log callbacks and API calls very similarly, so we handle them the same | 142 // We log callbacks and API calls very similarly, so we handle them the same |
| 144 // way internally. | 143 // way internally. |
| 145 void LogAPIActionInternal( | 144 void LogAPIActionInternal( |
| 146 const Extension* extension, | 145 const Extension* extension, |
| 147 const std::string& api_call, | 146 const std::string& api_call, |
| 148 ListValue* args, | 147 ListValue* args, |
| 149 const std::string& extra, | 148 const std::string& extra, |
| 150 const APIAction::Type type); | 149 const APIAction::Type type); |
| 151 | 150 |
| 152 // We log content script injection and DOM API calls using the same underlying | |
| 153 // mechanism, so they have the same internal logging structure. | |
| 154 void LogDOMActionInternal(const Extension* extension, | |
| 155 const GURL& url, | |
| 156 const string16& url_title, | |
| 157 const std::string& api_call, | |
| 158 const ListValue* args, | |
| 159 const std::string& extra, | |
| 160 DOMAction::DOMActionType verb); | |
| 161 | |
| 162 // TabHelper::ScriptExecutionObserver implementation. | 151 // TabHelper::ScriptExecutionObserver implementation. |
| 163 // Fires when a ContentScript is executed. | 152 // Fires when a ContentScript is executed. |
| 164 virtual void OnScriptsExecuted( | 153 virtual void OnScriptsExecuted( |
| 165 const content::WebContents* web_contents, | 154 const content::WebContents* web_contents, |
| 166 const ExecutingScriptsMap& extension_ids, | 155 const ExecutingScriptsMap& extension_ids, |
| 167 int32 page_id, | 156 int32 page_id, |
| 168 const GURL& on_url) OVERRIDE; | 157 const GURL& on_url) OVERRIDE; |
| 169 | 158 |
| 170 // The callback when initializing the database. | 159 // The callback when initializing the database. |
| 171 void OnDBInitComplete(); | 160 void OnDBInitComplete(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 virtual content::BrowserContext* GetBrowserContextToUse( | 242 virtual content::BrowserContext* GetBrowserContextToUse( |
| 254 content::BrowserContext* context) const OVERRIDE; | 243 content::BrowserContext* context) const OVERRIDE; |
| 255 | 244 |
| 256 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); | 245 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); |
| 257 }; | 246 }; |
| 258 | 247 |
| 259 | 248 |
| 260 } // namespace extensions | 249 } // namespace extensions |
| 261 | 250 |
| 262 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 251 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
| OLD | NEW |