Index: chrome/browser/ui/webui/history_ui.cc |
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc |
index 7f9a513c507431e8ad30ad43a66a80efe063d06f..44a511d6563fb0b75233abeac5099dc95ffb730a 100644 |
--- a/chrome/browser/ui/webui/history_ui.cc |
+++ b/chrome/browser/ui/webui/history_ui.cc |
@@ -386,7 +386,10 @@ bool BrowsingHistoryHandler::HistoryEntry::SortByTimeDescending( |
return entry1.time > entry2.time; |
} |
-BrowsingHistoryHandler::BrowsingHistoryHandler() {} |
+BrowsingHistoryHandler::BrowsingHistoryHandler() |
+ : pending_delete_requests_(0), |
+ weak_factory_(this) { |
+} |
BrowsingHistoryHandler::~BrowsingHistoryHandler() { |
history_request_consumer_.CancelAllRequests(); |
@@ -612,10 +615,11 @@ void BrowsingHistoryHandler::HandleRemoveVisits(const base::ListValue* args) { |
&delete_task_tracker_); |
if (web_history) { |
- web_history_delete_request_ = web_history->ExpireHistory( |
+ pending_delete_requests_++; |
Patrick Dubroy
2014/02/20 12:56:55
This seems to imply that there can be multiple del
davidben
2014/02/20 18:08:01
Done.
|
+ web_history->ExpireHistory( |
expire_list, |
base::Bind(&BrowsingHistoryHandler::RemoveWebHistoryComplete, |
- base::Unretained(this))); |
+ weak_factory_.GetWeakPtr())); |
} |
#if defined(ENABLE_EXTENSIONS) |
@@ -886,14 +890,13 @@ void BrowsingHistoryHandler::RemoveComplete() { |
// Notify the page that the deletion request is complete, but only if a web |
// history delete request is not still pending. |
- if (!(web_history_delete_request_.get() && |
- web_history_delete_request_->is_pending())) { |
+ if (pending_delete_requests_ == 0) { |
web_ui()->CallJavascriptFunction("deleteComplete"); |
} |
} |
-void BrowsingHistoryHandler::RemoveWebHistoryComplete( |
- history::WebHistoryService::Request* request, bool success) { |
+void BrowsingHistoryHandler::RemoveWebHistoryComplete(bool success) { |
+ pending_delete_requests_--; |
// TODO(dubroy): Should we handle failure somehow? Delete directives will |
// ensure that the visits are eventually deleted, so maybe it's not necessary. |
if (!delete_task_tracker_.HasTrackedTasks()) |