| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 // static | 115 // static |
| 116 const int SearchProvider::kDefaultProviderURLFetcherID = 1; | 116 const int SearchProvider::kDefaultProviderURLFetcherID = 1; |
| 117 // static | 117 // static |
| 118 const int SearchProvider::kKeywordProviderURLFetcherID = 2; | 118 const int SearchProvider::kKeywordProviderURLFetcherID = 2; |
| 119 // static | 119 // static |
| 120 bool SearchProvider::query_suggest_immediately_ = false; | 120 bool SearchProvider::query_suggest_immediately_ = false; |
| 121 | 121 |
| 122 SearchProvider::SearchProvider(AutocompleteProviderListener* listener, | 122 SearchProvider::SearchProvider(AutocompleteProviderListener* listener, |
| 123 Profile* profile) | 123 Profile* profile) |
| 124 : AutocompleteProvider(listener, profile, "Search"), | 124 : AutocompleteProvider(listener, profile, |
| 125 AutocompleteProvider::TYPE_SEARCH), |
| 125 providers_(TemplateURLServiceFactory::GetForProfile(profile)), | 126 providers_(TemplateURLServiceFactory::GetForProfile(profile)), |
| 126 suggest_results_pending_(0), | 127 suggest_results_pending_(0), |
| 127 suggest_field_trial_group_number_( | 128 suggest_field_trial_group_number_( |
| 128 AutocompleteFieldTrial::GetSuggestNumberOfGroups()), | 129 AutocompleteFieldTrial::GetSuggestNumberOfGroups()), |
| 129 has_suggested_relevance_(false), | 130 has_suggested_relevance_(false), |
| 130 verbatim_relevance_(-1), | 131 verbatim_relevance_(-1), |
| 131 have_suggest_results_(false), | 132 have_suggest_results_(false), |
| 132 instant_finalized_(false) { | 133 instant_finalized_(false) { |
| 133 // Above, we default |suggest_field_trial_group_number_| to the number of | 134 // Above, we default |suggest_field_trial_group_number_| to the number of |
| 134 // groups to mean "not in field trial." Field trial groups run from 0 to | 135 // groups to mean "not in field trial." Field trial groups run from 0 to |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 return match; | 1233 return match; |
| 1233 } | 1234 } |
| 1234 | 1235 |
| 1235 void SearchProvider::UpdateDone() { | 1236 void SearchProvider::UpdateDone() { |
| 1236 // We're done when the timer isn't running, there are no suggest queries | 1237 // We're done when the timer isn't running, there are no suggest queries |
| 1237 // pending, and we're not waiting on instant. | 1238 // pending, and we're not waiting on instant. |
| 1238 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && | 1239 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && |
| 1239 (instant_finalized_ || | 1240 (instant_finalized_ || |
| 1240 !InstantController::IsSuggestEnabled(profile_))); | 1241 !InstantController::IsSuggestEnabled(profile_))); |
| 1241 } | 1242 } |
| OLD | NEW |