| 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" |
| 11 #include "chrome/browser/extensions/api_actions.h" | 11 #include "chrome/browser/extensions/api_actions.h" |
| 12 #include "chrome/browser/extensions/blocked_actions.h" | 12 #include "chrome/browser/extensions/blocked_actions.h" |
| 13 #include "chrome/browser/extensions/url_actions.h" | 13 #include "chrome/browser/extensions/dom_actions.h" |
| 14 #include "sql/connection.h" | 14 #include "sql/connection.h" |
| 15 #include "sql/init_status.h" | 15 #include "sql/init_status.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class FilePath; | 18 class FilePath; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 | 22 |
| 23 // Encapsulates the SQL connection for the activity log database. | 23 // Encapsulates the SQL connection for the activity log database. |
| 24 // This class holds the database connection and has methods for writing. | 24 // This class holds the database connection and has methods for writing. |
| 25 class ActivityDatabase : public base::RefCountedThreadSafe<ActivityDatabase> { | 25 class ActivityDatabase : public base::RefCountedThreadSafe<ActivityDatabase> { |
| 26 public: | 26 public: |
| 27 // Need to call Init to actually use the ActivityDatabase. | 27 // Need to call Init to actually use the ActivityDatabase. |
| 28 ActivityDatabase(); | 28 ActivityDatabase(); |
| 29 | 29 |
| 30 // Sets up an optional error delegate. | 30 // Sets up an optional error delegate. |
| 31 // Should be the only thing done before Init. | 31 // Should be the only thing done before Init. |
| 32 void SetErrorDelegate(sql::ErrorDelegate* error_delegate); | 32 void SetErrorDelegate(sql::ErrorDelegate* error_delegate); |
| 33 | 33 |
| 34 // Opens the DB and creates tables as necessary. | 34 // Opens the DB and creates tables as necessary. |
| 35 void Init(const base::FilePath& db_name); | 35 void Init(const base::FilePath& db_name); |
| 36 void LogInitFailure(); | 36 void LogInitFailure(); |
| 37 | 37 |
| 38 // Record a UrlAction in the database. | 38 // Record a DOMction in the database. |
| 39 void RecordUrlAction(scoped_refptr<UrlAction> action); | 39 void RecordDOMAction(scoped_refptr<DOMAction> action); |
| 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 70 const char* table_structure); | 70 const char* table_structure); |
| 71 | 71 |
| 72 sql::Connection db_; | 72 sql::Connection db_; |
| 73 bool initialized_; | 73 bool initialized_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); | 75 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace extensions | 78 } // namespace extensions |
| 79 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ | 79 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_DATABASE_H_ |
| OLD | NEW |