Index: chrome/browser/history/history_service.cc |
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc |
index ea860614bae271488bf4f517ea544ee2d3b9f20d..f4d00adef4c4209dd39a63fd4f2d688e82a44a53 100644 |
--- a/chrome/browser/history/history_service.cc |
+++ b/chrome/browser/history/history_service.cc |
@@ -183,10 +183,15 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate { |
void NotifyURLsModified(const history::URLRows& changed_urls) override { |
service_task_runner_->PostTask( |
- FROM_HERE, |
- base::Bind(&HistoryService::NotifyURLsModified, |
- history_service_, |
- changed_urls)); |
+ FROM_HERE, base::Bind(&HistoryService::NotifyURLsModified, |
+ history_service_, changed_urls)); |
+ } |
+ |
+ void NotifyURLsDeleted( |
+ const history::URLsDeletedDetails& deleted_details) override { |
+ service_task_runner_->PostTask( |
+ FROM_HERE, base::Bind(&HistoryService::NotifyURLsDeleted, |
+ history_service_, deleted_details)); |
} |
void BroadcastNotifications( |
@@ -239,8 +244,6 @@ HistoryService::HistoryService(history::HistoryClient* client, Profile* profile) |
no_db_(false), |
weak_ptr_factory_(this) { |
DCHECK(profile_); |
- registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
- content::Source<Profile>(profile_)); |
} |
HistoryService::~HistoryService() { |
@@ -940,42 +943,6 @@ void HistoryService::Cleanup() { |
delete thread; |
} |
-void HistoryService::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- DCHECK(thread_checker_.CalledOnValidThread()); |
- if (!thread_) |
- return; |
- |
- switch (type) { |
- case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { |
- // Update the visited link system for deleted URLs. We will update the |
- // visited link system for added URLs as soon as we get the add |
- // notification (we don't have to wait for the backend, which allows us to |
- // be faster to update the state). |
- // |
- // For deleted URLs, we don't typically know what will be deleted since |
- // delete notifications are by time. We would also like to be more |
- // respectful of privacy and never tell the user something is gone when it |
- // isn't. Therefore, we update the delete URLs after the fact. |
- if (visitedlink_master_) { |
- content::Details<history::URLsDeletedDetails> deleted_details(details); |
- |
- if (deleted_details->all_history) { |
- visitedlink_master_->DeleteAllURLs(); |
- } else { |
- URLIteratorFromURLRows iterator(deleted_details->rows); |
- visitedlink_master_->DeleteURLs(&iterator); |
- } |
- } |
- break; |
- } |
- |
- default: |
- NOTREACHED(); |
- } |
-} |
- |
void HistoryService::RebuildTable( |
const scoped_refptr<URLEnumerator>& enumerator) { |
DCHECK(thread_) << "History service being called after cleanup"; |
@@ -1268,6 +1235,31 @@ void HistoryService::NotifyURLsModified(const history::URLRows& changed_urls) { |
OnURLsModified(this, changed_urls)); |
} |
+void HistoryService::NotifyURLsDeleted( |
+ const history::URLsDeletedDetails& deleted_details) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ // Update the visited link system for deleted URLs. We will update the |
+ // visited link system for added URLs as soon as we get the add |
+ // notification (we don't have to wait for the backend, which allows us to |
+ // be faster to update the state). |
+ // |
+ // For deleted URLs, we don't typically know what will be deleted since |
+ // delete notifications are by time. We would also like to be more |
+ // respectful of privacy and never tell the user something is gone when it |
+ // isn't. Therefore, we update the delete URLs after the fact. |
+ if (visitedlink_master_) { |
+ if (deleted_details.all_history) { |
+ visitedlink_master_->DeleteAllURLs(); |
+ } else { |
+ URLIteratorFromURLRows iterator(deleted_details.rows); |
+ visitedlink_master_->DeleteURLs(&iterator); |
+ } |
+ } |
+ |
+ FOR_EACH_OBSERVER(history::HistoryServiceObserver, observers_, |
+ OnURLsDeleted(this, deleted_details)); |
+} |
+ |
void HistoryService::NotifyHistoryServiceLoaded() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
FOR_EACH_OBSERVER(history::HistoryServiceObserver, observers_, |