Chromium Code Reviews| Index: chrome/browser/predictors/autocomplete_action_predictor.cc |
| diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc |
| index e13c0309904ba00c181d090ab2191bc6740a86f2..37d8544702742b6f32f81aae0105d915d37f2955 100644 |
| --- a/chrome/browser/predictors/autocomplete_action_predictor.cc |
| +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc |
| @@ -16,7 +16,6 @@ |
| #include "base/strings/stringprintf.h" |
| #include "base/strings/utf_string_conversions.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/history/history_service_factory.h" |
| #include "chrome/browser/omnibox/omnibox_log.h" |
| @@ -125,11 +124,10 @@ void AutocompleteActionPredictor::RegisterTransitionalMatches( |
| transitional_match); |
| } |
| - for (AutocompleteResult::const_iterator i(result.begin()); i != result.end(); |
| - ++i) { |
| + for (const auto& i : result) { |
| if (std::find(match_it->urls.begin(), match_it->urls.end(), |
| - i->destination_url) == match_it->urls.end()) { |
| - match_it->urls.push_back(i->destination_url); |
| + i.destination_url) == match_it->urls.end()) { |
| + match_it->urls.push_back(i.destination_url); |
| } |
| } |
| } |
| @@ -236,19 +234,6 @@ void AutocompleteActionPredictor::Observe( |
| content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| content::NotificationService::AllSources()); |
| break; |
| - |
| - case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { |
| - DCHECK(initialized_); |
| - const content::Details<const history::URLsDeletedDetails> |
| - urls_deleted_details = |
| - content::Details<const history::URLsDeletedDetails>(details); |
| - if (urls_deleted_details->all_history) |
| - DeleteAllRows(); |
| - else |
| - DeleteRowsWithURLs(urls_deleted_details->rows); |
| - break; |
| - } |
| - |
| case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: { |
| DCHECK(initialized_); |
| @@ -562,8 +547,6 @@ void AutocompleteActionPredictor::FinishInitialization() { |
| // opens the non-incognito history (and lets users delete from there). |
| notification_registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| content::Source<Profile>(profile_)); |
| - notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
| - content::Source<Profile>(profile_->GetOriginalProfile())); |
| initialized_ = true; |
| } |
| @@ -599,6 +582,19 @@ void AutocompleteActionPredictor::Shutdown() { |
| history_service_observer_.RemoveAll(); |
| } |
| +void AutocompleteActionPredictor::OnURLsDeleted( |
| + HistoryService* history_service, |
| + bool all_history, |
| + bool expired, |
| + const history::URLRows& deleted_rows, |
| + const std::set<GURL>& favicon_urls) { |
| + DCHECK(initialized_); |
|
sky
2014/12/13 00:29:18
It looks as though the observer is added in the co
nshaik
2014/12/13 01:49:21
I wanted to replicate the exact behavior, but I ag
sky
2014/12/15 23:05:43
I'm not entirely sure that's true. Can you get a m
|
| + if (all_history) |
| + DeleteAllRows(); |
| + else |
| + DeleteRowsWithURLs(deleted_rows); |
| +} |
| + |
| void AutocompleteActionPredictor::OnHistoryServiceLoaded( |
| HistoryService* history_service) { |
| TryDeleteOldEntries(history_service); |