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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void CommitTransaction(); | 52 void CommitTransaction(); |
53 | 53 |
54 // Exposed for testing only. | 54 // Exposed for testing only. |
55 sql::Connection* GetSQLConnection(); | 55 sql::Connection* GetSQLConnection(); |
56 | 56 |
57 private: | 57 private: |
58 // Used by |Init()| to migration database schema from older versions to | 58 // Used by |Init()| to migration database schema from older versions to |
59 // current version. | 59 // current version. |
60 sql::InitStatus MigrateOldVersionsAsNeeded(); | 60 sql::InitStatus MigrateOldVersionsAsNeeded(); |
61 | 61 |
| 62 // Migrates this database to |version|. Returns false if there was |
| 63 // migration work to do and it failed, true otherwise. |
| 64 // |
| 65 // Implementations may set |*update_compatible_version| to true if |
| 66 // the compatible version should be changed to |version|. |
| 67 // Implementations should otherwise not modify this parameter. |
| 68 bool MigrateToVersion(int version, |
| 69 bool* update_compatible_version); |
| 70 |
| 71 // Migration method for version 58. |
| 72 bool MigrateToVersion58DropWebAppsAndIntents(); |
| 73 |
62 sql::Connection db_; | 74 sql::Connection db_; |
63 sql::MetaTable meta_table_; | 75 sql::MetaTable meta_table_; |
64 | 76 |
65 // Map of all the different tables that have been added to this | 77 // Map of all the different tables that have been added to this |
66 // object. Non-owning. | 78 // object. Non-owning. |
67 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; | 79 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; |
68 TableMap tables_; | 80 TableMap tables_; |
69 | 81 |
70 DISALLOW_COPY_AND_ASSIGN(WebDatabase); | 82 DISALLOW_COPY_AND_ASSIGN(WebDatabase); |
71 }; | 83 }; |
72 | 84 |
73 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ | 85 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ |
OLD | NEW |