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

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

Issue 1543803004: Compare case insensitively when copying answers into verbatim matches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/search_provider.h" 5 #include "components/omnibox/browser/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 base::CollapseWhitespace(input_.text(), false); 921 base::CollapseWhitespace(input_.text(), false);
922 922
923 // Verbatim results don't get suggestions and hence, answers. 923 // Verbatim results don't get suggestions and hence, answers.
924 // Scan previous matches if the last answer-bearing suggestion matches 924 // Scan previous matches if the last answer-bearing suggestion matches
925 // verbatim, and if so, copy over answer contents. 925 // verbatim, and if so, copy over answer contents.
926 base::string16 answer_contents; 926 base::string16 answer_contents;
927 base::string16 answer_type; 927 base::string16 answer_type;
928 scoped_ptr<SuggestionAnswer> answer; 928 scoped_ptr<SuggestionAnswer> answer;
929 for (ACMatches::iterator it = matches_.begin(); it != matches_.end(); 929 for (ACMatches::iterator it = matches_.begin(); it != matches_.end();
930 ++it) { 930 ++it) {
931 if (it->answer && it->fill_into_edit == trimmed_verbatim) { 931 if (it->answer &&
932 base::i18n::ToLower(it->fill_into_edit) ==
933 base::i18n::ToLower(trimmed_verbatim)) {
Mark P 2015/12/23 05:28:20 minor nit: consider explicitly creating a trimmed_
Justin Donnelly 2015/12/29 17:24:42 Done.
932 answer_contents = it->answer_contents; 934 answer_contents = it->answer_contents;
933 answer_type = it->answer_type; 935 answer_type = it->answer_type;
934 answer = SuggestionAnswer::copy(it->answer.get()); 936 answer = SuggestionAnswer::copy(it->answer.get());
935 break; 937 break;
936 } 938 }
937 } 939 }
938 940
939 SearchSuggestionParser::SuggestResult verbatim( 941 SearchSuggestionParser::SuggestResult verbatim(
940 trimmed_verbatim, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, 942 trimmed_verbatim, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
941 trimmed_verbatim, base::string16(), base::string16(), answer_contents, 943 trimmed_verbatim, base::string16(), base::string16(), answer_contents,
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) 1505 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i)
1504 matches.push_back(i->second); 1506 matches.push_back(i->second);
1505 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); 1507 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant);
1506 1508
1507 // If there is a top scoring entry, find the corresponding answer. 1509 // If there is a top scoring entry, find the corresponding answer.
1508 if (!matches.empty()) 1510 if (!matches.empty())
1509 return answers_cache_.GetTopAnswerEntry(matches[0].contents); 1511 return answers_cache_.GetTopAnswerEntry(matches[0].contents);
1510 1512
1511 return AnswersQueryData(); 1513 return AnswersQueryData();
1512 } 1514 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698