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

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

Issue 11421192: Save extension activity log to a file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: tryserver bugfix Created 8 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // User 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_URL_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_URL_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 extern const char* url_table_name_;
17 extern const char* url_table_structure_;
18
19 // This class describes extension actions that pertain to Content Script
20 // insertion, Content Script DOM manipulations, and extension XHRs.
21 class UrlAction : public Action,
22 public base::RefCountedThreadSafe<UrlAction> {
23 public:
24 enum UrlActionType {
25 MODIFIED, // For Content Script DOM manipulations
26 READ, // For Content Script DOM manipulations
27 INSERTED, // For when Content Scripts are added to pages
28 XHR, // When an extension core sends an XHR
29 };
30
31 // Create a new UrlAction to describe a ContentScript action
32 // or XHR. All of the parameters should have values except for
33 // url_title, which can be an empty string if the ActionType is XHR.
34 UrlAction(const std::string& extension_id,
35 const UrlActionType verb,
36 const GURL& url,
37 const string16& url_title,
38 const std::string& ext_script,
39 const base::Time& time);
40
41 // Print a UrlAction with il8n substitutions for display.
42 virtual std::string PrettyPrintFori18n() OVERRIDE;
43
44 // Print a UrlAction as a regular string for debugging purposes.
45 virtual std::string PrettyPrintForDebug() OVERRIDE;
46
47 // Helper methods for recording the values into the db.
48 const std::string& extension_id() const { return extension_id_; }
49 const base::Time& time() const { return time_; }
50 std::string VerbAsString() const;
51 const GURL& url() const { return url_; }
52 const string16& url_title() const { return url_title_; }
53 const std::string& script() const { return script_; }
54
55 // Helper methods for restoring a UrlAction from the db.
56 static UrlActionType StringAsUrlActionType(const std::string& str);
57
58 protected:
59 virtual ~UrlAction();
60
61 private:
62 friend class base::RefCountedThreadSafe<UrlAction>;
63
64 std::string extension_id_;
65 UrlActionType verb_;
66 GURL url_;
67 string16 url_title_;
68 std::string script_;
69 base::Time time_;
70
71 DISALLOW_COPY_AND_ASSIGN(UrlAction);
72 };
73
74 } // namespace extensions
75
76 #endif // CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_
77
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698