| 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 COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_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" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "components/history/core/browser/download_database.h" | 12 #include "components/history/core/browser/download_database.h" |
| 13 #include "components/history/core/browser/url_database.h" | 13 #include "components/history/core/browser/url_database.h" |
| 14 #include "components/history/core/browser/visit_database.h" | 14 #include "components/history/core/browser/visit_database.h" |
| 15 #include "components/history/core/browser/visitsegment_database.h" | 15 #include "components/history/core/browser/visitsegment_database.h" |
| 16 #include "sql/connection.h" | 16 #include "sql/connection.h" |
| 17 #include "sql/init_status.h" | 17 #include "sql/init_status.h" |
| 18 #include "sql/meta_table.h" | 18 #include "sql/meta_table.h" |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 21 #include "components/history/core/android/android_cache_database.h" | 21 #include "components/history/core/browser/android/android_cache_database.h" |
| 22 #include "components/history/core/android/android_urls_database.h" | 22 #include "components/history/core/browser/android/android_urls_database.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class FilePath; | 26 class FilePath; |
| 27 } | 27 } |
| 28 | 28 |
| 29 class HistoryQuickProviderTest; | 29 class HistoryQuickProviderTest; |
| 30 | 30 |
| 31 namespace history { | 31 namespace history { |
| 32 | 32 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 public VisitDatabase, | 46 public VisitDatabase, |
| 47 public VisitSegmentDatabase { | 47 public VisitSegmentDatabase { |
| 48 public: | 48 public: |
| 49 // A simple class for scoping a history database transaction. This does not | 49 // A simple class for scoping a history database transaction. This does not |
| 50 // support rollback since the history database doesn't, either. | 50 // support rollback since the history database doesn't, either. |
| 51 class TransactionScoper { | 51 class TransactionScoper { |
| 52 public: | 52 public: |
| 53 explicit TransactionScoper(HistoryDatabase* db) : db_(db) { | 53 explicit TransactionScoper(HistoryDatabase* db) : db_(db) { |
| 54 db_->BeginTransaction(); | 54 db_->BeginTransaction(); |
| 55 } | 55 } |
| 56 ~TransactionScoper() { | 56 ~TransactionScoper() { db_->CommitTransaction(); } |
| 57 db_->CommitTransaction(); | 57 |
| 58 } | |
| 59 private: | 58 private: |
| 60 HistoryDatabase* db_; | 59 HistoryDatabase* db_; |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 // Must call Init() to complete construction. Although it can be created on | 62 // 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 | 63 // any thread, it must be destructed on the history thread for proper |
| 65 // database cleanup. | 64 // database cleanup. |
| 66 HistoryDatabase(); | 65 HistoryDatabase(DownloadInterruptReason download_interrupt_reason_none, |
| 66 DownloadInterruptReason download_interrupt_reason_crash); |
| 67 | 67 |
| 68 ~HistoryDatabase() override; | 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 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 sql::Connection db_; | 186 sql::Connection db_; |
| 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 // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ |
| OLD | NEW |