Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/extensions/dom_actions.h

Issue 12207060: Alter the ActivityLog db table schemas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: trying the upload again Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/blocked_actions.cc ('k') | chrome/browser/extensions/dom_actions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_URL_ACTIONS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "chrome/browser/extensions/activity_actions.h" 11 #include "chrome/browser/extensions/activity_actions.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 // This class describes extension actions that pertain to Content Script 16 // This class describes extension actions that pertain to DOM API calls and
17 // insertion, Content Script DOM manipulations, and extension XHRs. 17 // content script insertions.
18 class UrlAction : public Action { 18 class DOMAction : public Action {
19 public: 19 public:
20 enum UrlActionType { 20 enum DOMActionType {
21 MODIFIED, // For Content Script DOM manipulations 21 MODIFIED, // For Content Script DOM manipulations
22 READ, // For Content Script DOM manipulations 22 READ, // For Content Script DOM manipulations
23 INSERTED, // For when Content Scripts are added to pages 23 INSERTED, // For when Content Scripts are added to pages
24 XHR, // When an extension core sends an XHR 24 XHR, // When an extension core sends an XHR
25 }; 25 };
26 26
27 static const char* kTableName; 27 static const char* kTableName;
28 static const char* kTableStructure; 28 static const char* kTableBasicFields;
29 static const char* kTableContentFields[];
29 30
30 // Create a new UrlAction to describe a ContentScript action 31 // Create a new database table for storing DOMActions, or update the schema if
31 // or XHR. All of the parameters should have values except for 32 // it is out of date. Any existing data is preserved.
32 // url_title, which can be an empty string if the ActionType is XHR. 33 static bool InitializeTable(sql::Connection* db);
33 UrlAction(const std::string& extension_id, 34
35 // Create a new DOMAction to describe a new DOM API call.
36 // If the DOMAction is on a background page, the url & url_title may be null.
37 // If the DOMAction refers to a content script insertion, api_call may be null
38 // but args should be the name of the content script.
39 DOMAction(const std::string& extension_id,
34 const base::Time& time, 40 const base::Time& time,
35 const UrlActionType verb, // what happened 41 const DOMActionType verb, // what happened
36 const GURL& url, // the url of the page or XHR 42 const GURL& url, // the url of the page the
43 // script is running on
37 const string16& url_title, // the page title 44 const string16& url_title, // the page title
38 const std::string& tech_message, // what goes under "More" 45 const std::string& api_call, // the DOM API call
46 const std::string& args, // the args
39 const std::string& extra); // any extra logging info 47 const std::string& extra); // any extra logging info
40 48
41 // Record the action in the database. 49 // Record the action in the database.
42 virtual void Record(sql::Connection* db) OVERRIDE; 50 virtual void Record(sql::Connection* db) OVERRIDE;
43 51
44 // Print a UrlAction with il8n substitutions for display. 52 // Print a DOMAction with il8n substitutions for display.
45 virtual std::string PrettyPrintFori18n() OVERRIDE; 53 virtual std::string PrettyPrintFori18n() OVERRIDE;
46 54
47 // Print a UrlAction as a regular string for debugging purposes. 55 // Print a DOMAction as a regular string for debugging purposes.
48 virtual std::string PrettyPrintForDebug() OVERRIDE; 56 virtual std::string PrettyPrintForDebug() OVERRIDE;
49 57
50 // Helper methods for retrieving the values. 58 // Helper methods for retrieving the values.
51 const std::string& extension_id() const { return extension_id_; } 59 const std::string& extension_id() const { return extension_id_; }
52 const base::Time& time() const { return time_; } 60 const base::Time& time() const { return time_; }
53 std::string VerbAsString() const; 61 std::string VerbAsString() const;
54 const GURL& url() const { return url_; } 62 const GURL& url() const { return url_; }
55 const string16& url_title() const { return url_title_; } 63 const string16& url_title() const { return url_title_; }
56 const std::string& technical_message() const { return technical_message_; } 64 const std::string& api_call() const { return api_call_; }
65 const std::string& args() const { return args_; }
57 const std::string& extra() const { return extra_; } 66 const std::string& extra() const { return extra_; }
58 67
59 // Helper methods for restoring a UrlAction from the db. 68 // Helper methods for restoring a DOMAction from the db.
60 static UrlActionType StringAsUrlActionType(const std::string& str); 69 static DOMActionType StringAsDOMActionType(const std::string& str);
61 70
62 protected: 71 protected:
63 virtual ~UrlAction(); 72 virtual ~DOMAction();
64 73
65 private: 74 private:
66 std::string extension_id_; 75 std::string extension_id_;
67 base::Time time_; 76 base::Time time_;
68 UrlActionType verb_; 77 DOMActionType verb_;
69 GURL url_; 78 GURL url_;
70 string16 url_title_; 79 string16 url_title_;
71 std::string technical_message_; 80 std::string api_call_;
81 std::string args_;
72 std::string extra_; 82 std::string extra_;
73 83
74 DISALLOW_COPY_AND_ASSIGN(UrlAction); 84 DISALLOW_COPY_AND_ASSIGN(DOMAction);
75 }; 85 };
76 86
77 } // namespace extensions 87 } // namespace extensions
78 88
79 #endif // CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_ 89 #endif // CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_
80 90
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blocked_actions.cc ('k') | chrome/browser/extensions/dom_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698