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

Unified Diff: chrome/browser/history/in_memory_url_index.cc

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove NotificationObserver from InMemoryURLIndex Created 6 years 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: chrome/browser/history/in_memory_url_index.cc
diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc
index 74ad2a07063e068a6fc88a59cdd1585f2e5f943d..dde249e670cbee57b7360ea65b7fd2b34c787e53 100644
--- a/chrome/browser/history/in_memory_url_index.cc
+++ b/chrome/browser/history/in_memory_url_index.cc
@@ -18,9 +18,6 @@
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/history/core/browser/url_database.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
using in_memory_url_index::InMemoryURLIndexCacheItem;
@@ -106,11 +103,7 @@ InMemoryURLIndex::InMemoryURLIndex(Profile* profile,
needs_to_be_cached_(false),
history_service_observer_(this) {
InitializeSchemeWhitelist(&scheme_whitelist_);
- if (profile) {
- // TODO(mrossetti): Register for language change notifications.
- content::Source<Profile> source(profile);
- registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, source);
- }
+ // TODO(mrossetti): Register for language change notifications.
if (history_service_)
history_service_observer_.Add(history_service_);
}
@@ -142,7 +135,6 @@ void InMemoryURLIndex::Init() {
void InMemoryURLIndex::ShutDown() {
history_service_observer_.RemoveAll();
- registrar_.RemoveAll();
cache_reader_tracker_.TryCancelAll();
shutdown_ = true;
base::FilePath path;
@@ -184,21 +176,6 @@ void InMemoryURLIndex::DeleteURL(const GURL& url) {
private_data_->DeleteURL(url);
}
-void InMemoryURLIndex::Observe(int notification_type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (notification_type) {
- case chrome::NOTIFICATION_HISTORY_URLS_DELETED:
- OnURLsDeleted(
- content::Details<history::URLsDeletedDetails>(details).ptr());
- break;
- default:
- // For simplicity, the unit tests send us all notifications, even when
- // we haven't registered for them, so don't assert here.
- break;
- }
-}
-
void InMemoryURLIndex::OnURLVisited(HistoryService* history_service,
ui::PageTransition transition,
const URLRow& row,
@@ -224,17 +201,14 @@ void InMemoryURLIndex::OnURLsModified(HistoryService* history_service,
}
}
-void InMemoryURLIndex::OnHistoryServiceLoaded(HistoryService* history_service) {
- ScheduleRebuildFromHistory();
-}
-
-void InMemoryURLIndex::OnURLsDeleted(const URLsDeletedDetails* details) {
- if (details->all_history) {
+void InMemoryURLIndex::OnURLsDeleted(HistoryService* history_service,
+ const URLsDeletedDetails& details) {
+ if (details.all_history) {
ClearPrivateData();
needs_to_be_cached_ = true;
} else {
- for (URLRows::const_iterator row = details->rows.begin();
- row != details->rows.end(); ++row)
+ for (URLRows::const_iterator row = details.rows.begin();
+ row != details.rows.end(); ++row)
needs_to_be_cached_ |= private_data_->DeleteURL(row->url());
}
// If we made changes, destroy the previous cache. Otherwise, if we go
@@ -258,6 +232,10 @@ void InMemoryURLIndex::OnURLsDeleted(const URLsDeletedDetails* details) {
}
}
+void InMemoryURLIndex::OnHistoryServiceLoaded(HistoryService* history_service) {
+ ScheduleRebuildFromHistory();
+}
+
// Restoring from Cache --------------------------------------------------------
void InMemoryURLIndex::PostRestoreFromCacheFileTask() {

Powered by Google App Engine
This is Rietveld 408576698