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

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

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 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
« no previous file with comments | « components/omnibox/browser/omnibox_field_trial_unittest.cc ('k') | components/search.gypi » ('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 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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 (matches_.size() < AutocompleteResult::kMaxMatches); 996 (matches_.size() < AutocompleteResult::kMaxMatches);
997 ++i) { 997 ++i) {
998 // SEARCH_OTHER_ENGINE is only used in the SearchProvider for the keyword 998 // SEARCH_OTHER_ENGINE is only used in the SearchProvider for the keyword
999 // verbatim result, so this condition basically means "if this match is a 999 // verbatim result, so this condition basically means "if this match is a
1000 // suggestion of some sort". 1000 // suggestion of some sort".
1001 if ((i->type != AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED) && 1001 if ((i->type != AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED) &&
1002 (i->type != AutocompleteMatchType::SEARCH_OTHER_ENGINE)) { 1002 (i->type != AutocompleteMatchType::SEARCH_OTHER_ENGINE)) {
1003 // If we've already hit the limit on non-server-scored suggestions, and 1003 // If we've already hit the limit on non-server-scored suggestions, and
1004 // this isn't a server-scored suggestion we can add, skip it. 1004 // this isn't a server-scored suggestion we can add, skip it.
1005 if ((num_suggestions >= kMaxMatches) && 1005 if ((num_suggestions >= kMaxMatches) &&
1006 (!chrome::IsInstantExtendedAPIEnabled() || 1006 (!search::IsInstantExtendedAPIEnabled() ||
1007 (i->GetAdditionalInfo(kRelevanceFromServerKey) != kTrue))) { 1007 (i->GetAdditionalInfo(kRelevanceFromServerKey) != kTrue))) {
1008 continue; 1008 continue;
1009 } 1009 }
1010 1010
1011 ++num_suggestions; 1011 ++num_suggestions;
1012 } 1012 }
1013 1013
1014 matches_.push_back(*i); 1014 matches_.push_back(*i);
1015 } 1015 }
1016 UMA_HISTOGRAM_TIMES("Omnibox.SearchProvider.ConvertResultsTime", 1016 UMA_HISTOGRAM_TIMES("Omnibox.SearchProvider.ConvertResultsTime",
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) 1496 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i)
1497 matches.push_back(i->second); 1497 matches.push_back(i->second);
1498 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); 1498 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant);
1499 1499
1500 // If there is a top scoring entry, find the corresponding answer. 1500 // If there is a top scoring entry, find the corresponding answer.
1501 if (!matches.empty()) 1501 if (!matches.empty())
1502 return answers_cache_.GetTopAnswerEntry(matches[0].contents); 1502 return answers_cache_.GetTopAnswerEntry(matches[0].contents);
1503 1503
1504 return AnswersQueryData(); 1504 return AnswersQueryData();
1505 } 1505 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_field_trial_unittest.cc ('k') | components/search.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698