diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-29 19:59:08 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-29 19:59:08 +0000 |
commit | b4cebf87816cde49f6d4991ffa254e5ead97703b (patch) | |
tree | fb12e4b464a43af846f30bbd0dbe9484150373b0 /chrome/browser/autocomplete/search_provider.cc | |
parent | 45ce59f19161b517c04a4e3bcd0890b938382b06 (diff) | |
download | chromium_src-b4cebf87816cde49f6d4991ffa254e5ead97703b.zip chromium_src-b4cebf87816cde49f6d4991ffa254e5ead97703b.tar.gz chromium_src-b4cebf87816cde49f6d4991ffa254e5ead97703b.tar.bz2 |
Change the signature of JSONReader::Read() and related
methods to be more friendly to use with scoped_ptr. Change
all the callsites.
Review URL: http://codereview.chromium.org/16270
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/search_provider.cc')
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 32c2fb2..17bdcc8 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -129,13 +129,14 @@ void SearchProvider::OnURLFetchComplete(const URLFetcher* source, } } - JSONStringValueSerializer deserializer(json_data); - deserializer.set_allow_trailing_comma(true); - Value* root_val = NULL; - have_suggest_results_ = status.is_success() && (response_code == 200) && - deserializer.Deserialize(&root_val, NULL) && - ParseSuggestResults(root_val); - delete root_val; + if (status.is_success() && response_code == 200) { + JSONStringValueSerializer deserializer(json_data); + deserializer.set_allow_trailing_comma(true); + scoped_ptr<Value> root_val(deserializer.Deserialize(NULL)); + have_suggest_results_ = + root_val.get() && ParseSuggestResults(root_val.get()); + } + ConvertResultsToAutocompleteMatches(); listener_->OnProviderUpdate(!suggest_results_.empty()); } |