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

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

Issue 10274023: Omnibox SearchProvider Experiment Client Implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make BestURLPrefix perform case-insensitive comparison. Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (i.IsWord()) { 56 if (i.IsWord()) {
57 if (found_word) 57 if (found_word)
58 return true; 58 return true;
59 found_word = true; 59 found_word = true;
60 } 60 }
61 } 61 }
62 } 62 }
63 return false; 63 return false;
64 } 64 }
65 65
66 }; 66 } // namespace
67 67
68 68
69 // SearchProvider::Providers -------------------------------------------------- 69 // SearchProvider::Providers --------------------------------------------------
70 70
71 SearchProvider::Providers::Providers(TemplateURLService* template_url_service) 71 SearchProvider::Providers::Providers(TemplateURLService* template_url_service)
72 : template_url_service_(template_url_service) { 72 : template_url_service_(template_url_service) {
73 } 73 }
74 74
75 const TemplateURL* SearchProvider::Providers::GetDefaultProviderURL() const { 75 const TemplateURL* SearchProvider::Providers::GetDefaultProviderURL() const {
76 return default_provider_.empty() ? NULL : 76 return default_provider_.empty() ? NULL :
(...skipping 12 matching lines...) Expand all
89 const int SearchProvider::kDefaultProviderURLFetcherID = 1; 89 const int SearchProvider::kDefaultProviderURLFetcherID = 1;
90 // static 90 // static
91 const int SearchProvider::kKeywordProviderURLFetcherID = 2; 91 const int SearchProvider::kKeywordProviderURLFetcherID = 2;
92 // static 92 // static
93 bool SearchProvider::query_suggest_immediately_ = false; 93 bool SearchProvider::query_suggest_immediately_ = false;
94 94
95 SearchProvider::SearchProvider(ACProviderListener* listener, Profile* profile) 95 SearchProvider::SearchProvider(ACProviderListener* listener, Profile* profile)
96 : AutocompleteProvider(listener, profile, "Search"), 96 : AutocompleteProvider(listener, profile, "Search"),
97 providers_(TemplateURLServiceFactory::GetForProfile(profile)), 97 providers_(TemplateURLServiceFactory::GetForProfile(profile)),
98 suggest_results_pending_(0), 98 suggest_results_pending_(0),
99 has_suggested_relevance_(false),
100 verbatim_relevance_(-1),
99 have_suggest_results_(false), 101 have_suggest_results_(false),
100 instant_finalized_(false) { 102 instant_finalized_(false) {
101 // We use GetSuggestNumberOfGroups() as the group ID to mean "not in field 103 // We use GetSuggestNumberOfGroups() as the group ID to mean "not in field
102 // trial." Field trial groups run from 0 to GetSuggestNumberOfGroups() - 1 104 // trial." Field trial groups run from 0 to GetSuggestNumberOfGroups() - 1
103 // (inclusive). 105 // (inclusive).
104 int suggest_field_trial_group_number = 106 int suggest_field_trial_group_number =
105 AutocompleteFieldTrial::GetSuggestNumberOfGroups(); 107 AutocompleteFieldTrial::GetSuggestNumberOfGroups();
106 if (AutocompleteFieldTrial::InSuggestFieldTrial()) { 108 if (AutocompleteFieldTrial::InSuggestFieldTrial()) {
107 suggest_field_trial_group_number = 109 suggest_field_trial_group_number =
108 AutocompleteFieldTrial::GetSuggestGroupNameAsNumber(); 110 AutocompleteFieldTrial::GetSuggestGroupNameAsNumber();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (suggest_results_pending_ == 0) { 303 if (suggest_results_pending_ == 0) {
302 UpdateDone(); 304 UpdateDone();
303 // We only need to update the listener if we're actually done. 305 // We only need to update the listener if we're actually done.
304 if (done_) 306 if (done_)
305 listener_->OnProviderUpdate(false); 307 listener_->OnProviderUpdate(false);
306 } 308 }
307 } 309 }
308 310
309 void SearchProvider::Stop() { 311 void SearchProvider::Stop() {
310 StopSuggest(); 312 StopSuggest();
311 ClearResults();
312 done_ = true; 313 done_ = true;
313 default_provider_suggest_text_.clear(); 314 default_provider_suggest_text_.clear();
314 } 315 }
315 316
316 void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const { 317 void SearchProvider::AddProviderInfo(ProvidersInfo* provider_info) const {
317 provider_info->push_back(metrics::OmniboxEventProto_ProviderInfo()); 318 provider_info->push_back(metrics::OmniboxEventProto_ProviderInfo());
318 metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back(); 319 metrics::OmniboxEventProto_ProviderInfo& new_entry = provider_info->back();
319 new_entry.set_provider(AsOmniboxEventProviderType()); 320 new_entry.set_provider(AsOmniboxEventProviderType());
320 new_entry.set_provider_done(done_); 321 new_entry.set_provider_done(done_);
321 } 322 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // have its results, or are allowed to keep running it, just do that, rather 435 // have its results, or are allowed to keep running it, just do that, rather
435 // than starting a new query. 436 // than starting a new query.
436 if (minimal_changes && 437 if (minimal_changes &&
437 (have_suggest_results_ || 438 (have_suggest_results_ ||
438 (!done_ && 439 (!done_ &&
439 input_.matches_requested() == AutocompleteInput::ALL_MATCHES))) 440 input_.matches_requested() == AutocompleteInput::ALL_MATCHES)))
440 return; 441 return;
441 442
442 // We can't keep running any previous query, so halt it. 443 // We can't keep running any previous query, so halt it.
443 StopSuggest(); 444 StopSuggest();
444 ClearResults(); 445
446 // Remove existing results that cannot inline autocomplete the new input.
447 RemoveStaleResults();
445 448
446 // We can't start a new query if we're only allowed synchronous results. 449 // We can't start a new query if we're only allowed synchronous results.
447 if (input_.matches_requested() != AutocompleteInput::ALL_MATCHES) 450 if (input_.matches_requested() != AutocompleteInput::ALL_MATCHES)
448 return; 451 return;
449 452
450 // We'll have at least one pending fetch. Set it to 1 now, but the value is 453 // We'll have at least one pending fetch. Set it to 1 now, but the value is
451 // correctly set in Run. As Run isn't invoked immediately we need to set this 454 // correctly set in Run. As Run isn't invoked immediately we need to set this
452 // now, else we won't think we're waiting on results from the server when we 455 // now, else we won't think we're waiting on results from the server when we
453 // really are. 456 // really are.
454 suggest_results_pending_ = 1; 457 suggest_results_pending_ = 1;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Stop any in-progress URL fetches. 524 // Stop any in-progress URL fetches.
522 keyword_fetcher_.reset(); 525 keyword_fetcher_.reset();
523 default_fetcher_.reset(); 526 default_fetcher_.reset();
524 } 527 }
525 528
526 void SearchProvider::ClearResults() { 529 void SearchProvider::ClearResults() {
527 keyword_suggest_results_.clear(); 530 keyword_suggest_results_.clear();
528 default_suggest_results_.clear(); 531 default_suggest_results_.clear();
529 keyword_navigation_results_.clear(); 532 keyword_navigation_results_.clear();
530 default_navigation_results_.clear(); 533 default_navigation_results_.clear();
534 has_suggested_relevance_ = false;
535 verbatim_relevance_ = -1;
531 have_suggest_results_ = false; 536 have_suggest_results_ = false;
532 } 537 }
533 538
539 void SearchProvider::RemoveStaleResults() {
540 RemoveStaleSuggestResults(&keyword_suggest_results_, true);
541 RemoveStaleSuggestResults(&default_suggest_results_, false);
542 RemoveStaleNavigationResults(&keyword_navigation_results_, true);
543 RemoveStaleNavigationResults(&default_navigation_results_, false);
544 }
545
546 void SearchProvider::RemoveStaleSuggestResults(SuggestResults* list,
547 bool is_keyword) {
548 const string16& input = is_keyword ? keyword_input_text_ : input_.text();
549 for (SuggestResults::iterator i = list->begin(); i < list->end();)
550 i = StartsWith(i->suggestion(), input, false) ? (i + 1) : list->erase(i);
551 }
552
553 void SearchProvider::RemoveStaleNavigationResults(NavigationResults* list,
554 bool is_keyword) {
555 const string16& input = is_keyword ? keyword_input_text_ : input_.text();
556 for (NavigationResults::iterator i = list->begin(); i < list->end();) {
557 const string16 fill(AutocompleteInput::FormattedStringWithEquivalentMeaning(
558 i->url(), StringForURLDisplay(i->url(), true, false)));
559 i = URLPrefix::BestURLPrefix(fill, input) ? (i + 1) : list->erase(i);
560 }
561 }
562
563 void SearchProvider::ApplyCalculatedRelevance() {
564 ApplyCalculatedSuggestRelevance(&keyword_suggest_results_, true);
565 ApplyCalculatedSuggestRelevance(&default_suggest_results_, false);
566 ApplyCalculatedNavigationRelevance(&keyword_navigation_results_, true);
567 ApplyCalculatedNavigationRelevance(&default_navigation_results_, false);
568 has_suggested_relevance_ = false;
569 verbatim_relevance_ = -1;
570 }
571
572 void SearchProvider::ApplyCalculatedSuggestRelevance(SuggestResults* list,
573 bool is_keyword) {
574 for (size_t i = 0; i < list->size(); ++i) {
575 (*list)[i].set_relevance(CalculateRelevanceForSuggestion(is_keyword) +
576 (list->size() - i - 1));
577 }
578 }
579
580 void SearchProvider::ApplyCalculatedNavigationRelevance(NavigationResults* list,
581 bool is_keyword) {
582 for (size_t i = 0; i < list->size(); ++i) {
583 (*list)[i].set_relevance(CalculateRelevanceForNavigation(is_keyword) +
584 (list->size() - i - 1));
585 }
586 }
587
534 net::URLFetcher* SearchProvider::CreateSuggestFetcher( 588 net::URLFetcher* SearchProvider::CreateSuggestFetcher(
535 int id, 589 int id,
536 const TemplateURLRef& suggestions_url, 590 const TemplateURLRef& suggestions_url,
537 const string16& text) { 591 const string16& text) {
538 DCHECK(suggestions_url.SupportsReplacement()); 592 DCHECK(suggestions_url.SupportsReplacement());
539 net::URLFetcher* fetcher = content::URLFetcher::Create(id, 593 net::URLFetcher* fetcher = content::URLFetcher::Create(id,
540 GURL(suggestions_url.ReplaceSearchTerms(text, 594 GURL(suggestions_url.ReplaceSearchTerms(text,
541 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())), 595 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())),
542 net::URLFetcher::GET, this); 596 net::URLFetcher::GET, this);
543 fetcher->SetRequestContext(profile_->GetRequestContext()); 597 fetcher->SetRequestContext(profile_->GetRequestContext());
(...skipping 13 matching lines...) Expand all
557 if (!root_val->GetAsList(&root_list) || !root_list->GetString(0, &query) || 611 if (!root_val->GetAsList(&root_list) || !root_list->GetString(0, &query) ||
558 (query != input_text) || !root_list->GetList(1, &results)) 612 (query != input_text) || !root_list->GetList(1, &results))
559 return false; 613 return false;
560 614
561 // 3rd element: Description list. 615 // 3rd element: Description list.
562 ListValue* descriptions = NULL; 616 ListValue* descriptions = NULL;
563 root_list->GetList(2, &descriptions); 617 root_list->GetList(2, &descriptions);
564 618
565 // 4th element: Disregard the query URL list for now. 619 // 4th element: Disregard the query URL list for now.
566 620
621 // Reset suggested relevance information from the default provider.
622 if (!is_keyword) {
623 has_suggested_relevance_ = false;
624 verbatim_relevance_ = -1;
625 }
626
567 // 5th element: Optional key-value pairs from the Suggest server. 627 // 5th element: Optional key-value pairs from the Suggest server.
568 ListValue* types = NULL; 628 ListValue* types = NULL;
569 DictionaryValue* dict_val = NULL; 629 ListValue* relevances = NULL;
570 if (root_list->GetDictionary(4, &dict_val)) { 630 DictionaryValue* extras = NULL;
571 // Parse Google Suggest specific type extension. 631 if (root_list->GetDictionary(4, &extras)) {
572 dict_val->GetList("google:suggesttype", &types); 632 extras->GetList("google:suggesttype", &types);
633
634 // Only accept relevance suggestions if Instant is disabled.
635 if (!is_keyword && !InstantController::IsEnabled(profile_)) {
636 // Discard this list if its size does not match that of the suggestions.
637 if (extras->GetList("google:suggestrelevance", &relevances) &&
638 relevances->GetSize() != results->GetSize())
639 relevances = NULL;
640
641 extras->GetInteger("google:verbatimrelevance", &verbatim_relevance_);
642 }
573 } 643 }
574 644
575 SuggestResults* suggest_results = 645 SuggestResults* suggest_results =
576 is_keyword ? &keyword_suggest_results_ : &default_suggest_results_; 646 is_keyword ? &keyword_suggest_results_ : &default_suggest_results_;
577 NavigationResults* navigation_results = 647 NavigationResults* navigation_results =
578 is_keyword ? &keyword_navigation_results_ : &default_navigation_results_; 648 is_keyword ? &keyword_navigation_results_ : &default_navigation_results_;
579 649
580 string16 result; 650 // Clear the previous results now that new results are available.
581 bool results_updated = false; 651 suggest_results->clear();
652 navigation_results->clear();
653
654 string16 result, title;
655 std::string type;
656 int relevance = -1;
582 for (size_t index = 0; results->GetString(index, &result); ++index) { 657 for (size_t index = 0; results->GetString(index, &result); ++index) {
583 // Google search may return empty suggestions for weird input characters, 658 // Google search may return empty suggestions for weird input characters,
584 // they make no sense at all and can cause problems in our code. 659 // they make no sense at all and can cause problems in our code.
585 if (result.empty()) 660 if (result.empty())
586 continue; 661 continue;
587 662
588 std::string type; 663 // Apply valid suggested relevance scores; discard invalid lists.
664 if (relevances != NULL && !relevances->GetInteger(index, &relevance))
665 relevances = NULL;
589 if (types && types->GetString(index, &type) && (type == "NAVIGATION")) { 666 if (types && types->GetString(index, &type) && (type == "NAVIGATION")) {
590 if (navigation_results->size() < kMaxMatches) { 667 // Do not blindly trust the URL coming from the server to be valid.
591 // Do not blindly trust the URL coming from the server to be valid. 668 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(result), std::string()));
592 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(result), std::string())); 669 if (url.is_valid()) {
593 if (url.is_valid()) { 670 if (descriptions != NULL)
594 string16 description; 671 descriptions->GetString(index, &title);
595 if (descriptions != NULL) 672 navigation_results->push_back(NavigationResult(url, title, relevance));
596 descriptions->GetString(index, &description);
597 // Decrement the relevance for successive results to preserve order.
598 int relevance = CalculateRelevanceForNavigation(is_keyword) +
599 (kMaxMatches - navigation_results->size() - 1);
600 navigation_results->push_back(
601 NavigationResult(url, description, relevance));
602 results_updated = true;
603 }
604 } 673 }
605 } else { 674 } else {
606 // TODO(kochi): Currently we treat a calculator result as a query, but it 675 // TODO(kochi): Improve calculator result presentation.
607 // is better to have better presentation for caluculator results. 676 suggest_results->push_back(SuggestResult(result, relevance));
608 if (suggest_results->size() < kMaxMatches) {
609 // Decrement the relevance for successive results to preserve order.
610 int relevance = CalculateRelevanceForSuggestion(is_keyword) +
611 (kMaxMatches - suggest_results->size() - 1);
612 suggest_results->push_back(SuggestResult(result, relevance));
613 results_updated = true;
614 }
615 } 677 }
616 } 678 }
617 679
680 // Apply calculated relevance scores if a valid list was not provided.
681 if (relevances == NULL) {
682 ApplyCalculatedSuggestRelevance(suggest_results, is_keyword);
683 ApplyCalculatedNavigationRelevance(navigation_results, is_keyword);
684 } else if (!is_keyword) {
685 has_suggested_relevance_ = true;
686 }
687
618 have_suggest_results_ = true; 688 have_suggest_results_ = true;
619 return results_updated; 689 return true;
620 } 690 }
621 691
622 void SearchProvider::ConvertResultsToAutocompleteMatches() { 692 void SearchProvider::ConvertResultsToAutocompleteMatches() {
623 // Convert all the results to matches and add them to a map, so we can keep 693 // Convert all the results to matches and add them to a map, so we can keep
624 // the most relevant match for each result. 694 // the most relevant match for each result.
625 MatchMap map; 695 MatchMap map;
626 const Time no_time; 696 const Time no_time;
627 int did_not_accept_keyword_suggestion = keyword_suggest_results_.empty() ? 697 int did_not_accept_keyword_suggestion = keyword_suggest_results_.empty() ?
628 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE : 698 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE :
629 TemplateURLRef::NO_SUGGESTION_CHOSEN; 699 TemplateURLRef::NO_SUGGESTION_CHOSEN;
630 // Keyword what you typed results are handled by the KeywordProvider. 700 // Keyword what you typed results are handled by the KeywordProvider.
631 701
632 int verbatim_relevance = CalculateRelevanceForWhatYouTyped(); 702 int verbatim_relevance = CalculateRelevanceForWhatYouTyped();
633 int did_not_accept_default_suggestion = default_suggest_results_.empty() ? 703 int did_not_accept_default_suggestion = default_suggest_results_.empty() ?
634 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE : 704 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE :
635 TemplateURLRef::NO_SUGGESTION_CHOSEN; 705 TemplateURLRef::NO_SUGGESTION_CHOSEN;
636 AddMatchToMap(input_.text(), input_.text(), verbatim_relevance, 706 if (verbatim_relevance > 0) {
637 AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, 707 AddMatchToMap(input_.text(), input_.text(), verbatim_relevance,
638 did_not_accept_default_suggestion, false, &map); 708 AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
709 did_not_accept_default_suggestion, false, &map);
710 }
639 const size_t what_you_typed_size = map.size(); 711 const size_t what_you_typed_size = map.size();
640 if (!default_provider_suggest_text_.empty()) { 712 if (!default_provider_suggest_text_.empty()) {
641 AddMatchToMap(input_.text() + default_provider_suggest_text_, 713 AddMatchToMap(input_.text() + default_provider_suggest_text_,
642 input_.text(), verbatim_relevance + 1, 714 input_.text(), verbatim_relevance + 1,
643 AutocompleteMatch::SEARCH_SUGGEST, 715 AutocompleteMatch::SEARCH_SUGGEST,
644 did_not_accept_default_suggestion, false, &map); 716 did_not_accept_default_suggestion, false, &map);
645 } 717 }
646 718
647 AddHistoryResultsToMap(keyword_history_results_, true, 719 AddHistoryResultsToMap(keyword_history_results_, true,
648 did_not_accept_keyword_suggestion, &map); 720 did_not_accept_keyword_suggestion, &map);
(...skipping 12 matching lines...) Expand all
661 AddNavigationResultsToMatches(default_navigation_results_, false); 733 AddNavigationResultsToMatches(default_navigation_results_, false);
662 734
663 // Allow an additional match for "what you typed" if it's present. 735 // Allow an additional match for "what you typed" if it's present.
664 const size_t max_total_matches = kMaxMatches + what_you_typed_size; 736 const size_t max_total_matches = kMaxMatches + what_you_typed_size;
665 std::partial_sort(matches_.begin(), 737 std::partial_sort(matches_.begin(),
666 matches_.begin() + std::min(max_total_matches, matches_.size()), 738 matches_.begin() + std::min(max_total_matches, matches_.size()),
667 matches_.end(), &AutocompleteMatch::MoreRelevant); 739 matches_.end(), &AutocompleteMatch::MoreRelevant);
668 if (matches_.size() > max_total_matches) 740 if (matches_.size() > max_total_matches)
669 matches_.erase(matches_.begin() + max_total_matches, matches_.end()); 741 matches_.erase(matches_.begin() + max_total_matches, matches_.end());
670 742
743 // The top result must be inlinable; apply calculated scores if it is not.
744 if (!matches_.empty() &&
745 (has_suggested_relevance_ || verbatim_relevance_ >= 0) &&
746 (matches_.front().type == AutocompleteMatch::SEARCH_SUGGEST ||
747 matches_.front().type == AutocompleteMatch::NAVSUGGEST) &&
748 matches_.front().inline_autocomplete_offset == string16::npos &&
749 matches_.front().fill_into_edit != input_.text()) {
750 ApplyCalculatedRelevance();
751 ConvertResultsToAutocompleteMatches();
752 }
753
671 UpdateStarredStateOfMatches(); 754 UpdateStarredStateOfMatches();
672 UpdateDone(); 755 UpdateDone();
673 } 756 }
674 757
675 void SearchProvider::AddNavigationResultsToMatches( 758 void SearchProvider::AddNavigationResultsToMatches(
676 const NavigationResults& navigation_results, 759 const NavigationResults& navigation_results,
677 bool is_keyword) { 760 bool is_keyword) {
678 if (!navigation_results.empty()) { 761 if (!navigation_results.empty()) {
679 // TODO(kochi|msw): Add more navigational results if they get more 762 // TODO(kochi|msw): Add more navigational results if they get more
680 // meaningful relevance values; see http://b/1170574. 763 // meaningful relevance values; see http://b/1170574.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 bool is_keyword, 872 bool is_keyword,
790 MatchMap* map) { 873 MatchMap* map) {
791 const string16& input_text = is_keyword ? keyword_input_text_ : input_.text(); 874 const string16& input_text = is_keyword ? keyword_input_text_ : input_.text();
792 for (size_t i = 0; i < results.size(); ++i) { 875 for (size_t i = 0; i < results.size(); ++i) {
793 AddMatchToMap(results[i].suggestion(), input_text, results[i].relevance(), 876 AddMatchToMap(results[i].suggestion(), input_text, results[i].relevance(),
794 AutocompleteMatch::SEARCH_SUGGEST, i, is_keyword, map); 877 AutocompleteMatch::SEARCH_SUGGEST, i, is_keyword, map);
795 } 878 }
796 } 879 }
797 880
798 int SearchProvider::CalculateRelevanceForWhatYouTyped() const { 881 int SearchProvider::CalculateRelevanceForWhatYouTyped() const {
882 if (verbatim_relevance_ >= 0 && !input_.prevent_inline_autocomplete())
883 return verbatim_relevance_;
884
799 if (!providers_.keyword_provider().empty()) 885 if (!providers_.keyword_provider().empty())
800 return 250; 886 return 250;
801 887
802 switch (input_.type()) { 888 switch (input_.type()) {
803 case AutocompleteInput::UNKNOWN: 889 case AutocompleteInput::UNKNOWN:
804 case AutocompleteInput::QUERY: 890 case AutocompleteInput::QUERY:
805 case AutocompleteInput::FORCED_QUERY: 891 case AutocompleteInput::FORCED_QUERY:
806 return 1300; 892 return 1300;
807 893
808 case AutocompleteInput::REQUESTED_URL: 894 case AutocompleteInput::REQUESTED_URL:
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 ACMatchClassification::NONE, &match.description_class); 1110 ACMatchClassification::NONE, &match.description_class);
1025 return match; 1111 return match;
1026 } 1112 }
1027 1113
1028 void SearchProvider::UpdateDone() { 1114 void SearchProvider::UpdateDone() {
1029 // We're done when there are no more suggest queries pending (this is set to 1 1115 // We're done when there are no more suggest queries pending (this is set to 1
1030 // when the timer is started) and we're not waiting on instant. 1116 // when the timer is started) and we're not waiting on instant.
1031 done_ = ((suggest_results_pending_ == 0) && 1117 done_ = ((suggest_results_pending_ == 0) &&
1032 (instant_finalized_ || !InstantController::IsEnabled(profile_))); 1118 (instant_finalized_ || !InstantController::IsEnabled(profile_)));
1033 } 1119 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider.h ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698