OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBDATA_WEB_DATABASE_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ |
6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "sql/connection.h" | 9 #include "base/logging.h" |
10 #include "sql/init_status.h" | 10 |
11 #include "sql/meta_table.h" | 11 namespace sql { |
| 12 class Connection; |
| 13 class MetaTable; |
| 14 } |
12 | 15 |
13 // An abstract base class representing a table within a WebDatabase. | 16 // An abstract base class representing a table within a WebDatabase. |
14 // Each table should subclass this, adding type-specific methods as needed. | 17 // Each table should subclass this, adding type-specific methods as needed. |
15 class WebDatabaseTable { | 18 class WebDatabaseTable { |
16 protected: | 19 protected: |
17 WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table) | 20 WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table); |
18 : db_(db), meta_table_(meta_table) {} | |
19 virtual ~WebDatabaseTable(); | 21 virtual ~WebDatabaseTable(); |
20 | 22 |
21 // Attempts to initialize the table and returns true if successful. | 23 // Attempts to initialize the table and returns true if successful. |
22 virtual bool Init() = 0; | 24 virtual bool Init() = 0; |
23 | 25 |
24 // In order to encourage developers to think about sync when adding or | 26 // In order to encourage developers to think about sync when adding or |
25 // or altering new tables, this method must be implemented. Please get in | 27 // or altering new tables, this method must be implemented. Please get in |
26 // contact with the sync team if you believe you're making a change that they | 28 // contact with the sync team if you believe you're making a change that they |
27 // should be aware of (or if you could break something). | 29 // should be aware of (or if you could break something). |
28 // TODO(andybons): Implement something more robust. | 30 // TODO(andybons): Implement something more robust. |
29 virtual bool IsSyncable() = 0; | 31 virtual bool IsSyncable() = 0; |
30 | 32 |
31 sql::Connection* db_; | 33 sql::Connection* db_; |
32 sql::MetaTable* meta_table_; | 34 sql::MetaTable* meta_table_; |
33 | 35 |
34 private: | 36 private: |
35 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable); | 37 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable); |
36 }; | 38 }; |
37 | 39 |
38 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ | 40 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ |
OLD | NEW |