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

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

Issue 12262025: Alter the ActivityLog db table schemas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_
7
8 #include <string>
9 #include "base/string16.h"
10 #include "base/time.h"
11 #include "chrome/browser/extensions/activity_actions.h"
12 #include "googleurl/src/gurl.h"
13
14 namespace extensions {
15
16 // This class describes extension actions that pertain to DOM API calls and
17 // content script insertions.
18 class DOMAction : public Action {
19 public:
20 enum DOMActionType {
21 MODIFIED, // For Content Script DOM manipulations
22 READ, // For Content Script DOM manipulations
23 INSERTED, // For when Content Scripts are added to pages
24 XHR, // When an extension core sends an XHR
25 };
26
27 static const char* kTableName;
28 static const char* kTableBasicFields;
29 static const char* kTableContentFields[];
30
31 // Create a new database table for storing DOMActions, or update the schema if
32 // it is out of date. Any existing data is preserved.
33 static bool InitializeTable(sql::Connection* db);
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,
40 const base::Time& time,
41 const DOMActionType verb, // what happened
42 const GURL& url, // the url of the page the
43 // script is running on
44 const string16& url_title, // the page title
45 const std::string& api_call, // the DOM API call
46 const std::string& args, // the args
47 const std::string& extra); // any extra logging info
48
49 // Record the action in the database.
50 virtual void Record(sql::Connection* db) OVERRIDE;
51
52 // Print a DOMAction with il8n substitutions for display.
53 virtual std::string PrettyPrintFori18n() OVERRIDE;
54
55 // Print a DOMAction as a regular string for debugging purposes.
56 virtual std::string PrettyPrintForDebug() OVERRIDE;
57
58 // Helper methods for retrieving the values.
59 const std::string& extension_id() const { return extension_id_; }
60 const base::Time& time() const { return time_; }
61 std::string VerbAsString() const;
62 const GURL& url() const { return url_; }
63 const string16& url_title() const { return url_title_; }
64 const std::string& api_call() const { return api_call_; }
65 const std::string& args() const { return args_; }
66 const std::string& extra() const { return extra_; }
67
68 // Helper methods for restoring a DOMAction from the db.
69 static DOMActionType StringAsDOMActionType(const std::string& str);
70
71 protected:
72 virtual ~DOMAction();
73
74 private:
75 std::string extension_id_;
76 base::Time time_;
77 DOMActionType verb_;
78 GURL url_;
79 string16 url_title_;
80 std::string api_call_;
81 std::string args_;
82 std::string extra_;
83
84 DISALLOW_COPY_AND_ASSIGN(DOMAction);
85 };
86
87 } // namespace extensions
88
89 #endif // CHROME_BROWSER_EXTENSIONS_DOM_ACTIONS_H_
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