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

Side by Side Diff: components/omnibox/browser/base_search_provider.cc

Issue 2252343002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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(base::WrapUnique(new SuggestionDeletionHandler( 128 deletion_handlers_.push_back(base::MakeUnique<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 475
476 void BaseSearchProvider::OnDeletionComplete( 476 void BaseSearchProvider::OnDeletionComplete(
477 bool success, SuggestionDeletionHandler* handler) { 477 bool success, SuggestionDeletionHandler* handler) {
478 RecordDeletionResult(success); 478 RecordDeletionResult(success);
479 deletion_handlers_.erase(std::remove_if( 479 deletion_handlers_.erase(std::remove_if(
480 deletion_handlers_.begin(), deletion_handlers_.end(), 480 deletion_handlers_.begin(), deletion_handlers_.end(),
481 [handler](const std::unique_ptr<SuggestionDeletionHandler>& elem) { 481 [handler](const std::unique_ptr<SuggestionDeletionHandler>& elem) {
482 return elem.get() == handler; 482 return elem.get() == handler;
483 })); 483 }));
484 } 484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698