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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « components/omnibox/browser/base_search_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/browser/base_search_provider.h" 5 #include "components/omnibox/browser/base_search_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 std::string(), from_keyword_provider, 0, false, false, base::string16()); 118 std::string(), from_keyword_provider, 0, false, false, base::string16());
119 suggest_result.set_received_after_last_keystroke(false); 119 suggest_result.set_received_after_last_keystroke(false);
120 return CreateSearchSuggestion( 120 return CreateSearchSuggestion(
121 NULL, AutocompleteInput(), from_keyword_provider, suggest_result, 121 NULL, AutocompleteInput(), from_keyword_provider, suggest_result,
122 template_url, search_terms_data, 0, false); 122 template_url, search_terms_data, 0, false);
123 } 123 }
124 124
125 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { 125 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) {
126 DCHECK(match.deletable); 126 DCHECK(match.deletable);
127 if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) { 127 if (!match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey).empty()) {
128 deletion_handlers_.push_back(new SuggestionDeletionHandler( 128 deletion_handlers_.push_back(make_scoped_ptr(new SuggestionDeletionHandler(
129 match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey), 129 match.GetAdditionalInfo(BaseSearchProvider::kDeletionUrlKey),
130 client_->GetRequestContext(), 130 client_->GetRequestContext(),
131 base::Bind(&BaseSearchProvider::OnDeletionComplete, 131 base::Bind(&BaseSearchProvider::OnDeletionComplete,
132 base::Unretained(this)))); 132 base::Unretained(this)))));
133 } 133 }
134 134
135 TemplateURL* template_url = 135 TemplateURL* template_url =
136 match.GetTemplateURL(client_->GetTemplateURLService(), false); 136 match.GetTemplateURL(client_->GetTemplateURLService(), false);
137 // This may be NULL if the template corresponding to the keyword has been 137 // This may be NULL if the template corresponding to the keyword has been
138 // deleted or there is no keyword set. 138 // deleted or there is no keyword set.
139 if (template_url != NULL) { 139 if (template_url != NULL) {
140 client_->DeleteMatchingURLsForKeywordFromHistory(template_url->id(), 140 client_->DeleteMatchingURLsForKeywordFromHistory(template_url->id(),
141 match.contents); 141 match.contents);
142 } 142 }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 if (i->contents == match.contents && i->type == match.type) { 475 if (i->contents == match.contents && i->type == match.type) {
476 matches_.erase(i); 476 matches_.erase(i);
477 break; 477 break;
478 } 478 }
479 } 479 }
480 } 480 }
481 481
482 void BaseSearchProvider::OnDeletionComplete( 482 void BaseSearchProvider::OnDeletionComplete(
483 bool success, SuggestionDeletionHandler* handler) { 483 bool success, SuggestionDeletionHandler* handler) {
484 RecordDeletionResult(success); 484 RecordDeletionResult(success);
485 SuggestionDeletionHandlers::iterator it = std::find( 485 deletion_handlers_.erase(std::remove_if(
486 deletion_handlers_.begin(), deletion_handlers_.end(), handler); 486 deletion_handlers_.begin(), deletion_handlers_.end(),
487 DCHECK(it != deletion_handlers_.end()); 487 [handler](const auto& elem) { return elem.get() == handler; }));
Peter Kasting 2016/02/05 00:54:04 You can't std::find() a raw pointer in a vector of
488 deletion_handlers_.erase(it);
489 } 488 }
OLDNEW
« 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