| 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 |
| 127 void BaseSearchProvider::Stop(bool clear_cached_results) { | 141 void BaseSearchProvider::Stop(bool clear_cached_results) { |
| 128 StopSuggest(); | 142 StopSuggest(); |
| 129 done_ = true; | 143 done_ = true; |
| 130 | 144 |
| 131 if (clear_cached_results) | 145 if (clear_cached_results) |
| 132 ClearAllResults(); | 146 ClearAllResults(); |
| 133 } | 147 } |
| 134 | 148 |
| 135 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { | 149 void BaseSearchProvider::DeleteMatch(const AutocompleteMatch& match) { |
| 136 DCHECK(match.deletable); | 150 DCHECK(match.deletable); |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 } | 893 } |
| 880 | 894 |
| 881 void BaseSearchProvider::OnDeletionComplete( | 895 void BaseSearchProvider::OnDeletionComplete( |
| 882 bool success, SuggestionDeletionHandler* handler) { | 896 bool success, SuggestionDeletionHandler* handler) { |
| 883 RecordDeletionResult(success); | 897 RecordDeletionResult(success); |
| 884 SuggestionDeletionHandlers::iterator it = std::find( | 898 SuggestionDeletionHandlers::iterator it = std::find( |
| 885 deletion_handlers_.begin(), deletion_handlers_.end(), handler); | 899 deletion_handlers_.begin(), deletion_handlers_.end(), handler); |
| 886 DCHECK(it != deletion_handlers_.end()); | 900 DCHECK(it != deletion_handlers_.end()); |
| 887 deletion_handlers_.erase(it); | 901 deletion_handlers_.erase(it); |
| 888 } | 902 } |
| OLD | NEW |