| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ | 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ |
| 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ | 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "components/webdata/common/web_database_table.h" | 11 #include "components/webdata/common/web_database_table.h" |
| 12 #include "components/webdata/common/webdata_export.h" | 12 #include "components/webdata/common/webdata_export.h" |
| 13 #include "sql/connection.h" | 13 #include "sql/connection.h" |
| 14 #include "sql/init_status.h" | 14 #include "sql/init_status.h" |
| 15 #include "sql/meta_table.h" | 15 #include "sql/meta_table.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class FilePath; | 18 class FilePath; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // This class manages a SQLite database that stores various web page meta data. | 21 // This class manages a SQLite database that stores various web page meta data. |
| 22 class WEBDATA_EXPORT WebDatabase { | 22 class WEBDATA_EXPORT WebDatabase { |
| 23 public: | 23 public: |
| 24 enum State { | 24 enum State { |
| 25 COMMIT_NOT_NEEDED, | 25 COMMIT_NOT_NEEDED, |
| 26 COMMIT_NEEDED | 26 COMMIT_NEEDED |
| 27 }; | 27 }; |
| 28 // Exposed publicly so the keyword table can access it. | 28 // Exposed publicly so the keyword table can access it. |
| 29 static const int kCurrentVersionNumber; | 29 static const int kCurrentVersionNumber; |
| 30 // The newest version of the database Chrome will NOT try to migrate. |
| 31 static const int kDeprecatedVersionNumber; |
| 30 | 32 |
| 31 WebDatabase(); | 33 WebDatabase(); |
| 32 virtual ~WebDatabase(); | 34 virtual ~WebDatabase(); |
| 33 | 35 |
| 34 // Adds a database table. Ownership remains with the caller, which | 36 // Adds a database table. Ownership remains with the caller, which |
| 35 // must ensure that the lifetime of |table| exceeds this object's | 37 // must ensure that the lifetime of |table| exceeds this object's |
| 36 // lifetime. Must only be called before Init. | 38 // lifetime. Must only be called before Init. |
| 37 void AddTable(WebDatabaseTable* table); | 39 void AddTable(WebDatabaseTable* table); |
| 38 | 40 |
| 39 // Retrieves a table based on its |key|. | 41 // Retrieves a table based on its |key|. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 78 |
| 77 // Map of all the different tables that have been added to this | 79 // Map of all the different tables that have been added to this |
| 78 // object. Non-owning. | 80 // object. Non-owning. |
| 79 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; | 81 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; |
| 80 TableMap tables_; | 82 TableMap tables_; |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(WebDatabase); | 84 DISALLOW_COPY_AND_ASSIGN(WebDatabase); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ | 87 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ |
| OLD | NEW |