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

Unified Diff: components/omnibox/browser/base_search_provider.cc

Issue 1672573002: Eliminate ScopedVector in components/omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't use C++14 stuff Created 4 years, 10 months 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
« no previous file with comments | « components/omnibox/browser/base_search_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/browser/base_search_provider.cc
diff --git a/components/omnibox/browser/base_search_provider.cc b/components/omnibox/browser/base_search_provider.cc
index 0c1feb15addfdd08e465f7df20c7dda6f91a0e64..55aa13228d72028d036e44e70e4f9693c626eeb2 100644
--- a/components/omnibox/browser/base_search_provider.cc
+++ b/components/omnibox/browser/base_search_provider.cc
@@ -125,11 +125,11 @@ AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion(
void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) {
DCHECK(match.deletable);
if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) {
- deletion_handlers_.push_back(new SuggestionDeletionHandler(
+ deletion_handlers_.push_back(make_scoped_ptr(new SuggestionDeletionHandler(
match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey),
client_->GetRequestContext(),
base::Bind(&BaseSearchProvider::OnDeletionComplete,
- base::Unretained(this))));
+ base::Unretained(this)))));
}
TemplateURL* template_url =
@@ -482,8 +482,9 @@ void BaseSearchProvider::DeleteMatchFromMatches(
void BaseSearchProvider::OnDeletionComplete(
bool success, SuggestionDeletionHandler* handler) {
RecordDeletionResult(success);
- SuggestionDeletionHandlers::iterator it = std::find(
- deletion_handlers_.begin(), deletion_handlers_.end(), handler);
- DCHECK(it != deletion_handlers_.end());
- deletion_handlers_.erase(it);
+ deletion_handlers_.erase(std::remove_if(
+ deletion_handlers_.begin(), deletion_handlers_.end(),
+ [handler](const scoped_ptr<SuggestionDeletionHandler>& elem) {
Mark P 2016/02/05 19:19:21 Ah, how the language evolves.
+ return elem.get() == handler;
+ }));
}
« no previous file with comments | « components/omnibox/browser/base_search_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698