| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // | 46 // |
| 47 // Before calling this method, you must call AddTable for any | 47 // Before calling this method, you must call AddTable for any |
| 48 // WebDatabaseTable objects that are supposed to participate in | 48 // WebDatabaseTable objects that are supposed to participate in |
| 49 // managing the database. | 49 // managing the database. |
| 50 sql::InitStatus Init(const base::FilePath& db_name); | 50 sql::InitStatus Init(const base::FilePath& db_name); |
| 51 | 51 |
| 52 // Transactions management | 52 // Transactions management |
| 53 void BeginTransaction(); | 53 void BeginTransaction(); |
| 54 void CommitTransaction(); | 54 void CommitTransaction(); |
| 55 | 55 |
| 56 sql::DatabaseDiagnosticMap GetDiagnosticMap(); |
| 57 |
| 56 // Exposed for testing only. | 58 // Exposed for testing only. |
| 57 sql::Connection* GetSQLConnection(); | 59 sql::Connection* GetSQLConnection(); |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 // Used by |Init()| to migration database schema from older versions to | 62 // Used by |Init()| to migration database schema from older versions to |
| 61 // current version. | 63 // current version. |
| 62 sql::InitStatus MigrateOldVersionsAsNeeded(); | 64 sql::InitStatus MigrateOldVersionsAsNeeded(); |
| 63 | 65 |
| 64 // Migrates this database to |version|. Returns false if there was | 66 // Migrates this database to |version|. Returns false if there was |
| 65 // migration work to do and it failed, true otherwise. | 67 // migration work to do and it failed, true otherwise. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 | 80 |
| 79 // Map of all the different tables that have been added to this | 81 // Map of all the different tables that have been added to this |
| 80 // object. Non-owning. | 82 // object. Non-owning. |
| 81 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; | 83 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; |
| 82 TableMap tables_; | 84 TableMap tables_; |
| 83 | 85 |
| 84 DISALLOW_COPY_AND_ASSIGN(WebDatabase); | 86 DISALLOW_COPY_AND_ASSIGN(WebDatabase); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ | 89 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ |
| OLD | NEW |