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

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: 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/string.h"
10 #include "base/string16.h"
11 #include "base/time.h"
12 #include "chrome/browser/extensions/activity_actions.h"
13 #include "googleurl/src/gurl.h"
14
15 namespace activity {
16
17 static const std::string url_table_name_ = "activitylog-urls";
mvrable 2012/12/04 01:00:13 "Static or global variables of class type are forb
mvrable 2012/12/04 01:00:13 The static keyword has several overloaded meanings
felt 2012/12/07 19:27:45 Done.
18 static const std::string url_table_creator_ = "CREATE TABLE (" +
mvrable 2012/12/04 01:00:13 For the reasons above, constructing this string dy
19 url_table_name_ + "("
20 "id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,"
21 "extension_id LONGVARCHAR NOT NULL,"
22 "time INTEGER NOT NULL,"
23 "url_action_type LONGVARCHAR NOT NULL,"
24 "url LONGVARCHAR NOT NULL,"
25 "url_title LONGVARCHAR,"
26 "api_call LONGVARCHAR NOT NULL)";
27
28 // This class describes extension actions that pertain to Content Script
29 // insertion, Content Script DOM manipulations, and extension XHRs.
30 class UrlAction : Action {
31 public:
32 enum UrlActionType {
33 MODIFIED, // For Content Script DOM manipulations
34 READ, // For Content Script DOM manipulations
35 INSERTED, // For when Content Scripts are added to pages
36 XHR, // When an extension core sends an XHR
37 UNKNOWN, // Something is wrong; this value shouldn't be used
38 };
39
40 // Create a new UrlAction to describe a ContentScript action
41 // or XHR. All of the parameters should have values except for
42 // url_title, which can be an empty string if the ActionType is XHR.
43 UrlAction(const std::string& extension_id,
44 const UrlActionType& verb,
45 const GURL& url,
46 const string16& url_title,
47 const std::string& api_call,
48 const base::Time& time);
49 virtual ~UrlAction();
50
51 // Print a UrlAction with il8n substitutions for display.
52 std::string PrettyPrintForil8n();
53
54 // Print a UrlAction as a regular string for debugging purposes.
55 std::string PrettyPrintForDebug();
56
57 // Helper methods for recording the values into the db.
58 const std::string& extension_id() const { return extension_id_; }
59 base::Time time() const { return time_; }
60 std::string VerbAsString();
61 const GURL& url() const { return url_; }
62 const string16& url_title() { return url_title_; }
63 const std::string& api_call() { return api_call_; }
64
65 // Helper methods for restoring a UrlAction from the db.
66 static UrlActionType StringAsUrlActionType(const std::string& str);
67
68 private:
69 std::string extension_id_;
70 UrlActionType verb_;
71 GURL url_;
72 string16 url_title_;
73 std::string api_call_;
74 base::Time time_;
75 };
76 }
77
78 #endif // CHROME_BROWSER_EXTENSIONS_URL_ACTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698