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 "app/sql/connection.h" | 9 #include "sql/connection.h" |
10 #include "app/sql/init_status.h" | 10 #include "sql/init_status.h" |
11 #include "app/sql/meta_table.h" | 11 #include "sql/meta_table.h" |
12 | 12 |
13 // An abstract base class representing a table within a WebDatabase. | 13 // An abstract base class representing a table within a WebDatabase. |
14 // Each table should subclass this, adding type-specific methods as needed. | 14 // Each table should subclass this, adding type-specific methods as needed. |
15 class WebDatabaseTable { | 15 class WebDatabaseTable { |
16 protected: | 16 protected: |
17 explicit WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table) | 17 explicit WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table) |
18 : db_(db), meta_table_(meta_table) {} | 18 : db_(db), meta_table_(meta_table) {} |
19 virtual ~WebDatabaseTable(); | 19 virtual ~WebDatabaseTable(); |
20 | 20 |
21 // Attempts to initialize the table and returns true if successful. | 21 // Attempts to initialize the table and returns true if successful. |
22 virtual bool Init() = 0; | 22 virtual bool Init() = 0; |
23 | 23 |
24 // In order to encourage developers to think about sync when adding or | 24 // 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 | 25 // 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 | 26 // 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). | 27 // should be aware of (or if you could break something). |
28 // TODO(andybons): Implement something more robust. | 28 // TODO(andybons): Implement something more robust. |
29 virtual bool IsSyncable() = 0; | 29 virtual bool IsSyncable() = 0; |
30 | 30 |
31 sql::Connection* db_; | 31 sql::Connection* db_; |
32 sql::MetaTable* meta_table_; | 32 sql::MetaTable* meta_table_; |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable); | 35 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable); |
36 }; | 36 }; |
37 | 37 |
38 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ | 38 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ |
OLD | NEW |