summaryrefslogtreecommitdiffstats
path: root/chrome/common/cloud_print
diff options
context:
space:
mode:
authornoamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-21 05:30:18 +0000
committernoamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-21 05:30:18 +0000
commitdd7eb7777ead61d494f9ceeb6a1a95a04d74eff8 (patch)
treecf72e8b79fdcb36bb6ae50f1aba94e5c3ee4ecb9 /chrome/common/cloud_print
parent9c0f72cf015d527e6ff9044bad2465abd1712a7b (diff)
downloadchromium_src-dd7eb7777ead61d494f9ceeb6a1a95a04d74eff8.zip
chromium_src-dd7eb7777ead61d494f9ceeb6a1a95a04d74eff8.tar.gz
chromium_src-dd7eb7777ead61d494f9ceeb6a1a95a04d74eff8.tar.bz2
Fixed leak of TestRequestContextGetter in CloudPrintURLFetcherNoServiceProcess (part of the test).
Fixed leak of DictionaryValue in CloudPrintURLFetcher. BUG=177206 Review URL: https://chromiumcodereview.appspot.com/12316012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/cloud_print')
-rw-r--r--chrome/common/cloud_print/cloud_print_helpers.cc24
-rw-r--r--chrome/common/cloud_print/cloud_print_helpers.h10
2 files changed, 17 insertions, 17 deletions
diff --git a/chrome/common/cloud_print/cloud_print_helpers.cc b/chrome/common/cloud_print/cloud_print_helpers.cc
index 7a25c08..84e4320 100644
--- a/chrome/common/cloud_print/cloud_print_helpers.cc
+++ b/chrome/common/cloud_print/cloud_print_helpers.cc
@@ -170,24 +170,22 @@ GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url,
return cloud_print_server_url.ReplaceComponents(replacements);
}
-bool ParseResponseJSON(const std::string& response_data,
- bool* succeeded,
- DictionaryValue** response_dict) {
- scoped_ptr<Value> message_value(base::JSONReader::Read(response_data));
+scoped_ptr<base::DictionaryValue> ParseResponseJSON(
+ const std::string& response_data,
+ bool* succeeded) {
+ scoped_ptr<base::Value> message_value(base::JSONReader::Read(response_data));
if (!message_value.get())
- return false;
+ return scoped_ptr<base::DictionaryValue>();
- if (!message_value->IsType(Value::TYPE_DICTIONARY))
- return false;
+ if (!message_value->IsType(base::Value::TYPE_DICTIONARY))
+ return scoped_ptr<base::DictionaryValue>();
- scoped_ptr<DictionaryValue> response_dict_local(
- static_cast<DictionaryValue*>(message_value.release()));
+ scoped_ptr<base::DictionaryValue> response_dict(
+ static_cast<base::DictionaryValue*>(message_value.release()));
if (succeeded &&
- !response_dict_local->GetBoolean(kSuccessValue, succeeded))
+ !response_dict->GetBoolean(kSuccessValue, succeeded))
*succeeded = false;
- if (response_dict)
- *response_dict = response_dict_local.release();
- return true;
+ return response_dict.Pass();
}
void AddMultipartValueForUpload(const std::string& value_name,
diff --git a/chrome/common/cloud_print/cloud_print_helpers.h b/chrome/common/cloud_print/cloud_print_helpers.h
index abbf092..71bd9b6 100644
--- a/chrome/common/cloud_print/cloud_print_helpers.h
+++ b/chrome/common/cloud_print/cloud_print_helpers.h
@@ -9,6 +9,8 @@
#include <string>
#include <vector>
+#include "base/memory/scoped_ptr.h"
+
class GURL;
namespace base {
@@ -54,12 +56,12 @@ GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url,
const std::string& proxy_id);
// Parses the response data for any cloud print server request. The method
-// returns false if there was an error in parsing the JSON. The succeeded
+// returns null if there was an error in parsing the JSON. The succeeded
// value returns the value of the "success" value in the response JSON.
// Returns the response as a dictionary value.
-bool ParseResponseJSON(const std::string& response_data,
- bool* succeeded,
- base::DictionaryValue** response_dict);
+scoped_ptr<base::DictionaryValue> ParseResponseJSON(
+ const std::string& response_data,
+ bool* succeeded);
// Prepares one value as part of a multi-part upload request.
void AddMultipartValueForUpload(const std::string& value_name,