| Index: content/browser/download/download_net_log_parameters.cc
|
| diff --git a/content/browser/download/download_net_log_parameters.cc b/content/browser/download/download_net_log_parameters.cc
|
| index 8d04ae1d1feb4dd7adc76723e375c303337336fc..165496ca3d60cb44f1937756e15ef0d1aea63302 100644
|
| --- a/content/browser/download/download_net_log_parameters.cc
|
| +++ b/content/browser/download/download_net_log_parameters.cc
|
| @@ -41,11 +41,12 @@ static_assert(arraysize(download_danger_names) == DOWNLOAD_DANGER_TYPE_MAX,
|
|
|
| } // namespace
|
|
|
| -base::Value* ItemActivatedNetLogCallback(const DownloadItem* download_item,
|
| - DownloadType download_type,
|
| - const std::string* file_name,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemActivatedNetLogCallback(
|
| + const DownloadItem* download_item,
|
| + DownloadType download_type,
|
| + const std::string* file_name,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("type", download_type_names[download_type]);
|
| dict->SetString("id", base::Int64ToString(download_item->GetId()));
|
| @@ -58,50 +59,53 @@ base::Value* ItemActivatedNetLogCallback(const DownloadItem* download_item,
|
| base::Int64ToString(download_item->GetReceivedBytes()));
|
| dict->SetBoolean("has_user_gesture", download_item->HasUserGesture());
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemCheckedNetLogCallback(DownloadDangerType danger_type,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemCheckedNetLogCallback(
|
| + DownloadDangerType danger_type,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("danger_type", download_danger_names[danger_type]);
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemRenamedNetLogCallback(const base::FilePath* old_filename,
|
| - const base::FilePath* new_filename,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemRenamedNetLogCallback(
|
| + const base::FilePath* old_filename,
|
| + const base::FilePath* new_filename,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("old_filename", old_filename->AsUTF8Unsafe());
|
| dict->SetString("new_filename", new_filename->AsUTF8Unsafe());
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemInterruptedNetLogCallback(
|
| +scoped_ptr<base::Value> ItemInterruptedNetLogCallback(
|
| DownloadInterruptReason reason,
|
| int64 bytes_so_far,
|
| const std::string* hash_state,
|
| net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
|
| dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
|
| dict->SetString("hash_state",
|
| base::HexEncode(hash_state->data(), hash_state->size()));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemResumingNetLogCallback(bool user_initiated,
|
| - DownloadInterruptReason reason,
|
| - int64 bytes_so_far,
|
| - const std::string* hash_state,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemResumingNetLogCallback(
|
| + bool user_initiated,
|
| + DownloadInterruptReason reason,
|
| + int64 bytes_so_far,
|
| + const std::string* hash_state,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("user_initiated", user_initiated ? "true" : "false");
|
| dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
|
| @@ -109,100 +113,106 @@ base::Value* ItemResumingNetLogCallback(bool user_initiated,
|
| dict->SetString("hash_state",
|
| base::HexEncode(hash_state->data(), hash_state->size()));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far,
|
| - const std::string* final_hash,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemCompletingNetLogCallback(
|
| + int64 bytes_so_far,
|
| + const std::string* final_hash,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
|
| dict->SetString("final_hash",
|
| base::HexEncode(final_hash->data(), final_hash->size()));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemFinishedNetLogCallback(bool auto_opened,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemFinishedNetLogCallback(
|
| + bool auto_opened,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("auto_opened", auto_opened ? "yes" : "no");
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* ItemCanceledNetLogCallback(int64 bytes_so_far,
|
| - const std::string* hash_state,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> ItemCanceledNetLogCallback(
|
| + int64 bytes_so_far,
|
| + const std::string* hash_state,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
|
| dict->SetString("hash_state",
|
| base::HexEncode(hash_state->data(), hash_state->size()));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* FileOpenedNetLogCallback(const base::FilePath* file_name,
|
| - int64 start_offset,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> FileOpenedNetLogCallback(
|
| + const base::FilePath* file_name,
|
| + int64 start_offset,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("file_name", file_name->AsUTF8Unsafe());
|
| dict->SetString("start_offset", base::Int64ToString(start_offset));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* FileStreamDrainedNetLogCallback(
|
| +scoped_ptr<base::Value> FileStreamDrainedNetLogCallback(
|
| size_t stream_size,
|
| size_t num_buffers,
|
| net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetInteger("stream_size", static_cast<int>(stream_size));
|
| dict->SetInteger("num_buffers", static_cast<int>(num_buffers));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* FileRenamedNetLogCallback(const base::FilePath* old_filename,
|
| - const base::FilePath* new_filename,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> FileRenamedNetLogCallback(
|
| + const base::FilePath* old_filename,
|
| + const base::FilePath* new_filename,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("old_filename", old_filename->AsUTF8Unsafe());
|
| dict->SetString("new_filename", new_filename->AsUTF8Unsafe());
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* FileErrorNetLogCallback(const char* operation,
|
| - net::Error net_error,
|
| - net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| +scoped_ptr<base::Value> FileErrorNetLogCallback(
|
| + const char* operation,
|
| + net::Error net_error,
|
| + net::NetLogCaptureMode capture_mode) {
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("operation", operation);
|
| dict->SetInteger("net_error", net_error);
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| -base::Value* FileInterruptedNetLogCallback(
|
| +scoped_ptr<base::Value> FileInterruptedNetLogCallback(
|
| const char* operation,
|
| int os_error,
|
| DownloadInterruptReason reason,
|
| net::NetLogCaptureMode capture_mode) {
|
| - base::DictionaryValue* dict = new base::DictionaryValue();
|
| + scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
|
|
|
| dict->SetString("operation", operation);
|
| if (os_error != 0)
|
| dict->SetInteger("os_error", os_error);
|
| dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
|
|
|
| - return dict;
|
| + return dict.Pass();
|
| }
|
|
|
| } // namespace content
|
|
|