| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/download_net_log_parameters.h" | 5 #include "content/browser/download/download_net_log_parameters.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 base::Value* ItemCheckedNetLogCallback( | 65 base::Value* ItemCheckedNetLogCallback( |
| 66 DownloadDangerType danger_type, | 66 DownloadDangerType danger_type, |
| 67 net::NetLog::LogLevel log_level) { | 67 net::NetLog::LogLevel log_level) { |
| 68 DictionaryValue* dict = new DictionaryValue(); | 68 DictionaryValue* dict = new DictionaryValue(); |
| 69 | 69 |
| 70 dict->SetString("danger_type", download_danger_names[danger_type]); | 70 dict->SetString("danger_type", download_danger_names[danger_type]); |
| 71 | 71 |
| 72 return dict; | 72 return dict; |
| 73 } | 73 } |
| 74 | 74 |
| 75 base::Value* ItemRenamedNetLogCallback(const FilePath* old_filename, | 75 base::Value* ItemRenamedNetLogCallback(const base::FilePath* old_filename, |
| 76 const FilePath* new_filename, | 76 const base::FilePath* new_filename, |
| 77 net::NetLog::LogLevel log_level) { | 77 net::NetLog::LogLevel log_level) { |
| 78 DictionaryValue* dict = new DictionaryValue(); | 78 DictionaryValue* dict = new DictionaryValue(); |
| 79 | 79 |
| 80 dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); | 80 dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); |
| 81 dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); | 81 dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); |
| 82 | 82 |
| 83 return dict; | 83 return dict; |
| 84 } | 84 } |
| 85 | 85 |
| 86 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason, | 86 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 net::NetLog::LogLevel log_level) { | 139 net::NetLog::LogLevel log_level) { |
| 140 DictionaryValue* dict = new DictionaryValue(); | 140 DictionaryValue* dict = new DictionaryValue(); |
| 141 | 141 |
| 142 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); | 142 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); |
| 143 dict->SetString("hash_state", | 143 dict->SetString("hash_state", |
| 144 base::HexEncode(hash_state->data(), hash_state->size())); | 144 base::HexEncode(hash_state->data(), hash_state->size())); |
| 145 | 145 |
| 146 return dict; | 146 return dict; |
| 147 } | 147 } |
| 148 | 148 |
| 149 base::Value* FileOpenedNetLogCallback(const FilePath* file_name, | 149 base::Value* FileOpenedNetLogCallback(const base::FilePath* file_name, |
| 150 int64 start_offset, | 150 int64 start_offset, |
| 151 net::NetLog::LogLevel log_level) { | 151 net::NetLog::LogLevel log_level) { |
| 152 DictionaryValue* dict = new DictionaryValue(); | 152 DictionaryValue* dict = new DictionaryValue(); |
| 153 | 153 |
| 154 dict->SetString("file_name", file_name->AsUTF8Unsafe()); | 154 dict->SetString("file_name", file_name->AsUTF8Unsafe()); |
| 155 dict->SetString("start_offset", base::Int64ToString(start_offset)); | 155 dict->SetString("start_offset", base::Int64ToString(start_offset)); |
| 156 | 156 |
| 157 return dict; | 157 return dict; |
| 158 } | 158 } |
| 159 | 159 |
| 160 base::Value* FileStreamDrainedNetLogCallback(size_t stream_size, | 160 base::Value* FileStreamDrainedNetLogCallback(size_t stream_size, |
| 161 size_t num_buffers, | 161 size_t num_buffers, |
| 162 net::NetLog::LogLevel log_level) { | 162 net::NetLog::LogLevel log_level) { |
| 163 DictionaryValue* dict = new DictionaryValue(); | 163 DictionaryValue* dict = new DictionaryValue(); |
| 164 | 164 |
| 165 dict->SetInteger("stream_size", static_cast<int>(stream_size)); | 165 dict->SetInteger("stream_size", static_cast<int>(stream_size)); |
| 166 dict->SetInteger("num_buffers", static_cast<int>(num_buffers)); | 166 dict->SetInteger("num_buffers", static_cast<int>(num_buffers)); |
| 167 | 167 |
| 168 return dict; | 168 return dict; |
| 169 } | 169 } |
| 170 | 170 |
| 171 base::Value* FileRenamedNetLogCallback(const FilePath* old_filename, | 171 base::Value* FileRenamedNetLogCallback(const base::FilePath* old_filename, |
| 172 const FilePath* new_filename, | 172 const base::FilePath* new_filename, |
| 173 net::NetLog::LogLevel log_level) { | 173 net::NetLog::LogLevel log_level) { |
| 174 DictionaryValue* dict = new DictionaryValue(); | 174 DictionaryValue* dict = new DictionaryValue(); |
| 175 | 175 |
| 176 dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); | 176 dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); |
| 177 dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); | 177 dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); |
| 178 | 178 |
| 179 return dict; | 179 return dict; |
| 180 } | 180 } |
| 181 | 181 |
| 182 base::Value* FileErrorNetLogCallback(const char* operation, | 182 base::Value* FileErrorNetLogCallback(const char* operation, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 199 dict->SetString("operation", operation); | 199 dict->SetString("operation", operation); |
| 200 if (os_error != 0) | 200 if (os_error != 0) |
| 201 dict->SetInteger("os_error", os_error); | 201 dict->SetInteger("os_error", os_error); |
| 202 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); | 202 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); |
| 203 | 203 |
| 204 return dict; | 204 return dict; |
| 205 } | 205 } |
| 206 | 206 |
| 207 | 207 |
| 208 } // namespace content | 208 } // namespace content |
| OLD | NEW |