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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 field_trial_triggered_(false), | 116 field_trial_triggered_(false), |
117 field_trial_triggered_in_session_(false), | 117 field_trial_triggered_in_session_(false), |
118 suggest_results_pending_(0) { | 118 suggest_results_pending_(0) { |
119 } | 119 } |
120 | 120 |
121 // static | 121 // static |
122 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { | 122 bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) { |
123 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; | 123 return match.GetAdditionalInfo(kShouldPrefetchKey) == kTrue; |
124 } | 124 } |
125 | 125 |
126 // static | |
127 AutocompleteMatch BaseSearchProvider::CreateSearchSuggestion( | |
128 const base::string16& suggestion, | |
129 AutocompleteMatchType::Type type, | |
130 const base::string16& match_contents, | |
Peter Kasting
2014/03/24 21:53:07
You don't seem to use this arg?
Anuj
2014/03/25 06:32:05
Done.
| |
131 bool from_keyword_provider, | |
132 const TemplateURL* template_url) { | |
133 return CreateSearchSuggestion( | |
134 NULL, | |
135 AutocompleteInput(), | |
136 BaseSearchProvider::SuggestResult( | |
137 suggestion, | |
138 type, | |
139 suggestion, | |
140 base::string16(), // Omit match_contents_prefix. | |
141 base::string16(), | |
142 std::string(), // Omit suggest_query_params. | |
143 std::string(), // Omit deletion_url. | |
144 from_keyword_provider, | |
145 0, // Ignore relevance. | |
146 false, // Ignore relevance_from_server. | |
147 false, // Ignore should_prefetch. | |
148 base::string16()), // Omit input_test. | |
149 template_url, | |
150 0, // accepted_suggestion | |
151 0, // omnibox_start_margin, | |
152 false); | |
Peter Kasting
2014/03/24 21:53:07
Nit: Let's go ahead and omit the EOL comments and
Anuj
2014/03/25 06:32:05
Done.
| |
153 } | |
154 | |
126 void BaseSearchProvider::Stop(bool clear_cached_results) { | 155 void BaseSearchProvider::Stop(bool clear_cached_results) { |
127 StopSuggest(); | 156 StopSuggest(); |
128 done_ = true; | 157 done_ = true; |
129 | 158 |
130 if (clear_cached_results) | 159 if (clear_cached_results) |
131 ClearAllResults(); | 160 ClearAllResults(); |
132 } | 161 } |
133 | 162 |
134 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { | 163 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { |
135 DCHECK(match.deletable); | 164 DCHECK(match.deletable); |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
872 } | 901 } |
873 | 902 |
874 void BaseSearchProvider::OnDeletionComplete( | 903 void BaseSearchProvider::OnDeletionComplete( |
875 bool success, SuggestionDeletionHandler* handler) { | 904 bool success, SuggestionDeletionHandler* handler) { |
876 RecordDeletionResult(success); | 905 RecordDeletionResult(success); |
877 SuggestionDeletionHandlers::iterator it = std::find( | 906 SuggestionDeletionHandlers::iterator it = std::find( |
878 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 907 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
879 DCHECK(it != deletion_handlers_.end()); | 908 DCHECK(it != deletion_handlers_.end()); |
880 deletion_handlers_.erase(it); | 909 deletion_handlers_.erase(it); |
881 } | 910 } |
OLD | NEW |