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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Record a APIAction in the database. | 41 // Record a APIAction in the database. |
42 void RecordAPIAction(scoped_refptr<APIAction> action); | 42 void RecordAPIAction(scoped_refptr<APIAction> action); |
43 | 43 |
44 // Record a BlockedAction in the database. | 44 // Record a BlockedAction in the database. |
45 void RecordBlockedAction(scoped_refptr<BlockedAction> action); | 45 void RecordBlockedAction(scoped_refptr<BlockedAction> action); |
46 | 46 |
47 // Record an Action in the database. | 47 // Record an Action in the database. |
48 void RecordAction(scoped_refptr<Action> action); | 48 void RecordAction(scoped_refptr<Action> action); |
49 | 49 |
| 50 // Break any outstanding transactions, raze the database, and close |
| 51 // it. Future calls on the current database handle will fail, when |
| 52 // next opened the database will be empty. |
50 void KillDatabase(); | 53 void KillDatabase(); |
51 | 54 |
52 bool initialized() const { return initialized_; } | 55 bool initialized() const { return initialized_; } |
53 | 56 |
54 // Standard db operation wrappers. | 57 // Standard db operation wrappers. |
55 void BeginTransaction(); | 58 void BeginTransaction(); |
56 void CommitTransaction(); | 59 void CommitTransaction(); |
57 void RollbackTransaction(); | 60 void RollbackTransaction(); |
58 bool Raze(); | 61 bool Raze(); |
59 void Close(); | 62 void Close(); |
60 | 63 |
61 private: | 64 private: |
62 friend class base::RefCountedThreadSafe<ActivityDatabase>; | 65 friend class base::RefCountedThreadSafe<ActivityDatabase>; |
63 | 66 |
64 virtual ~ActivityDatabase(); | 67 virtual ~ActivityDatabase(); |
65 | 68 |
66 sql::InitStatus InitializeTable(const char* table_name, | 69 sql::InitStatus InitializeTable(const char* table_name, |
67 const char* table_structure); | 70 const char* table_structure); |
68 | 71 |
69 sql::Connection db_; | 72 sql::Connection db_; |
70 bool initialized_; | 73 bool initialized_; |
71 | 74 |
72 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); | 75 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); |
73 }; | 76 }; |
74 | 77 |
75 } // namespace extensions | 78 } // namespace extensions |
76 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ | 79 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ |
OLD | NEW |