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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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/answers_cache.cc ('k') | components/omnibox/search_suggestion_parser.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 "components/omnibox/base_search_provider.h" 5 #include "components/omnibox/base_search_provider.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/metrics/proto/omnibox_event.pb.h" 10 #include "components/metrics/proto/omnibox_event.pb.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // suggestion, non-Search results will suddenly appear. 237 // suggestion, non-Search results will suddenly appear.
238 if (input.type() == metrics::OmniboxInputType::FORCED_QUERY) 238 if (input.type() == metrics::OmniboxInputType::FORCED_QUERY)
239 match.fill_into_edit.assign(base::ASCIIToUTF16("?")); 239 match.fill_into_edit.assign(base::ASCIIToUTF16("?"));
240 if (suggestion.from_keyword_provider()) 240 if (suggestion.from_keyword_provider())
241 match.fill_into_edit.append(match.keyword + base::char16(' ')); 241 match.fill_into_edit.append(match.keyword + base::char16(' '));
242 // We only allow inlinable navsuggestions that were received before the 242 // We only allow inlinable navsuggestions that were received before the
243 // last keystroke because we don't want asynchronous inline autocompletions. 243 // last keystroke because we don't want asynchronous inline autocompletions.
244 if (!input.prevent_inline_autocomplete() && 244 if (!input.prevent_inline_autocomplete() &&
245 !suggestion.received_after_last_keystroke() && 245 !suggestion.received_after_last_keystroke() &&
246 (!in_keyword_mode || suggestion.from_keyword_provider()) && 246 (!in_keyword_mode || suggestion.from_keyword_provider()) &&
247 StartsWith(suggestion.suggestion(), input.text(), false)) { 247 base::StartsWith(suggestion.suggestion(), input.text(), false)) {
248 match.inline_autocompletion = 248 match.inline_autocompletion =
249 suggestion.suggestion().substr(input.text().length()); 249 suggestion.suggestion().substr(input.text().length());
250 match.allowed_to_be_default_match = true; 250 match.allowed_to_be_default_match = true;
251 } 251 }
252 match.fill_into_edit.append(suggestion.suggestion()); 252 match.fill_into_edit.append(suggestion.suggestion());
253 253
254 const TemplateURLRef& search_url = template_url->url_ref(); 254 const TemplateURLRef& search_url = template_url->url_ref();
255 DCHECK(search_url.SupportsReplacement(search_terms_data)); 255 DCHECK(search_url.SupportsReplacement(search_terms_data));
256 match.search_terms_args.reset( 256 match.search_terms_args.reset(
257 new TemplateURLRef::SearchTermsArgs(suggestion.suggestion())); 257 new TemplateURLRef::SearchTermsArgs(suggestion.suggestion()));
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
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 SuggestionDeletionHandlers::iterator it = std::find( 479 SuggestionDeletionHandlers::iterator it = std::find(
480 deletion_handlers_.begin(), deletion_handlers_.end(), handler); 480 deletion_handlers_.begin(), deletion_handlers_.end(), handler);
481 DCHECK(it != deletion_handlers_.end()); 481 DCHECK(it != deletion_handlers_.end());
482 deletion_handlers_.erase(it); 482 deletion_handlers_.erase(it);
483 } 483 }
OLDNEW
« no previous file with comments | « components/omnibox/answers_cache.cc ('k') | components/omnibox/search_suggestion_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698