| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (default_provider) | 53 if (default_provider) |
| 54 cached_default_provider_ = *default_provider; | 54 cached_default_provider_ = *default_provider; |
| 55 keyword_provider_ = keyword_provider; | 55 keyword_provider_ = keyword_provider; |
| 56 if (keyword_provider) | 56 if (keyword_provider) |
| 57 cached_keyword_provider_ = *keyword_provider; | 57 cached_keyword_provider_ = *keyword_provider; |
| 58 } | 58 } |
| 59 | 59 |
| 60 SearchProvider::SearchProvider(ACProviderListener* listener, Profile* profile) | 60 SearchProvider::SearchProvider(ACProviderListener* listener, Profile* profile) |
| 61 : AutocompleteProvider(listener, profile, "Search"), | 61 : AutocompleteProvider(listener, profile, "Search"), |
| 62 suggest_results_pending_(0), | 62 suggest_results_pending_(0), |
| 63 have_suggest_results_(false), |
| 63 instant_finalized_(false) { | 64 instant_finalized_(false) { |
| 64 } | 65 } |
| 65 | 66 |
| 66 void SearchProvider::FinalizeInstantQuery(const std::wstring& text) { | 67 void SearchProvider::FinalizeInstantQuery(const std::wstring& text) { |
| 67 if (done_ || instant_finalized_) | 68 if (done_ || instant_finalized_) |
| 68 return; | 69 return; |
| 69 | 70 |
| 70 instant_finalized_ = true; | 71 instant_finalized_ = true; |
| 71 UpdateDone(); | 72 UpdateDone(); |
| 72 | 73 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 805 |
| 805 return match; | 806 return match; |
| 806 } | 807 } |
| 807 | 808 |
| 808 void SearchProvider::UpdateDone() { | 809 void SearchProvider::UpdateDone() { |
| 809 // We're done when there are no more suggest queries pending (this is set to 1 | 810 // We're done when there are no more suggest queries pending (this is set to 1 |
| 810 // when the timer is started) and we're not waiting on instant. | 811 // when the timer is started) and we're not waiting on instant. |
| 811 done_ = ((suggest_results_pending_ == 0) && | 812 done_ = ((suggest_results_pending_ == 0) && |
| 812 (instant_finalized_ || !InstantController::IsEnabled(profile_))); | 813 (instant_finalized_ || !InstantController::IsEnabled(profile_))); |
| 813 } | 814 } |
| OLD | NEW |