Index: chrome/browser/extensions/dom_actions.h |
=================================================================== |
--- chrome/browser/extensions/dom_actions.h (revision 181016) |
+++ chrome/browser/extensions/dom_actions.h (working copy) |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_ |
-#define CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_ |
+#ifndef CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_ |
+#define CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_ |
#include <string> |
#include "base/string16.h" |
@@ -13,11 +13,11 @@ |
namespace extensions { |
-// This class describes extension actions that pertain to Content Script |
-// insertion, Content Script DOM manipulations, and extension XHRs. |
-class UrlAction : public Action { |
+// This class describes extension actions that pertain to DOM API calls and |
+// content script insertions. |
+class DOMAction : public Action { |
public: |
- enum UrlActionType { |
+ enum DOMActionType { |
MODIFIED, // For Content Script DOM manipulations |
READ, // For Content Script DOM manipulations |
INSERTED, // For when Content Scripts are added to pages |
@@ -25,26 +25,34 @@ |
}; |
static const char* kTableName; |
- static const char* kTableStructure; |
+ static const char* kTableBasicFields; |
+ static const char* kTableContentFields[]; |
- // Create a new UrlAction to describe a ContentScript action |
- // or XHR. All of the parameters should have values except for |
- // url_title, which can be an empty string if the ActionType is XHR. |
- UrlAction(const std::string& extension_id, |
+ // Create a new database table for storing DOMActions, or update the schema if |
+ // it is out of date. Any existing data is preserved. |
+ static bool InitializeTable(sql::Connection* db); |
+ |
+ // Create a new DOMAction to describe a new DOM API call. |
+ // If the DOMAction is on a background page, the url & url_title may be null. |
+ // If the DOMAction refers to a content script insertion, api_call may be null |
+ // but args should be the name of the content script. |
+ DOMAction(const std::string& extension_id, |
const base::Time& time, |
- const UrlActionType verb, // what happened |
- const GURL& url, // the url of the page or XHR |
+ const DOMActionType verb, // what happened |
+ const GURL& url, // the url of the page the |
+ // script is running on |
const string16& url_title, // the page title |
- const std::string& tech_message, // what goes under "More" |
+ const std::string& api_call, // the DOM API call |
+ const std::string& args, // the args |
const std::string& extra); // any extra logging info |
// Record the action in the database. |
virtual void Record(sql::Connection* db) OVERRIDE; |
- // Print a UrlAction with il8n substitutions for display. |
+ // Print a DOMAction with il8n substitutions for display. |
virtual std::string PrettyPrintFori18n() OVERRIDE; |
- // Print a UrlAction as a regular string for debugging purposes. |
+ // Print a DOMAction as a regular string for debugging purposes. |
virtual std::string PrettyPrintForDebug() OVERRIDE; |
// Helper methods for retrieving the values. |
@@ -53,28 +61,30 @@ |
std::string VerbAsString() const; |
const GURL& url() const { return url_; } |
const string16& url_title() const { return url_title_; } |
- const std::string& technical_message() const { return technical_message_; } |
+ const std::string& api_call() const { return api_call_; } |
+ const std::string& args() const { return args_; } |
const std::string& extra() const { return extra_; } |
- // Helper methods for restoring a UrlAction from the db. |
- static UrlActionType StringAsUrlActionType(const std::string& str); |
+ // Helper methods for restoring a DOMAction from the db. |
+ static DOMActionType StringAsDOMActionType(const std::string& str); |
protected: |
- virtual ~UrlAction(); |
+ virtual ~DOMAction(); |
private: |
std::string extension_id_; |
base::Time time_; |
- UrlActionType verb_; |
+ DOMActionType verb_; |
GURL url_; |
string16 url_title_; |
- std::string technical_message_; |
+ std::string api_call_; |
+ std::string args_; |
std::string extra_; |
- DISALLOW_COPY_AND_ASSIGN(UrlAction); |
+ DISALLOW_COPY_AND_ASSIGN(DOMAction); |
}; |
} // namespace extensions |
-#endif // CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_ |
+#endif // CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_ |