Chromium Code Reviews| 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..959de91f3fc29456433ed79d1805aee15560ff19 100644 |
| --- a/chrome/browser/history/in_memory_history_backend.cc |
| +++ b/chrome/browser/history/in_memory_history_backend.cc |
| @@ -59,7 +59,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 +87,28 @@ void InMemoryHistoryBackend::OnURLsModified(HistoryService* history_service, |
| } |
| } |
| +void InMemoryHistoryBackend::OnURLsDeleted(HistoryService* history_service, |
| + 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(); |
|
sdefresne
2014/12/04 17:21:13
nit: you can use the new c++11 for loops here too.
nshaik
2014/12/07 09:34:50
Done.
|
| + 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::Observe( |
| int type, |
| const content::NotificationSource& source, |
| @@ -101,9 +122,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 +138,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()); |