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

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: 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_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/blocked_actions.h"
12 #include "chrome/browser/extensions/manager_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 // Opens the DB and creates tables as necessary.
29 sql::InitStatus Init(const FilePath& db_name,
30 sql::ErrorDelegate* error_delegate);
31
32 // Record a UrlAction in the database.
33 void RecordUrlAction(scoped_refptr<UrlAction> action);
34
35 // Record a ManagerAction in the database.
36 void RecordManagerAction(scoped_refptr<ManagerAction> action);
37
38 // Record a BlockedAction in the database.
39 void RecordBlockedAction(scoped_refptr<BlockedAction> action);
40
41 void KillDatabase();
42
43 bool initialized() const { return initialized_; }
44
45 // Standard db operation wrappers.
46 void BeginTransaction();
47 void CommitTransaction();
48 void RollbackTransaction();
49 bool Raze();
50 void Close();
51
52 private:
53 friend class base::RefCountedThreadSafe<ActivityDatabase>;
54
55 sql::Connection db_;
56 bool initialized_;
57
58 ~ActivityDatabase();
59
60 // Report a failure in INIT.
61 sql::InitStatus MarkInitFailure();
Eric Dingle 2012/12/13 20:37:34 From the style guide, order of declarations: Type
felt 2012/12/15 02:51:52 Done.
62
63 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase);
64 };
65
66 } // namespace
67 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_
68
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698