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

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

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r168573 Created 8 years, 1 month 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..8cf07ab44b1c5a4b575f193eac84c7e8a93d0389 100644
--- a/chrome/browser/history/download_database.h
+++ b/chrome/browser/history/download_database.h
@@ -5,28 +5,29 @@
#ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
#define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
-#include <set>
#include <string>
+#include <vector>
#include "base/threading/platform_thread.h"
-#include "chrome/browser/history/history_types.h"
#include "sql/meta_table.h"
class FilePath;
-namespace content {
-struct DownloadPersistentStoreInfo;
-}
-
namespace sql {
class Connection;
}
namespace history {
+struct DownloadRow;
+
// 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;
+
// 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<DownloadRow>* 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 DownloadRow& 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,12 @@ 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 DownloadRow& info);
- // Remove a download from the database.
- void RemoveDownload(DownloadID db_handle);
+ // Remove |handle| from the database.
+ void RemoveDownload(int64 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);
+ int CountDownloads();
protected:
// Returns the database for the functions in this interface.
@@ -83,9 +77,6 @@ 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);
bool owning_thread_set_;

Powered by Google App Engine
This is Rietveld 408576698