| 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..9b8e0bbd0041f04be9a3fb03b4a27a178efb00c8 100644
|
| --- a/chrome/browser/history/history_service.cc
|
| +++ b/chrome/browser/history/history_service.cc
|
| @@ -30,10 +30,8 @@
|
| #include "base/threading/thread.h"
|
| #include "base/time/time.h"
|
| #include "chrome/browser/browser_process.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/history/download_row.h"
|
| #include "chrome/browser/history/history_backend.h"
|
| -#include "chrome/browser/history/history_notifications.h"
|
| #include "chrome/browser/history/in_memory_history_backend.h"
|
| #include "chrome/browser/history/in_memory_url_index.h"
|
| #include "chrome/browser/history/top_sites.h"
|
| @@ -183,10 +181,18 @@ 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));
|
| + }
|
| +
|
| + void NotifyURLsDeleted(bool all_history,
|
| + bool expired,
|
| + const history::URLRows& deleted_rows,
|
| + const std::set<GURL>& favicon_urls) override {
|
| + service_task_runner_->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&HistoryService::NotifyURLsModified,
|
| - history_service_,
|
| - changed_urls));
|
| + base::Bind(&HistoryService::NotifyURLsDeleted, history_service_,
|
| + all_history, expired, deleted_rows, favicon_urls));
|
| }
|
|
|
| void BroadcastNotifications(
|
| @@ -239,8 +245,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 +944,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 +1236,37 @@ void HistoryService::NotifyURLsModified(const history::URLRows& changed_urls) {
|
| OnURLsModified(this, changed_urls));
|
| }
|
|
|
| +void HistoryService::NotifyURLsDeleted(bool all_history,
|
| + bool expired,
|
| + const history::URLRows& deleted_rows,
|
| + const std::set<GURL>& favicon_urls) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| + if (!thread_)
|
| + return;
|
| +
|
| + // 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 (all_history) {
|
| + visitedlink_master_->DeleteAllURLs();
|
| + } else {
|
| + URLIteratorFromURLRows iterator(deleted_rows);
|
| + visitedlink_master_->DeleteURLs(&iterator);
|
| + }
|
| + }
|
| +
|
| + FOR_EACH_OBSERVER(
|
| + history::HistoryServiceObserver, observers_,
|
| + OnURLsDeleted(this, all_history, expired, deleted_rows, favicon_urls));
|
| +}
|
| +
|
| void HistoryService::NotifyHistoryServiceLoaded() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| FOR_EACH_OBSERVER(history::HistoryServiceObserver, observers_,
|
|
|