Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1935)

Unified Diff: chrome/browser/history/download_database.h

Issue 10665049: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/download_database.h
diff --git a/chrome/browser/history/download_database.h b/chrome/browser/history/download_database.h
index f5e18bdfbbf052c255c5a7aec5f5884b0b4143b8..6bab634489453a83a1f92a8ab031553891b3b026 100644
--- a/chrome/browser/history/download_database.h
+++ b/chrome/browser/history/download_database.h
@@ -13,10 +13,7 @@
#include "sql/meta_table.h"
class FilePath;
-
-namespace content {
struct DownloadPersistentStoreInfo;
-}
namespace sql {
class Connection;
@@ -27,6 +24,10 @@ namespace history {
// Maintains a table of downloads.
class DownloadDatabase {
public:
+ // The value of |db_handle| indicating that the associated DownloadItem is not
+ // yet persisted.
+ static const int64 kUninitializedHandle = -1;
+
// Must call InitDownloadTable before using any other functions.
DownloadDatabase();
virtual ~DownloadDatabase();
@@ -35,15 +36,12 @@ class DownloadDatabase {
// Get all the downloads from the database.
void QueryDownloads(
- std::vector<content::DownloadPersistentStoreInfo>* results);
+ std::vector<DownloadPersistentStoreInfo>* results);
// Update the state of one download. Returns true if successful.
- // Does not update |url|, |start_time|, |total_bytes|; uses |db_handle| only
+ // Does not update |url|, |start_time|; uses |db_handle| only
// to select the row in the database table to update.
- bool UpdateDownload(const content::DownloadPersistentStoreInfo& data);
-
- // Update the path of one download. Returns true if successful.
- bool UpdateDownloadPath(const FilePath& path, DownloadID db_handle);
+ bool UpdateDownload(const DownloadPersistentStoreInfo& data);
// Fixes state of the download entries. Sometimes entries with IN_PROGRESS
// state are not updated during browser shutdown (particularly when crashing).
@@ -52,16 +50,10 @@ class DownloadDatabase {
bool CleanUpInProgressEntries();
// Create a new database entry for one download and return its primary db id.
- int64 CreateDownload(const content::DownloadPersistentStoreInfo& info);
+ int64 CreateDownload(const DownloadPersistentStoreInfo& info);
- // Remove a download from the database.
- void RemoveDownload(DownloadID db_handle);
-
- // Remove all completed downloads that started after |remove_begin|
- // (inclusive) and before |remove_end|. You may use null Time values
- // to do an unbounded delete in either direction. This function ignores
- // all downloads that are in progress or are waiting to be cancelled.
- bool RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
+ // Remove all |handles| from the database.
+ void RemoveDownloads(const std::set<int64>& handles);
protected:
// Returns the database for the functions in this interface.
@@ -83,11 +75,10 @@ class DownloadDatabase {
bool DropDownloadTable();
private:
- // TODO(rdsmith): Remove after http://crbug.com/96627 has been resolved.
- void CheckThread();
-
bool EnsureColumnExists(const std::string& name, const std::string& type);
+ int CountDownloads();
+
bool owning_thread_set_;
base::PlatformThreadId owning_thread_;
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api_unittest.cc ('k') | chrome/browser/history/download_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698