Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: content/browser/download/download_net_log_parameters.cc

Issue 114193009: [Download] Return DownloadInterruptReason from OnStartedCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 return dict; 84 return dict;
85 } 85 }
86 86
87 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason, 87 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason,
88 int64 bytes_so_far, 88 int64 bytes_so_far,
89 const std::string* hash_state, 89 const std::string* hash_state,
90 net::NetLog::LogLevel log_level) { 90 net::NetLog::LogLevel log_level) {
91 base::DictionaryValue* dict = new base::DictionaryValue(); 91 base::DictionaryValue* dict = new base::DictionaryValue();
92 92
93 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); 93 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
94 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); 94 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
95 dict->SetString("hash_state", 95 dict->SetString("hash_state",
96 base::HexEncode(hash_state->data(), hash_state->size())); 96 base::HexEncode(hash_state->data(), hash_state->size()));
97 97
98 return dict; 98 return dict;
99 } 99 }
100 100
101 base::Value* ItemResumingNetLogCallback(bool user_initiated, 101 base::Value* ItemResumingNetLogCallback(bool user_initiated,
102 DownloadInterruptReason reason, 102 DownloadInterruptReason reason,
103 int64 bytes_so_far, 103 int64 bytes_so_far,
104 const std::string* hash_state, 104 const std::string* hash_state,
105 net::NetLog::LogLevel log_level) { 105 net::NetLog::LogLevel log_level) {
106 base::DictionaryValue* dict = new base::DictionaryValue(); 106 base::DictionaryValue* dict = new base::DictionaryValue();
107 107
108 dict->SetString("user_initiated", user_initiated ? "true" : "false"); 108 dict->SetString("user_initiated", user_initiated ? "true" : "false");
109 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); 109 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
110 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); 110 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
111 dict->SetString("hash_state", 111 dict->SetString("hash_state",
112 base::HexEncode(hash_state->data(), hash_state->size())); 112 base::HexEncode(hash_state->data(), hash_state->size()));
113 113
114 return dict; 114 return dict;
115 } 115 }
116 116
117 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far, 117 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far,
118 const std::string* final_hash, 118 const std::string* final_hash,
119 net::NetLog::LogLevel log_level) { 119 net::NetLog::LogLevel log_level) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 base::Value* FileInterruptedNetLogCallback(const char* operation, 194 base::Value* FileInterruptedNetLogCallback(const char* operation,
195 int os_error, 195 int os_error,
196 DownloadInterruptReason reason, 196 DownloadInterruptReason reason,
197 net::NetLog::LogLevel log_level) { 197 net::NetLog::LogLevel log_level) {
198 base::DictionaryValue* dict = new base::DictionaryValue(); 198 base::DictionaryValue* dict = new base::DictionaryValue();
199 199
200 dict->SetString("operation", operation); 200 dict->SetString("operation", operation);
201 if (os_error != 0) 201 if (os_error != 0)
202 dict->SetInteger("os_error", os_error); 202 dict->SetInteger("os_error", os_error);
203 dict->SetString("interrupt_reason", InterruptReasonDebugString(reason)); 203 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
204 204
205 return dict; 205 return dict;
206 } 206 }
207 207
208 } // namespace content 208 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/download_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698