| OLD | NEW |
| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 } | 693 } |
| 694 | 694 |
| 695 // 5th element: Optional key-value pairs from the Suggest server. | 695 // 5th element: Optional key-value pairs from the Suggest server. |
| 696 ListValue* types = NULL; | 696 ListValue* types = NULL; |
| 697 ListValue* relevances = NULL; | 697 ListValue* relevances = NULL; |
| 698 DictionaryValue* extras = NULL; | 698 DictionaryValue* extras = NULL; |
| 699 if (root_list->GetDictionary(4, &extras)) { | 699 if (root_list->GetDictionary(4, &extras)) { |
| 700 extras->GetList("google:suggesttype", &types); | 700 extras->GetList("google:suggesttype", &types); |
| 701 | 701 |
| 702 // Only accept relevance suggestions if Instant is disabled. | 702 // Only accept relevance suggestions if Instant is disabled. |
| 703 if (!is_keyword && !InstantController::IsSuggestEnabled(profile_)) { | 703 if (!is_keyword && !InstantController::IsInstantEnabled(profile_)) { |
| 704 // Discard this list if its size does not match that of the suggestions. | 704 // Discard this list if its size does not match that of the suggestions. |
| 705 if (extras->GetList("google:suggestrelevance", &relevances) && | 705 if (extras->GetList("google:suggestrelevance", &relevances) && |
| 706 relevances->GetSize() != results->GetSize()) | 706 relevances->GetSize() != results->GetSize()) |
| 707 relevances = NULL; | 707 relevances = NULL; |
| 708 | 708 |
| 709 extras->GetInteger("google:verbatimrelevance", &verbatim_relevance_); | 709 extras->GetInteger("google:verbatimrelevance", &verbatim_relevance_); |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 SuggestResults* suggest_results = | 713 SuggestResults* suggest_results = |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 AutocompleteMatch::ClassifyMatchInString(input, match.description, | 1251 AutocompleteMatch::ClassifyMatchInString(input, match.description, |
| 1252 ACMatchClassification::NONE, &match.description_class); | 1252 ACMatchClassification::NONE, &match.description_class); |
| 1253 return match; | 1253 return match; |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 void SearchProvider::UpdateDone() { | 1256 void SearchProvider::UpdateDone() { |
| 1257 // We're done when the timer isn't running, there are no suggest queries | 1257 // We're done when the timer isn't running, there are no suggest queries |
| 1258 // pending, and we're not waiting on instant. | 1258 // pending, and we're not waiting on instant. |
| 1259 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && | 1259 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && |
| 1260 (instant_finalized_ || | 1260 (instant_finalized_ || |
| 1261 !InstantController::IsSuggestEnabled(profile_))); | 1261 !InstantController::IsInstantEnabled(profile_))); |
| 1262 } | 1262 } |
| OLD | NEW |