| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/google_util.h" | 10 #include "chrome/browser/google_util.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (CodepageToWide(data, charset.c_str(), | 126 if (CodepageToWide(data, charset.c_str(), |
| 127 OnStringUtilConversionError::FAIL, &wide_data)) | 127 OnStringUtilConversionError::FAIL, &wide_data)) |
| 128 json_data = WideToUTF8(wide_data); | 128 json_data = WideToUTF8(wide_data); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 JSONStringValueSerializer deserializer(json_data); | 132 JSONStringValueSerializer deserializer(json_data); |
| 133 deserializer.set_allow_trailing_comma(true); | 133 deserializer.set_allow_trailing_comma(true); |
| 134 Value* root_val = NULL; | 134 Value* root_val = NULL; |
| 135 have_suggest_results_ = status.is_success() && (response_code == 200) && | 135 have_suggest_results_ = status.is_success() && (response_code == 200) && |
| 136 deserializer.Deserialize(&root_val) && ParseSuggestResults(root_val); | 136 deserializer.Deserialize(&root_val, NULL) && |
| 137 ParseSuggestResults(root_val); |
| 137 delete root_val; | 138 delete root_val; |
| 138 ConvertResultsToAutocompleteMatches(); | 139 ConvertResultsToAutocompleteMatches(); |
| 139 listener_->OnProviderUpdate(!suggest_results_.empty()); | 140 listener_->OnProviderUpdate(!suggest_results_.empty()); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void SearchProvider::StartOrStopHistoryQuery(bool minimal_changes) { | 143 void SearchProvider::StartOrStopHistoryQuery(bool minimal_changes) { |
| 143 // For the minimal_changes case, if we finished the previous query and still | 144 // For the minimal_changes case, if we finished the previous query and still |
| 144 // have its results, or are allowed to keep running it, just do that, rather | 145 // have its results, or are allowed to keep running it, just do that, rather |
| 145 // than starting a new query. | 146 // than starting a new query. |
| 146 if (minimal_changes && | 147 if (minimal_changes && |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 const size_t after_slashes = std::min(url->length(), | 604 const size_t after_slashes = std::min(url->length(), |
| 604 static_cast<size_t>(scheme.end() + 3)); | 605 static_cast<size_t>(scheme.end() + 3)); |
| 605 while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/')) | 606 while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/')) |
| 606 ++prefix_len; | 607 ++prefix_len; |
| 607 if (prefix_len == url->length()) | 608 if (prefix_len == url->length()) |
| 608 url->clear(); | 609 url->clear(); |
| 609 else | 610 else |
| 610 url->erase(url->begin(), url->begin() + prefix_len); | 611 url->erase(url->begin(), url->begin() + prefix_len); |
| 611 return prefix_len; | 612 return prefix_len; |
| 612 } | 613 } |
| OLD | NEW |