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

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

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed local variables in tests 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_history_backend.cc
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc
index 1660e00e90ab8d3996cca80b8745cb4b9fe618f7..e81197f4738efa7d76ce4b0b9b598ca3049a0cba 100644
--- a/chrome/browser/history/in_memory_history_backend.cc
+++ b/chrome/browser/history/in_memory_history_backend.cc
@@ -12,7 +12,6 @@
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/profiles/profile.h"
#include "components/history/core/browser/in_memory_database.h"
@@ -59,7 +58,6 @@ void InMemoryHistoryBackend::AttachToHistoryService(
// Register for the notifications we care about.
// We only want notifications for the associated profile.
content::Source<Profile> source(profile_);
- registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, source);
registrar_.Add(
this, chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, source);
registrar_.Add(
@@ -88,6 +86,30 @@ void InMemoryHistoryBackend::OnURLsModified(HistoryService* history_service,
}
}
+void InMemoryHistoryBackend::OnURLsDeleted(HistoryService* history_service,
+ bool all_history,
+ bool expired,
+ const URLRows& deleted_rows,
+ const std::set<GURL>& favicon_urls) {
+ DCHECK(db_);
+
+ if (all_history) {
+ // When all history is deleted, the individual URLs won't be listed. Just
+ // create a new database to quickly clear everything out.
+ db_.reset(new InMemoryDatabase);
+ if (!db_->InitFromScratch())
+ db_.reset();
+ return;
+ }
+
+ // Delete all matching URLs in our database.
+ for (const auto& row : deleted_rows) {
+ // This will also delete the corresponding keyword search term.
+ // Ignore errors, as we typically only cache a subset of URLRows.
+ db_->DeleteURLRow(row.id());
+ }
+}
+
void InMemoryHistoryBackend::Observe(
int type,
const content::NotificationSource& source,
@@ -101,9 +123,6 @@ void InMemoryHistoryBackend::Observe(
OnKeywordSearchTermDeleted(
*content::Details<KeywordSearchDeletedDetails>(details).ptr());
break;
- case chrome::NOTIFICATION_HISTORY_URLS_DELETED:
- OnURLsDeleted(*content::Details<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.
@@ -120,27 +139,6 @@ void InMemoryHistoryBackend::OnURLVisitedOrModified(const URLRow& url_row) {
db_->DeleteURLRow(url_row.id());
}
-void InMemoryHistoryBackend::OnURLsDeleted(const URLsDeletedDetails& details) {
- DCHECK(db_);
-
- if (details.all_history) {
- // When all history is deleted, the individual URLs won't be listed. Just
- // create a new database to quickly clear everything out.
- db_.reset(new InMemoryDatabase);
- if (!db_->InitFromScratch())
- db_.reset();
- return;
- }
-
- // Delete all matching URLs in our database.
- for (URLRows::const_iterator row = details.rows.begin();
- row != details.rows.end(); ++row) {
- // This will also delete the corresponding keyword search term.
- // Ignore errors, as we typically only cache a subset of URLRows.
- db_->DeleteURLRow(row->id());
- }
-}
-
void InMemoryHistoryBackend::OnKeywordSearchTermUpdated(
const KeywordSearchUpdatedDetails& details) {
DCHECK(details.url_row.id());

Powered by Google App Engine
This is Rietveld 408576698