| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 DictionaryValue* dict = new DictionaryValue(); | 99 DictionaryValue* dict = new DictionaryValue(); |
| 100 | 100 |
| 101 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); | 101 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); |
| 102 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); | 102 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); |
| 103 dict->SetString("hash_state", | 103 dict->SetString("hash_state", |
| 104 base::HexEncode(hash_state->data(), hash_state->size())); | 104 base::HexEncode(hash_state->data(), hash_state->size())); |
| 105 | 105 |
| 106 return dict; | 106 return dict; |
| 107 } | 107 } |
| 108 | 108 |
| 109 base::Value* ItemResumingNetLogCallback(bool user_initiated, |
| 110 DownloadInterruptReason reason, |
| 111 int64 bytes_so_far, |
| 112 const std::string* hash_state, |
| 113 net::NetLog::LogLevel log_level) { |
| 114 DictionaryValue* dict = new DictionaryValue(); |
| 115 |
| 116 dict->SetString("user_initiated", user_initiated ? "true" : "false"); |
| 117 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); |
| 118 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); |
| 119 dict->SetString("hash_state", |
| 120 base::HexEncode(hash_state->data(), hash_state->size())); |
| 121 |
| 122 return dict; |
| 123 } |
| 124 |
| 109 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far, | 125 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far, |
| 110 const std::string* final_hash, | 126 const std::string* final_hash, |
| 111 net::NetLog::LogLevel log_level) { | 127 net::NetLog::LogLevel log_level) { |
| 112 DictionaryValue* dict = new DictionaryValue(); | 128 DictionaryValue* dict = new DictionaryValue(); |
| 113 | 129 |
| 114 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); | 130 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); |
| 115 dict->SetString("final_hash", | 131 dict->SetString("final_hash", |
| 116 base::HexEncode(final_hash->data(), final_hash->size())); | 132 base::HexEncode(final_hash->data(), final_hash->size())); |
| 117 | 133 |
| 118 return dict; | 134 return dict; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 dict->SetString("operation", operation); | 208 dict->SetString("operation", operation); |
| 193 if (os_error != 0) | 209 if (os_error != 0) |
| 194 dict->SetInteger("os_error", os_error); | 210 dict->SetInteger("os_error", os_error); |
| 195 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); | 211 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); |
| 196 | 212 |
| 197 return dict; | 213 return dict; |
| 198 } | 214 } |
| 199 | 215 |
| 200 | 216 |
| 201 } // namespace content | 217 } // namespace content |
| OLD | NEW |