OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/omnibox/search_provider.h" | 5 #include "components/omnibox/search_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 SearchProvider::SearchProvider( | 122 SearchProvider::SearchProvider( |
123 AutocompleteProviderListener* listener, | 123 AutocompleteProviderListener* listener, |
124 TemplateURLService* template_url_service, | 124 TemplateURLService* template_url_service, |
125 scoped_ptr<AutocompleteProviderClient> client) | 125 scoped_ptr<AutocompleteProviderClient> client) |
126 : BaseSearchProvider(template_url_service, client.Pass(), | 126 : BaseSearchProvider(template_url_service, client.Pass(), |
127 AutocompleteProvider::TYPE_SEARCH), | 127 AutocompleteProvider::TYPE_SEARCH), |
128 listener_(listener), | 128 listener_(listener), |
129 suggest_results_pending_(0), | 129 suggest_results_pending_(0), |
130 providers_(template_url_service), | 130 providers_(template_url_service), |
131 answers_cache_(1) { | 131 answers_cache_(10) { |
132 } | 132 } |
133 | 133 |
134 // static | 134 // static |
135 std::string SearchProvider::GetSuggestMetadata(const AutocompleteMatch& match) { | 135 std::string SearchProvider::GetSuggestMetadata(const AutocompleteMatch& match) { |
136 return match.GetAdditionalInfo(kSuggestMetadataKey); | 136 return match.GetAdditionalInfo(kSuggestMetadataKey); |
137 } | 137 } |
138 | 138 |
139 void SearchProvider::ResetSession() { | 139 void SearchProvider::ResetSession() { |
140 field_trial_triggered_in_session_ = false; | 140 field_trial_triggered_in_session_ = false; |
141 } | 141 } |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 match->fill_into_edit.empty()) | 1329 match->fill_into_edit.empty()) |
1330 return; | 1330 return; |
1331 | 1331 |
1332 // Valid answer encountered, cache it for further queries. | 1332 // Valid answer encountered, cache it for further queries. |
1333 answers_cache_.UpdateRecentAnswers(match->fill_into_edit, match->answer_type); | 1333 answers_cache_.UpdateRecentAnswers(match->fill_into_edit, match->answer_type); |
1334 } | 1334 } |
1335 | 1335 |
1336 void SearchProvider::DoAnswersQuery(const AutocompleteInput& input) { | 1336 void SearchProvider::DoAnswersQuery(const AutocompleteInput& input) { |
1337 prefetch_data_ = answers_cache_.GetTopAnswerEntry(input.text()); | 1337 prefetch_data_ = answers_cache_.GetTopAnswerEntry(input.text()); |
1338 } | 1338 } |
OLD | NEW |