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

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

Issue 10879043: Centralize logic around Instant modes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a few more style nits Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete/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 (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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 // 5th element: Optional key-value pairs from the Suggest server. 681 // 5th element: Optional key-value pairs from the Suggest server.
682 ListValue* types = NULL; 682 ListValue* types = NULL;
683 ListValue* relevances = NULL; 683 ListValue* relevances = NULL;
684 DictionaryValue* extras = NULL; 684 DictionaryValue* extras = NULL;
685 if (root_list->GetDictionary(4, &extras)) { 685 if (root_list->GetDictionary(4, &extras)) {
686 extras->GetList("google:suggesttype", &types); 686 extras->GetList("google:suggesttype", &types);
687 687
688 // Only accept relevance suggestions if Instant is disabled. 688 // Only accept relevance suggestions if Instant is disabled.
689 if (!is_keyword && !InstantController::IsEnabled(profile_)) { 689 if (!is_keyword && !InstantController::IsSuggestEnabled(profile_)) {
690 // Discard this list if its size does not match that of the suggestions. 690 // Discard this list if its size does not match that of the suggestions.
691 if (extras->GetList("google:suggestrelevance", &relevances) && 691 if (extras->GetList("google:suggestrelevance", &relevances) &&
692 relevances->GetSize() != results->GetSize()) 692 relevances->GetSize() != results->GetSize())
693 relevances = NULL; 693 relevances = NULL;
694 694
695 extras->GetInteger("google:verbatimrelevance", &verbatim_relevance_); 695 extras->GetInteger("google:verbatimrelevance", &verbatim_relevance_);
696 } 696 }
697 } 697 }
698 698
699 SuggestResults* suggest_results = 699 SuggestResults* suggest_results =
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 match.description = navigation.description(); 1229 match.description = navigation.description();
1230 AutocompleteMatch::ClassifyMatchInString(input, match.description, 1230 AutocompleteMatch::ClassifyMatchInString(input, match.description,
1231 ACMatchClassification::NONE, &match.description_class); 1231 ACMatchClassification::NONE, &match.description_class);
1232 return match; 1232 return match;
1233 } 1233 }
1234 1234
1235 void SearchProvider::UpdateDone() { 1235 void SearchProvider::UpdateDone() {
1236 // We're done when the timer isn't running, there are no suggest queries 1236 // We're done when the timer isn't running, there are no suggest queries
1237 // pending, and we're not waiting on instant. 1237 // pending, and we're not waiting on instant.
1238 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && 1238 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) &&
1239 (instant_finalized_ || !InstantController::IsEnabled(profile_))); 1239 (instant_finalized_ ||
1240 !InstantController::IsSuggestEnabled(profile_)));
1240 } 1241 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698