| 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_LOG_ACTIVITY_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_DATABASE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_DATABASE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 bool is_db_valid() const { return valid_db_; } | 127 bool is_db_valid() const { return valid_db_; } |
| 128 | 128 |
| 129 // A helper method for initializing or upgrading a database table. The | 129 // A helper method for initializing or upgrading a database table. The |
| 130 // content_fields array should list the names of all of the columns in the | 130 // content_fields array should list the names of all of the columns in the |
| 131 // database. The field_types should specify the types of the corresponding | 131 // database. The field_types should specify the types of the corresponding |
| 132 // columns (e.g., INTEGER or LONGVARCHAR). There should be the same number of | 132 // columns (e.g., INTEGER or LONGVARCHAR). There should be the same number of |
| 133 // field_types as content_fields, since the two arrays should correspond. | 133 // field_types as content_fields, since the two arrays should correspond. |
| 134 static bool InitializeTable(sql::Connection* db, | 134 static bool InitializeTable(sql::Connection* db, |
| 135 const char* table_name, | 135 const char* table_name, |
| 136 const char* content_fields[], | 136 const char* const content_fields[], |
| 137 const char* field_types[], | 137 const char* const field_types[], |
| 138 const int num_content_fields); | 138 const int num_content_fields); |
| 139 | 139 |
| 140 // Runs the given callback, passing it a handle to the database connection. | 140 // Runs the given callback, passing it a handle to the database connection. |
| 141 // If the database is not valid, the callback is run (to allow it to do any | 141 // If the database is not valid, the callback is run (to allow it to do any |
| 142 // needed cleanup) but passed a NULL value. | 142 // needed cleanup) but passed a NULL value. |
| 143 void RunOnDatabase(const base::Callback<void(sql::Connection*)>& callback); | 143 void RunOnDatabase(const base::Callback<void(sql::Connection*)>& callback); |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 // This should never be invoked by another class. Use Close() to order a | 146 // This should never be invoked by another class. Use Close() to order a |
| 147 // suicide. | 147 // suicide. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 friend class ActivityLogDatabasePolicy; | 196 friend class ActivityLogDatabasePolicy; |
| 197 FRIEND_TEST_ALL_PREFIXES(ActivityDatabaseTest, BatchModeOff); | 197 FRIEND_TEST_ALL_PREFIXES(ActivityDatabaseTest, BatchModeOff); |
| 198 FRIEND_TEST_ALL_PREFIXES(ActivityDatabaseTest, BatchModeOn); | 198 FRIEND_TEST_ALL_PREFIXES(ActivityDatabaseTest, BatchModeOn); |
| 199 FRIEND_TEST_ALL_PREFIXES(ActivityDatabaseTest, BatchModeFlush); | 199 FRIEND_TEST_ALL_PREFIXES(ActivityDatabaseTest, BatchModeFlush); |
| 200 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); | 200 DISALLOW_COPY_AND_ASSIGN(ActivityDatabase); |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 } // namespace extensions | 203 } // namespace extensions |
| 204 | 204 |
| 205 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_DATABASE_H_ | 205 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_DATABASE_H_ |
| OLD | NEW |