OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // Record a APIAction in the database. | 39 // Record a APIAction in the database. |
40 void RecordAPIAction(scoped_refptr<APIAction> action); | 40 void RecordAPIAction(scoped_refptr<APIAction> action); |
41 | 41 |
42 // Record a BlockedAction in the database. | 42 // Record a BlockedAction in the database. |
43 void RecordBlockedAction(scoped_refptr<BlockedAction> action); | 43 void RecordBlockedAction(scoped_refptr<BlockedAction> action); |
44 | 44 |
45 // Record an Action in the database. | 45 // Record an Action in the database. |
46 void RecordAction(scoped_refptr<Action> action); | 46 void RecordAction(scoped_refptr<Action> action); |
47 | 47 |
| 48 // Break any outstanding transactions, raze the database, and close |
| 49 // it. Future calls on the current database handle will fail, when |
| 50 // next opened the database will be empty. |
48 void KillDatabase(); | 51 void KillDatabase(); |
49 | 52 |
50 bool initialized() const { return initialized_; } | 53 bool initialized() const { return initialized_; } |
51 | 54 |
52 // Standard db operation wrappers. | 55 // Standard db operation wrappers. |
53 void BeginTransaction(); | 56 void BeginTransaction(); |
54 void CommitTransaction(); | 57 void CommitTransaction(); |
55 void RollbackTransaction(); | 58 void RollbackTransaction(); |
56 bool Raze(); | 59 bool Raze(); |
57 void Close(); | 60 void Close(); |
58 | 61 |
59 private: | 62 private: |
60 friend class base::RefCountedThreadSafe<ActivityDatabase>; | 63 friend class base::RefCountedThreadSafe<ActivityDatabase>; |
61 | 64 |
62 virtual ~ActivityDatabase(); | 65 virtual ~ActivityDatabase(); |
63 | 66 |
64 sql::InitStatus InitializeTable(const char* table_name, | 67 sql::InitStatus InitializeTable(const char* table_name, |
65 const char* table_structure); | 68 const char* table_structure); |
66 | 69 |
67 sql::Connection db_; | 70 sql::Connection db_; |
68 bool initialized_; | 71 bool initialized_; |
69 | 72 |
70 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); | 73 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); |
71 }; | 74 }; |
72 | 75 |
73 } // namespace extensions | 76 } // namespace extensions |
74 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ | 77 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ |
75 | |
OLD | NEW |