OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/base_search_provider.h" | 5 #include "chrome/browser/autocomplete/base_search_provider.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 field_trial_triggered_(false), | 117 field_trial_triggered_(false), |
118 field_trial_triggered_in_session_(false), | 118 field_trial_triggered_in_session_(false), |
119 suggest_results_pending_(0) { | 119 suggest_results_pending_(0) { |
120 } | 120 } |
121 | 121 |
122 // static | 122 // static |
123 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { | 123 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { |
124 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; | 124 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; |
125 } | 125 } |
126 | 126 |
127 // static | |
128 AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion( | |
129 const base::string16& suggestion, | |
130 AutocompleteMatchType::Type type, | |
131 bool from_keyword_provider, | |
132 const TemplateURL* template_url) { | |
133 return CreateSearchSuggestion( | |
134 NULL, AutocompleteInput(), BaseSearchProvider::SuggestResult( | |
135 suggestion, type, suggestion, base::string16(), base::string16(), | |
136 std::string(), std::string(), from_keyword_provider, 0, false, false, | |
137 base::string16()), | |
138 template_url, 0, 0, false); | |
139 } | |
140 | |
141 void BaseSearchProvider::Stop(bool clear_cached_results) { | 127 void BaseSearchProvider::Stop(bool clear_cached_results) { |
142 StopSuggest(); | 128 StopSuggest(); |
143 done_ = true; | 129 done_ = true; |
144 | 130 |
145 if (clear_cached_results) | 131 if (clear_cached_results) |
146 ClearAllResults(); | 132 ClearAllResults(); |
147 } | 133 } |
148 | 134 |
149 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { | 135 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { |
150 DCHECK(match.deletable); | 136 DCHECK(match.deletable); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 } | 879 } |
894 | 880 |
895 void BaseSearchProvider::OnDeletionComplete( | 881 void BaseSearchProvider::OnDeletionComplete( |
896 bool success, SuggestionDeletionHandler* handler) { | 882 bool success, SuggestionDeletionHandler* handler) { |
897 RecordDeletionResult(success); | 883 RecordDeletionResult(success); |
898 SuggestionDeletionHandlers::iterator it = std::find( | 884 SuggestionDeletionHandlers::iterator it = std::find( |
899 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 885 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
900 DCHECK(it != deletion_handlers_.end()); | 886 DCHECK(it != deletion_handlers_.end()); |
901 deletion_handlers_.erase(it); | 887 deletion_handlers_.erase(it); |
902 } | 888 } |
OLD | NEW |