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

Side by Side Diff: chrome/browser/autocomplete/keyword_extensions_delegate_impl.cc

Issue 1833773002: [Extensions] Convert APIs to use movable types [8] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | chrome/browser/extensions/api/omnibox/omnibox_api.cc » ('j') | 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 "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" 5 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" 10 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (!KeywordProvider::ExtractKeywordFromInput(input, &keyword, 169 if (!KeywordProvider::ExtractKeywordFromInput(input, &keyword,
170 &remaining_input)) 170 &remaining_input))
171 return; 171 return;
172 const TemplateURL* template_url = 172 const TemplateURL* template_url =
173 model->GetTemplateURLForKeyword(keyword); 173 model->GetTemplateURLForKeyword(keyword);
174 174
175 // TODO(mpcomplete): consider clamping the number of suggestions to 175 // TODO(mpcomplete): consider clamping the number of suggestions to
176 // AutocompleteProvider::kMaxMatches. 176 // AutocompleteProvider::kMaxMatches.
177 for (size_t i = 0; i < suggestions.suggest_results.size(); ++i) { 177 for (size_t i = 0; i < suggestions.suggest_results.size(); ++i) {
178 const omnibox_api::SuggestResult& suggestion = 178 const omnibox_api::SuggestResult& suggestion =
179 *suggestions.suggest_results[i]; 179 suggestions.suggest_results[i];
180 // We want to order these suggestions in descending order, so start with 180 // We want to order these suggestions in descending order, so start with
181 // the relevance of the first result (added synchronously in Start()), 181 // the relevance of the first result (added synchronously in Start()),
182 // and subtract 1 for each subsequent suggestion from the extension. 182 // and subtract 1 for each subsequent suggestion from the extension.
183 // We recompute the first match's relevance; we know that |complete| 183 // We recompute the first match's relevance; we know that |complete|
184 // is true, because we wouldn't get results from the extension unless 184 // is true, because we wouldn't get results from the extension unless
185 // the full keyword had been typed. 185 // the full keyword had been typed.
186 int first_relevance = KeywordProvider::CalculateRelevance( 186 int first_relevance = KeywordProvider::CalculateRelevance(
187 input.type(), true, true, true, input.prefer_keyword(), 187 input.type(), true, true, true, input.prefer_keyword(),
188 input.allow_exact_keyword_match()); 188 input.allow_exact_keyword_match());
189 // Because these matches are async, we should never let them become the 189 // Because these matches are async, we should never let them become the
(...skipping 21 matching lines...) Expand all
211 211
212 default: 212 default:
213 NOTREACHED(); 213 NOTREACHED();
214 return; 214 return;
215 } 215 }
216 } 216 }
217 217
218 void KeywordExtensionsDelegateImpl::OnProviderUpdate(bool updated_matches) { 218 void KeywordExtensionsDelegateImpl::OnProviderUpdate(bool updated_matches) {
219 provider_->listener_->OnProviderUpdate(updated_matches); 219 provider_->listener_->OnProviderUpdate(updated_matches);
220 } 220 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/omnibox/omnibox_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698