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

Unified Diff: components/history/core/browser/web_history_service.cc

Issue 2263613002: Make BrowsingDataHandler observe WebHistoryService deletions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved comments inside 'if'. Created 4 years, 4 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: components/history/core/browser/web_history_service.cc
diff --git a/components/history/core/browser/web_history_service.cc b/components/history/core/browser/web_history_service.cc
index 3902be39efb7f9cc1649b83a46de1988814eeeef..19986e58c0474ad79d76533b1cfbbdb774678c47 100644
--- a/components/history/core/browser/web_history_service.cc
+++ b/components/history/core/browser/web_history_service.cc
@@ -16,6 +16,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "components/history/core/browser/history_service_observer.h"
+#include "components/history/core/browser/web_history_service_observer.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync/driver/sync_util.h"
#include "components/sync/protocol/history_status.pb.h"
@@ -340,6 +342,14 @@ WebHistoryService::~WebHistoryService() {
base::STLDeleteElements(&pending_other_forms_of_browsing_history_requests_);
}
+void WebHistoryService::AddObserver(WebHistoryServiceObserver* observer) {
+ observer_list_.AddObserver(observer);
+}
+
+void WebHistoryService::RemoveObserver(WebHistoryServiceObserver* observer) {
+ observer_list_.RemoveObserver(observer);
+}
+
WebHistoryService::Request* WebHistoryService::CreateRequest(
const GURL& url,
const CompletionCallback& callback) {
@@ -419,8 +429,9 @@ void WebHistoryService::ExpireHistory(
std::unique_ptr<Request> request(CreateRequest(url, completion_callback));
request->SetPostData(post_data);
- request->Start();
+ Request* request_ptr = request.get();
pending_expire_requests_.insert(request.release());
+ request_ptr->Start();
}
void WebHistoryService::ExpireHistoryBetween(
@@ -553,6 +564,12 @@ void WebHistoryService::ExpireHistoryCompletionCallback(
response_value->GetString("version_info", &server_version_info_);
}
callback.Run(response_value.get() && success);
+
+ // Inform the observers about the history deletion.
+ if (response_value.get() && success) {
+ FOR_EACH_OBSERVER(WebHistoryServiceObserver, observer_list_,
+ OnWebHistoryDeleted());
+ }
}
void WebHistoryService::AudioHistoryCompletionCallback(
« no previous file with comments | « components/history/core/browser/web_history_service.h ('k') | components/history/core/browser/web_history_service_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698