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

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

Issue 598253002: Revert of [AiS] Merge answers into highest-scoring result (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@top-hit
Patch Set: Created 6 years, 3 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/components_tests.gyp ('k') | components/omnibox/base_search_provider_unittest.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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // is sufficiently relevant that the user is likely to choose it. 413 // is sufficiently relevant that the user is likely to choose it.
414 // Surely setting the prefetch bit on a match of even higher relevance 414 // Surely setting the prefetch bit on a match of even higher relevance
415 // won't violate this assumption. 415 // won't violate this assumption.
416 should_prefetch |= ShouldPrefetch(i.first->second); 416 should_prefetch |= ShouldPrefetch(i.first->second);
417 i.first->second.RecordAdditionalInfo(kShouldPrefetchKey, 417 i.first->second.RecordAdditionalInfo(kShouldPrefetchKey,
418 should_prefetch ? kTrue : kFalse); 418 should_prefetch ? kTrue : kFalse);
419 if (should_prefetch) 419 if (should_prefetch)
420 i.first->second.RecordAdditionalInfo(kSuggestMetadataKey, metadata); 420 i.first->second.RecordAdditionalInfo(kSuggestMetadataKey, metadata);
421 } 421 }
422 } 422 }
423 // Copy over answer data from lower-ranking item, if necessary.
424 // This depends on the lower-ranking item always being added last - see
425 // use of push_back above.
426 AutocompleteMatch& more_relevant_match = i.first->second;
427 const AutocompleteMatch& less_relevant_match =
428 more_relevant_match.duplicate_matches.back();
429 if (!less_relevant_match.answer_type.empty() &&
430 more_relevant_match.answer_type.empty()) {
431 more_relevant_match.answer_type = less_relevant_match.answer_type;
432 more_relevant_match.answer_contents = less_relevant_match.answer_contents;
433 }
434 } 423 }
435 } 424 }
436 425
437 bool BaseSearchProvider::ParseSuggestResults( 426 bool BaseSearchProvider::ParseSuggestResults(
438 const base::Value& root_val, 427 const base::Value& root_val,
439 int default_result_relevance, 428 int default_result_relevance,
440 bool is_keyword_result, 429 bool is_keyword_result,
441 SearchSuggestionParser::Results* results) { 430 SearchSuggestionParser::Results* results) {
442 if (!SearchSuggestionParser::ParseSuggestResults( 431 if (!SearchSuggestionParser::ParseSuggestResults(
443 root_val, GetInput(is_keyword_result), 432 root_val, GetInput(is_keyword_result),
(...skipping 27 matching lines...) Expand all
471 } 460 }
472 461
473 void BaseSearchProvider::OnDeletionComplete( 462 void BaseSearchProvider::OnDeletionComplete(
474 bool success, SuggestionDeletionHandler* handler) { 463 bool success, SuggestionDeletionHandler* handler) {
475 RecordDeletionResult(success); 464 RecordDeletionResult(success);
476 SuggestionDeletionHandlers::iterator it = std::find( 465 SuggestionDeletionHandlers::iterator it = std::find(
477 deletion_handlers_.begin(), deletion_handlers_.end(), handler); 466 deletion_handlers_.begin(), deletion_handlers_.end(), handler);
478 DCHECK(it != deletion_handlers_.end()); 467 DCHECK(it != deletion_handlers_.end());
479 deletion_handlers_.erase(it); 468 deletion_handlers_.erase(it);
480 } 469 }
OLDNEW
« no previous file with comments | « components/components_tests.gyp ('k') | components/omnibox/base_search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698