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

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

Issue 11421192: Save extension activity log to a file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: something about lkgr Created 7 years, 11 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
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_ACTIVITY_DATABASE_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_
7
8 #include "base/basictypes.h"
9 #include "base/file_path.h"
10 #include "base/memory/ref_counted_memory.h"
11 #include "chrome/browser/extensions/api_actions.h"
12 #include "chrome/browser/extensions/blocked_actions.h"
13 #include "chrome/browser/extensions/url_actions.h"
14 #include "sql/connection.h"
15 #include "sql/init_status.h"
16
17 class FilePath;
18
19 namespace extensions {
20
21 // Encapsulates the SQL connection for the activity log database.
22 // This class holds the database connection and has methods for writing.
23 class ActivityDatabase : public base::RefCountedThreadSafe<ActivityDatabase> {
24 public:
25 // Need to call Init to actually use the ActivityDatabase.
26 ActivityDatabase();
27
28 // Sets up an optional error delegate.
29 // Should be the only thing done before Init.
30 void SetErrorDelegate(sql::ErrorDelegate* error_delegate);
31
32 // Opens the DB and creates tables as necessary.
33 void Init(const FilePath& db_name);
34 void LogInitFailure();
35
36 // Record a UrlAction in the database.
37 void RecordUrlAction(scoped_refptr<UrlAction> action);
38
39 // Record a APIAction in the database.
40 void RecordAPIAction(scoped_refptr<APIAction> action);
41
42 // Record a BlockedAction in the database.
43 void RecordBlockedAction(scoped_refptr<BlockedAction> action);
44
45 // Record an Action in the database.
46 void RecordAction(scoped_refptr<Action> action);
47
48 void KillDatabase();
49
50 bool initialized() const { return initialized_; }
51
52 // Standard db operation wrappers.
53 void BeginTransaction();
54 void CommitTransaction();
55 void RollbackTransaction();
56 bool Raze();
57 void Close();
58
59 private:
60 friend class base::RefCountedThreadSafe<ActivityDatabase>;
61
62 virtual ~ActivityDatabase();
63
64 sql::InitStatus InitializeTable(const char* table_name,
65 const char* table_structure);
66
67 sql::Connection db_;
68 bool initialized_;
69
70 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase);
71 };
72
73 } // namespace extensions
74 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_
75
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_actions.h ('k') | chrome/browser/extensions/activity_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698