Chromium Code Reviews| Index: components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc |
| diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc |
| index b476f35c6e7644ac638c6f06d13eaf16208aa55c..0378b1930eab27367896668fd461dfc170933a1a 100644 |
| --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc |
| +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_creator.cc |
| @@ -38,12 +38,12 @@ int64 GetExpirationTicks(int bypass_seconds) { |
| // A callback which creates a base::Value containing information about enabling |
| // the Data Reduction Proxy. Ownership of the base::Value is passed to the |
|
eroman
2015/05/21 03:37:42
nit: delete the ownership comment, which is now re
|
| // caller. |
| -base::Value* EnableDataReductionProxyCallback( |
| +scoped_ptr<base::Value> EnableDataReductionProxyCallback( |
| bool secure_transport_restricted, |
| const std::vector<net::ProxyServer>& proxies_for_http, |
| const std::vector<net::ProxyServer>& proxies_for_https, |
| net::NetLogCaptureMode /* capture_mode */) { |
| - base::DictionaryValue* dict = new base::DictionaryValue(); |
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| dict->SetBoolean("enabled", true); |
| dict->SetBoolean("secure_transport_restricted", secure_transport_restricted); |
| scoped_ptr<base::ListValue> http_proxy_list(new base::ListValue()); |
| @@ -57,23 +57,23 @@ base::Value* EnableDataReductionProxyCallback( |
| dict->Set("http_proxy_list", http_proxy_list.Pass()); |
| dict->Set("https_proxy_list", https_proxy_list.Pass()); |
| - return dict; |
| + return dict.Pass(); |
| } |
| // A callback which creates a base::Value containing information about disabling |
| // the Data Reduction Proxy. Ownership of the base::Value is passed to the |
|
eroman
2015/05/21 03:37:42
Same here
|
| // caller. |
| -base::Value* DisableDataReductionProxyCallback( |
| +scoped_ptr<base::Value> DisableDataReductionProxyCallback( |
| net::NetLogCaptureMode /* capture_mode */) { |
| - base::DictionaryValue* dict = new base::DictionaryValue(); |
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| dict->SetBoolean("enabled", false); |
| - return dict; |
| + return dict.Pass(); |
| } |
| // A callback which creates a base::Value containing information about bypassing |
| // the Data Reduction Proxy. Ownership of the base::Value is passed to the |
|
eroman
2015/05/21 03:37:42
Ditto
|
| // caller. |
| -base::Value* UrlBypassActionCallback( |
| +scoped_ptr<base::Value> UrlBypassActionCallback( |
| DataReductionProxyBypassAction action, |
| const std::string& request_method, |
| const GURL& url, |
| @@ -81,7 +81,7 @@ base::Value* UrlBypassActionCallback( |
| int bypass_seconds, |
| int64 expiration_ticks, |
| net::NetLogCaptureMode /* capture_mode */) { |
| - base::DictionaryValue* dict = new base::DictionaryValue(); |
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| dict->SetInteger("bypass_action_type", action); |
| dict->SetString("method", request_method); |
| dict->SetString("url", url.spec()); |
| @@ -89,20 +89,21 @@ base::Value* UrlBypassActionCallback( |
| dict->SetString("bypass_duration_seconds", |
| base::Int64ToString(bypass_seconds)); |
| dict->SetString("expiration", base::Int64ToString(expiration_ticks)); |
| - return dict; |
| + return dict.Pass(); |
| } |
| // A callback which creates a base::Value containing information about bypassing |
| // the Data Reduction Proxy. Ownership of the base::Value is passed to the |
|
eroman
2015/05/21 03:37:42
Same
|
| // caller. |
| -base::Value* UrlBypassTypeCallback(DataReductionProxyBypassType bypass_type, |
| - const std::string& request_method, |
| - const GURL& url, |
| - bool should_retry, |
| - int bypass_seconds, |
| - int64 expiration_ticks, |
| - net::NetLogCaptureMode /* capture_mode */) { |
| - base::DictionaryValue* dict = new base::DictionaryValue(); |
| +scoped_ptr<base::Value> UrlBypassTypeCallback( |
| + DataReductionProxyBypassType bypass_type, |
| + const std::string& request_method, |
| + const GURL& url, |
| + bool should_retry, |
| + int bypass_seconds, |
| + int64 expiration_ticks, |
| + net::NetLogCaptureMode /* capture_mode */) { |
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| dict->SetInteger("bypass_type", bypass_type); |
| dict->SetString("method", request_method); |
| dict->SetString("url", url.spec()); |
| @@ -110,39 +111,39 @@ base::Value* UrlBypassTypeCallback(DataReductionProxyBypassType bypass_type, |
| dict->SetString("bypass_duration_seconds", |
| base::Int64ToString(bypass_seconds)); |
| dict->SetString("expiration", base::Int64ToString(expiration_ticks)); |
| - return dict; |
| + return dict.Pass(); |
| } |
| // A callback which creates a base::Value containing information about |
| // completing the Data Reduction Proxy secure proxy check. Ownership of the |
|
eroman
2015/05/21 03:37:42
And here
|
| // base::Value is passed to the caller. |
| -base::Value* EndCanaryRequestCallback( |
| +scoped_ptr<base::Value> EndCanaryRequestCallback( |
| int net_error, |
| int http_response_code, |
| bool succeeded, |
| net::NetLogCaptureMode /* capture_mode */) { |
| - base::DictionaryValue* dict = new base::DictionaryValue(); |
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| dict->SetInteger("net_error", net_error); |
| dict->SetInteger("http_response_code", http_response_code); |
| dict->SetBoolean("check_succeeded", succeeded); |
| - return dict; |
| + return dict.Pass(); |
| } |
| // A callback that creates a base::Value containing information about |
| // completing the Data Reduction Proxy configuration request. Ownership of the |
|
eroman
2015/05/21 03:37:42
And here
|
| // base::Value is passed to the caller. |
| -base::Value* EndConfigRequestCallback( |
| +scoped_ptr<base::Value> EndConfigRequestCallback( |
| int net_error, |
| int http_response_code, |
| int failure_count, |
| int64 expiration_ticks, |
| net::NetLogCaptureMode /* capture_mode */) { |
| - base::DictionaryValue* dict = new base::DictionaryValue(); |
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| dict->SetInteger("net_error", net_error); |
| dict->SetInteger("http_response_code", http_response_code); |
| dict->SetInteger("failure_count", failure_count); |
| dict->SetString("expiration", base::Int64ToString(expiration_ticks)); |
| - return dict; |
| + return dict.Pass(); |
| } |
| } // namespace |