| Index: chrome/browser/history/history_backend.cc
|
| diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
|
| index 3f9c6ca2d5056f0fc148b3c6d7d56e86731a133b..030ee2da4fe27cd212449f6238396e423771f37a 100644
|
| --- a/chrome/browser/history/history_backend.cc
|
| +++ b/chrome/browser/history/history_backend.cc
|
| @@ -23,6 +23,7 @@
|
| #include "chrome/browser/api/bookmarks/bookmark_service.h"
|
| #include "chrome/browser/autocomplete/history_url_provider.h"
|
| #include "chrome/browser/cancelable_request.h"
|
| +#include "chrome/browser/history/download_persistent_store_info.h"
|
| #include "chrome/browser/history/history_notifications.h"
|
| #include "chrome/browser/history/history_publisher.h"
|
| #include "chrome/browser/history/in_memory_history_backend.h"
|
| @@ -33,7 +34,6 @@
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/url_constants.h"
|
| -#include "content/public/browser/download_persistent_store_info.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "grit/chromium_strings.h"
|
| #include "grit/generated_resources.h"
|
| @@ -1196,12 +1196,12 @@ void HistoryBackend::GetNextDownloadId(
|
|
|
| // Get all the download entries from the database.
|
| void HistoryBackend::QueryDownloads(
|
| - scoped_refptr<DownloadQueryRequest> request) {
|
| - if (request->canceled())
|
| - return;
|
| + const HistoryService::DownloadQueryCallback& callback) {
|
| + scoped_ptr<std::vector<DownloadPersistentStoreInfo> > results(
|
| + new std::vector<DownloadPersistentStoreInfo>());
|
| if (db_.get())
|
| - db_->QueryDownloads(&request->value);
|
| - request->ForwardResult(&request->value);
|
| + db_->QueryDownloads(results.get());
|
| + callback.Run(results.Pass());
|
| }
|
|
|
| // Clean up entries that has been corrupted (because of the crash, for example).
|
| @@ -1215,40 +1215,34 @@ void HistoryBackend::CleanUpInProgressEntries() {
|
|
|
| // Update a particular download entry.
|
| void HistoryBackend::UpdateDownload(
|
| - const content::DownloadPersistentStoreInfo& data) {
|
| + const DownloadPersistentStoreInfo& data) {
|
| if (db_.get())
|
| db_->UpdateDownload(data);
|
| }
|
|
|
| -// Update the path of a particular download entry.
|
| -void HistoryBackend::UpdateDownloadPath(const FilePath& path,
|
| - int64 db_handle) {
|
| - if (db_.get())
|
| - db_->UpdateDownloadPath(path, db_handle);
|
| -}
|
| -
|
| // Create a new download entry and pass back the db_handle to it.
|
| void HistoryBackend::CreateDownload(
|
| - scoped_refptr<DownloadCreateRequest> request,
|
| - int32 id,
|
| - const content::DownloadPersistentStoreInfo& history_info) {
|
| + const DownloadPersistentStoreInfo& history_info,
|
| + const HistoryService::DownloadCreateCallback& callback) {
|
| int64 db_handle = 0;
|
| - if (!request->canceled()) {
|
| - if (db_.get())
|
| - db_handle = db_->CreateDownload(history_info);
|
| - request->ForwardResult(id, db_handle);
|
| - }
|
| + if (db_.get())
|
| + db_handle = db_->CreateDownload(history_info);
|
| + callback.Run(db_handle);
|
| }
|
|
|
| -void HistoryBackend::RemoveDownload(int64 db_handle) {
|
| - if (db_.get())
|
| - db_->RemoveDownload(db_handle);
|
| +void HistoryBackend::GetVisibleVisitCountToHostSimple(
|
| + const GURL& url,
|
| + const HistoryService::GetVisibleVisitCountToHostSimpleCallback& callback) {
|
| + int count = 0;
|
| + Time first_visit;
|
| + const bool success = db_.get() &&
|
| + db_->GetVisibleVisitCountToHost(url, &count, &first_visit);
|
| + callback.Run(success, count, first_visit);
|
| }
|
|
|
| -void HistoryBackend::RemoveDownloadsBetween(const Time remove_begin,
|
| - const Time remove_end) {
|
| +void HistoryBackend::RemoveDownloads(const std::set<int64>& handles) {
|
| if (db_.get())
|
| - db_->RemoveDownloadsBetween(remove_begin, remove_end);
|
| + db_->RemoveDownloads(handles);
|
| }
|
|
|
| void HistoryBackend::QueryHistory(scoped_refptr<QueryHistoryRequest> request,
|
| @@ -2400,7 +2394,7 @@ bool HistoryBackend::SetFaviconMappingsForPage(
|
| }
|
| }
|
|
|
| - for (size_t i = 0; i < unmapped_icon_ids.size(); ++i ) {
|
| + for (size_t i = 0; i < unmapped_icon_ids.size(); ++i) {
|
| thumbnail_db_->AddIconMapping(page_url, unmapped_icon_ids[i]);
|
| mappings_changed = true;
|
| }
|
|
|