| 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 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 bool is_keyword_results = (source == keyword_fetcher_.get()); | 179 bool is_keyword_results = (source == keyword_fetcher_.get()); |
| 180 SuggestResults* suggest_results = is_keyword_results ? | 180 SuggestResults* suggest_results = is_keyword_results ? |
| 181 &keyword_suggest_results_ : &default_suggest_results_; | 181 &keyword_suggest_results_ : &default_suggest_results_; |
| 182 | 182 |
| 183 if (status.is_success() && response_code == 200) { | 183 if (status.is_success() && response_code == 200) { |
| 184 JSONStringValueSerializer deserializer(json_data); | 184 JSONStringValueSerializer deserializer(json_data); |
| 185 deserializer.set_allow_trailing_comma(true); | 185 deserializer.set_allow_trailing_comma(true); |
| 186 scoped_ptr<Value> root_val(deserializer.Deserialize(NULL)); | 186 scoped_ptr<Value> root_val(deserializer.Deserialize(NULL, NULL)); |
| 187 const std::wstring& input_text = | 187 const std::wstring& input_text = |
| 188 is_keyword_results ? keyword_input_text_ : input_.text(); | 188 is_keyword_results ? keyword_input_text_ : input_.text(); |
| 189 have_suggest_results_ = | 189 have_suggest_results_ = |
| 190 root_val.get() && | 190 root_val.get() && |
| 191 ParseSuggestResults(root_val.get(), is_keyword_results, input_text, | 191 ParseSuggestResults(root_val.get(), is_keyword_results, input_text, |
| 192 suggest_results); | 192 suggest_results); |
| 193 } | 193 } |
| 194 | 194 |
| 195 ConvertResultsToAutocompleteMatches(); | 195 ConvertResultsToAutocompleteMatches(); |
| 196 listener_->OnProviderUpdate(!suggest_results->empty()); | 196 listener_->OnProviderUpdate(!suggest_results->empty()); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 // values preserve that property. Otherwise, if the user starts editing a | 754 // values preserve that property. Otherwise, if the user starts editing a |
| 755 // suggestion, non-Search results will suddenly appear. | 755 // suggestion, non-Search results will suddenly appear. |
| 756 if (input_.type() == AutocompleteInput::FORCED_QUERY) | 756 if (input_.type() == AutocompleteInput::FORCED_QUERY) |
| 757 match.fill_into_edit.assign(L"?"); | 757 match.fill_into_edit.assign(L"?"); |
| 758 match.fill_into_edit.append(match.contents); | 758 match.fill_into_edit.append(match.contents); |
| 759 // TODO(pkasting): http://b/1112879 These should perhaps be | 759 // TODO(pkasting): http://b/1112879 These should perhaps be |
| 760 // inline-autocompletable? | 760 // inline-autocompletable? |
| 761 | 761 |
| 762 return match; | 762 return match; |
| 763 } | 763 } |
| OLD | NEW |