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

Unified Diff: chrome/browser/history/history.cc

Issue 10915180: 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/history.cc
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc
index 5c2f934177a1c0dcb7ed76a29a6d2b637392f0b5..697bb5ba5068a62e65492959e66d2c381aaaf1dc 100644
--- a/chrome/browser/history/history.cc
+++ b/chrome/browser/history/history.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/history/download_persistent_store_info.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_types.h"
@@ -55,7 +56,6 @@
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/download_persistent_store_info.h"
#include "content/public/browser/notification_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -577,14 +577,21 @@ HistoryService::Handle HistoryService::QueryURL(
// Handle creation of a download by creating an entry in the history service's
// 'downloads' table.
-HistoryService::Handle HistoryService::CreateDownload(
- int32 id,
- const content::DownloadPersistentStoreInfo& create_info,
- CancelableRequestConsumerBase* consumer,
+void HistoryService::CreateDownload(
+ const DownloadPersistentStoreInfo& info,
const HistoryService::DownloadCreateCallback& callback) {
- return Schedule(PRIORITY_NORMAL, &HistoryBackend::CreateDownload, consumer,
- new history::DownloadCreateRequest(callback), id,
- create_info);
+ LoadBackendIfNecessary();
+ ScheduleTask(PRIORITY_NORMAL, base::Bind(
+ &HistoryBackend::CreateDownload, history_backend_.get(), info, callback));
+}
+
+void HistoryService::GetVisibleVisitCountToHostSimple(
+ const GURL& url,
+ const GetVisibleVisitCountToHostSimpleCallback& callback) {
+ LoadBackendIfNecessary();
+ ScheduleTask(PRIORITY_NORMAL, base::Bind(
+ &HistoryBackend::GetVisibleVisitCountToHostSimple, history_backend_.get(),
+ url, callback));
}
HistoryService::Handle HistoryService::GetNextDownloadId(
@@ -596,11 +603,11 @@ HistoryService::Handle HistoryService::GetNextDownloadId(
// Handle queries for a list of all downloads in the history database's
// 'downloads' table.
-HistoryService::Handle HistoryService::QueryDownloads(
- CancelableRequestConsumerBase* consumer,
+void HistoryService::QueryDownloads(
Randy Smith (Not in Mondays) 2012/09/11 18:36:53 nit: This and next line look like they could fit o
benjhayden 2012/09/13 15:18:16 Done.
const DownloadQueryCallback& callback) {
- return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryDownloads, consumer,
- new history::DownloadQueryRequest(callback));
+ LoadBackendIfNecessary();
+ ScheduleTask(PRIORITY_NORMAL, base::Bind(
+ &HistoryBackend::QueryDownloads, history_backend_.get(), callback));
}
// Changes all IN_PROGRESS in the database entries to CANCELED.
@@ -613,27 +620,13 @@ void HistoryService::CleanUpInProgressEntries() {
// Handle updates for a particular download. This is a 'fire and forget'
// operation, so we don't need to be called back.
void HistoryService::UpdateDownload(
- const content::DownloadPersistentStoreInfo& data) {
+ const DownloadPersistentStoreInfo& data) {
ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::UpdateDownload, data);
}
-void HistoryService::UpdateDownloadPath(const FilePath& path,
- int64 db_handle) {
- ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::UpdateDownloadPath,
- path, db_handle);
-}
-
-void HistoryService::RemoveDownload(int64 db_handle) {
- ScheduleAndForget(PRIORITY_NORMAL,
- &HistoryBackend::RemoveDownload, db_handle);
-}
-
-void HistoryService::RemoveDownloadsBetween(Time remove_begin,
- Time remove_end) {
+void HistoryService::RemoveDownloads(const std::set<int64>& handles) {
ScheduleAndForget(PRIORITY_NORMAL,
- &HistoryBackend::RemoveDownloadsBetween,
- remove_begin,
- remove_end);
+ &HistoryBackend::RemoveDownloads, handles);
}
HistoryService::Handle HistoryService::QueryHistory(

Powered by Google App Engine
This is Rietveld 408576698