| OLD | NEW |
| 1 // Copyright (c) 2011 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 CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/history/url_database.h" | 10 #include "chrome/browser/history/url_database.h" |
| 11 #include "chrome/browser/history/visit_database.h" | 11 #include "chrome/browser/history/visit_database.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 32 // Initializes the database connection. This must return true before any other | 32 // Initializes the database connection. This must return true before any other |
| 33 // functions on this class are called. | 33 // functions on this class are called. |
| 34 bool Init(const FilePath& file_name); | 34 bool Init(const FilePath& file_name); |
| 35 | 35 |
| 36 // Transactions on the database. We support nested transactions and only | 36 // Transactions on the database. We support nested transactions and only |
| 37 // commit when the outermost one is committed (sqlite doesn't support true | 37 // commit when the outermost one is committed (sqlite doesn't support true |
| 38 // nested transactions). | 38 // nested transactions). |
| 39 void BeginTransaction(); | 39 void BeginTransaction(); |
| 40 void CommitTransaction(); | 40 void CommitTransaction(); |
| 41 | 41 |
| 42 // Returns the current version that we will generate archived databases with. |
| 43 static int GetCurrentVersion(); |
| 44 |
| 42 private: | 45 private: |
| 43 // Implemented for the specialized databases. | 46 // Implemented for the specialized databases. |
| 44 virtual sql::Connection& GetDB() OVERRIDE; | 47 virtual sql::Connection& GetDB() OVERRIDE; |
| 45 | 48 |
| 46 // Makes sure the version is up-to-date, updating if necessary. If the | 49 // Makes sure the version is up-to-date, updating if necessary. If the |
| 47 // database is too old to migrate, the user will be notified. In this case, or | 50 // database is too old to migrate, the user will be notified. In this case, or |
| 48 // for other errors, false will be returned. True means it is up-to-date and | 51 // for other errors, false will be returned. True means it is up-to-date and |
| 49 // ready for use. | 52 // ready for use. |
| 50 // | 53 // |
| 51 // This assumes it is called from the init function inside a transaction. It | 54 // This assumes it is called from the init function inside a transaction. It |
| 52 // may commit the transaction and start a new one if migration requires it. | 55 // may commit the transaction and start a new one if migration requires it. |
| 53 sql::InitStatus EnsureCurrentVersion(); | 56 sql::InitStatus EnsureCurrentVersion(); |
| 54 | 57 |
| 55 // The database. | 58 // The database. |
| 56 sql::Connection db_; | 59 sql::Connection db_; |
| 57 sql::MetaTable meta_table_; | 60 sql::MetaTable meta_table_; |
| 58 | 61 |
| 59 DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); | 62 DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 } // namespace history | 65 } // namespace history |
| 63 | 66 |
| 64 #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 67 #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
| OLD | NEW |