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 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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/history/url_database.h" | 9 #include "chrome/browser/history/url_database.h" |
10 #include "chrome/browser/history/visit_database.h" | 10 #include "chrome/browser/history/visit_database.h" |
11 #include "sql/connection.h" | 11 #include "sql/connection.h" |
12 #include "sql/init_status.h" | 12 #include "sql/init_status.h" |
13 #include "sql/meta_table.h" | 13 #include "sql/meta_table.h" |
14 | 14 |
| 15 namespace base { |
15 class FilePath; | 16 class FilePath; |
| 17 } |
16 | 18 |
17 namespace history { | 19 namespace history { |
18 | 20 |
19 // Encapsulates the database operations for archived history. | 21 // Encapsulates the database operations for archived history. |
20 // | 22 // |
21 // IMPORTANT NOTE: The IDs in this system for URLs and visits will be | 23 // IMPORTANT NOTE: The IDs in this system for URLs and visits will be |
22 // different than those in the main database. This is to eliminate the | 24 // different than those in the main database. This is to eliminate the |
23 // dependency between them so we can deal with each one on its own. | 25 // dependency between them so we can deal with each one on its own. |
24 class ArchivedDatabase : public URLDatabase, | 26 class ArchivedDatabase : public URLDatabase, |
25 public VisitDatabase { | 27 public VisitDatabase { |
26 public: | 28 public: |
27 // Must call Init() before using other members. | 29 // Must call Init() before using other members. |
28 ArchivedDatabase(); | 30 ArchivedDatabase(); |
29 virtual ~ArchivedDatabase(); | 31 virtual ~ArchivedDatabase(); |
30 | 32 |
31 // Initializes the database connection. This must return true before any other | 33 // Initializes the database connection. This must return true before any other |
32 // functions on this class are called. | 34 // functions on this class are called. |
33 bool Init(const FilePath& file_name); | 35 bool Init(const base::FilePath& file_name); |
34 | 36 |
35 // Transactions on the database. We support nested transactions and only | 37 // Transactions on the database. We support nested transactions and only |
36 // commit when the outermost one is committed (sqlite doesn't support true | 38 // commit when the outermost one is committed (sqlite doesn't support true |
37 // nested transactions). | 39 // nested transactions). |
38 void BeginTransaction(); | 40 void BeginTransaction(); |
39 void CommitTransaction(); | 41 void CommitTransaction(); |
40 | 42 |
41 // Returns the current version that we will generate archived databases with. | 43 // Returns the current version that we will generate archived databases with. |
42 static int GetCurrentVersion(); | 44 static int GetCurrentVersion(); |
43 | 45 |
(...skipping 15 matching lines...) Expand all Loading... |
59 // The database. | 61 // The database. |
60 sql::Connection db_; | 62 sql::Connection db_; |
61 sql::MetaTable meta_table_; | 63 sql::MetaTable meta_table_; |
62 | 64 |
63 DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); | 65 DISALLOW_COPY_AND_ASSIGN(ArchivedDatabase); |
64 }; | 66 }; |
65 | 67 |
66 } // namespace history | 68 } // namespace history |
67 | 69 |
68 #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ | 70 #endif // CHROME_BROWSER_HISTORY_ARCHIVED_DATABASE_H_ |
OLD | NEW |