| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_DOWNLOAD_DATABASE_H__ | 5 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H__ |
| 6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H__ | 6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H__ |
| 7 | 7 |
| 8 #include "chrome/browser/history/history_types.h" | 8 #include "chrome/browser/history/history_types.h" |
| 9 | 9 |
| 10 struct sqlite3; | 10 struct sqlite3; |
| 11 class SqliteStatementCache; | 11 class SqliteStatementCache; |
| 12 class SQLStatement; | 12 class SQLStatement; |
| 13 struct DownloadCreateInfo; | 13 struct DownloadCreateInfo; |
| 14 | 14 |
| 15 namespace history { | 15 namespace history { |
| 16 | 16 |
| 17 // Maintains a table of downloads. | 17 // Maintains a table of downloads. |
| 18 class DownloadDatabase { | 18 class DownloadDatabase { |
| 19 public: | 19 public: |
| 20 // Must call InitDownloadTable before using any other functions. | 20 // Must call InitDownloadTable before using any other functions. |
| 21 DownloadDatabase(); | 21 DownloadDatabase(); |
| 22 virtual ~DownloadDatabase(); | 22 virtual ~DownloadDatabase(); |
| 23 | 23 |
| 24 // Get all the downloads from the database. | 24 // Get all the downloads from the database. |
| 25 void QueryDownloads(std::vector<DownloadCreateInfo>* results); | 25 void QueryDownloads(std::vector<DownloadCreateInfo>* results); |
| 26 | 26 |
| 27 // Update the state of one download. Returns true if successful. | 27 // Update the state of one download. Returns true if successful. |
| 28 bool UpdateDownload(int64 received_bytes, int32 state, DownloadID db_handle); | 28 bool UpdateDownload(int64 received_bytes, int32 state, DownloadID db_handle); |
| 29 | 29 |
| 30 // Update the path of one download. Returns true if successful. |
| 31 bool UpdateDownloadPath(const std::wstring& path, DownloadID db_handle); |
| 32 |
| 30 // Create a new database entry for one download and return its primary db id. | 33 // Create a new database entry for one download and return its primary db id. |
| 31 int64 CreateDownload(const DownloadCreateInfo& info); | 34 int64 CreateDownload(const DownloadCreateInfo& info); |
| 32 | 35 |
| 33 // Remove a download from the database. | 36 // Remove a download from the database. |
| 34 void RemoveDownload(DownloadID db_handle); | 37 void RemoveDownload(DownloadID db_handle); |
| 35 | 38 |
| 36 // Remove all completed downloads that started after |remove_begin| | 39 // Remove all completed downloads that started after |remove_begin| |
| 37 // (inclusive) and before |remove_end|. You may use null Time values | 40 // (inclusive) and before |remove_end|. You may use null Time values |
| 38 // to do an unbounded delete in either direction. This function ignores | 41 // to do an unbounded delete in either direction. This function ignores |
| 39 // all downloads that are in progress or are waiting to be cancelled. | 42 // all downloads that are in progress or are waiting to be cancelled. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 bool DropDownloadTable(); | 61 bool DropDownloadTable(); |
| 59 | 62 |
| 60 private: | 63 private: |
| 61 DISALLOW_EVIL_CONSTRUCTORS(DownloadDatabase); | 64 DISALLOW_EVIL_CONSTRUCTORS(DownloadDatabase); |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 } // namespace history | 67 } // namespace history |
| 65 | 68 |
| 66 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H__ | 69 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H__ |
| 67 | 70 |
| OLD | NEW |