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_HISTORY_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 private: | 59 private: |
60 HistoryDatabase* db_; | 60 HistoryDatabase* db_; |
61 }; | 61 }; |
62 | 62 |
63 // Must call Init() to complete construction. Although it can be created on | 63 // Must call Init() to complete construction. Although it can be created on |
64 // any thread, it must be destructed on the history thread for proper | 64 // any thread, it must be destructed on the history thread for proper |
65 // database cleanup. | 65 // database cleanup. |
66 HistoryDatabase(); | 66 HistoryDatabase(); |
67 | 67 |
68 virtual ~HistoryDatabase(); | 68 ~HistoryDatabase() override; |
69 | 69 |
70 // Call before Init() to set the error callback to be used for the | 70 // Call before Init() to set the error callback to be used for the |
71 // underlying database connection. | 71 // underlying database connection. |
72 void set_error_callback( | 72 void set_error_callback( |
73 const sql::Connection::ErrorCallback& error_callback) { | 73 const sql::Connection::ErrorCallback& error_callback) { |
74 error_callback_ = error_callback; | 74 error_callback_ = error_callback; |
75 } | 75 } |
76 | 76 |
77 // Must call this function to complete initialization. Will return | 77 // Must call this function to complete initialization. Will return |
78 // sql::INIT_OK on success. Otherwise, no other function should be called. You | 78 // sql::INIT_OK on success. Otherwise, no other function should be called. You |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 private: | 155 private: |
156 #if defined(OS_ANDROID) | 156 #if defined(OS_ANDROID) |
157 // AndroidProviderBackend uses the |db_|. | 157 // AndroidProviderBackend uses the |db_|. |
158 friend class AndroidProviderBackend; | 158 friend class AndroidProviderBackend; |
159 FRIEND_TEST_ALL_PREFIXES(AndroidURLsMigrationTest, MigrateToVersion22); | 159 FRIEND_TEST_ALL_PREFIXES(AndroidURLsMigrationTest, MigrateToVersion22); |
160 #endif | 160 #endif |
161 friend class ::HistoryQuickProviderTest; | 161 friend class ::HistoryQuickProviderTest; |
162 friend class InMemoryURLIndexTest; | 162 friend class InMemoryURLIndexTest; |
163 | 163 |
164 // Overridden from URLDatabase: | 164 // Overridden from URLDatabase: |
165 virtual sql::Connection& GetDB() override; | 165 sql::Connection& GetDB() override; |
166 | 166 |
167 // Migration ----------------------------------------------------------------- | 167 // Migration ----------------------------------------------------------------- |
168 | 168 |
169 // Makes sure the version is up-to-date, updating if necessary. If the | 169 // Makes sure the version is up-to-date, updating if necessary. If the |
170 // database is too old to migrate, the user will be notified. Returns | 170 // database is too old to migrate, the user will be notified. Returns |
171 // sql::INIT_OK iff the DB is up-to-date and ready for use. | 171 // sql::INIT_OK iff the DB is up-to-date and ready for use. |
172 // | 172 // |
173 // This assumes it is called from the init function inside a transaction. It | 173 // This assumes it is called from the init function inside a transaction. It |
174 // may commit the transaction and start a new one if migration requires it. | 174 // may commit the transaction and start a new one if migration requires it. |
175 sql::InitStatus EnsureCurrentVersion(); | 175 sql::InitStatus EnsureCurrentVersion(); |
(...skipping 11 matching lines...) Expand all Loading... |
187 sql::MetaTable meta_table_; | 187 sql::MetaTable meta_table_; |
188 | 188 |
189 base::Time cached_early_expiration_threshold_; | 189 base::Time cached_early_expiration_threshold_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); | 191 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); |
192 }; | 192 }; |
193 | 193 |
194 } // namespace history | 194 } // namespace history |
195 | 195 |
196 #endif // CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 196 #endif // CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
OLD | NEW |