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

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

Issue 1751603002: [Downloads] Rework how hashes are calculated for download files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on top of https://codereview.chromium.org/1781983002 since that's going in first. Created 4 years, 9 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); 83 dict->SetString("old_filename", old_filename->AsUTF8Unsafe());
84 dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); 84 dict->SetString("new_filename", new_filename->AsUTF8Unsafe());
85 85
86 return std::move(dict); 86 return std::move(dict);
87 } 87 }
88 88
89 scoped_ptr<base::Value> ItemInterruptedNetLogCallback( 89 scoped_ptr<base::Value> ItemInterruptedNetLogCallback(
90 DownloadInterruptReason reason, 90 DownloadInterruptReason reason,
91 int64_t bytes_so_far, 91 int64_t bytes_so_far,
92 const std::string* hash_state,
93 net::NetLogCaptureMode capture_mode) { 92 net::NetLogCaptureMode capture_mode) {
94 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 93 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
95 94
96 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason)); 95 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
97 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); 96 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
98 dict->SetString("hash_state",
99 base::HexEncode(hash_state->data(), hash_state->size()));
100 97
101 return std::move(dict); 98 return std::move(dict);
102 } 99 }
103 100
104 scoped_ptr<base::Value> ItemResumingNetLogCallback( 101 scoped_ptr<base::Value> ItemResumingNetLogCallback(
105 bool user_initiated, 102 bool user_initiated,
106 DownloadInterruptReason reason, 103 DownloadInterruptReason reason,
107 int64_t bytes_so_far, 104 int64_t bytes_so_far,
108 const std::string* hash_state,
109 net::NetLogCaptureMode capture_mode) { 105 net::NetLogCaptureMode capture_mode) {
110 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 106 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
111 107
112 dict->SetString("user_initiated", user_initiated ? "true" : "false"); 108 dict->SetString("user_initiated", user_initiated ? "true" : "false");
113 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason)); 109 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
114 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); 110 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
115 dict->SetString("hash_state",
116 base::HexEncode(hash_state->data(), hash_state->size()));
117 111
118 return std::move(dict); 112 return std::move(dict);
119 } 113 }
120 114
121 scoped_ptr<base::Value> ItemCompletingNetLogCallback( 115 scoped_ptr<base::Value> ItemCompletingNetLogCallback(
122 int64_t bytes_so_far, 116 int64_t bytes_so_far,
123 const std::string* final_hash, 117 const std::string* final_hash,
124 net::NetLogCaptureMode capture_mode) { 118 net::NetLogCaptureMode capture_mode) {
125 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 119 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
126 120
127 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); 121 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
128 dict->SetString("final_hash", 122 dict->SetString("final_hash",
129 base::HexEncode(final_hash->data(), final_hash->size())); 123 base::HexEncode(final_hash->data(), final_hash->size()));
130 124
131 return std::move(dict); 125 return std::move(dict);
132 } 126 }
133 127
134 scoped_ptr<base::Value> ItemFinishedNetLogCallback( 128 scoped_ptr<base::Value> ItemFinishedNetLogCallback(
135 bool auto_opened, 129 bool auto_opened,
136 net::NetLogCaptureMode capture_mode) { 130 net::NetLogCaptureMode capture_mode) {
137 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 131 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
138 132
139 dict->SetString("auto_opened", auto_opened ? "yes" : "no"); 133 dict->SetString("auto_opened", auto_opened ? "yes" : "no");
140 134
141 return std::move(dict); 135 return std::move(dict);
142 } 136 }
143 137
144 scoped_ptr<base::Value> ItemCanceledNetLogCallback( 138 scoped_ptr<base::Value> ItemCanceledNetLogCallback(
145 int64_t bytes_so_far, 139 int64_t bytes_so_far,
146 const std::string* hash_state,
147 net::NetLogCaptureMode capture_mode) { 140 net::NetLogCaptureMode capture_mode) {
148 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 141 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
149 142
150 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far)); 143 dict->SetString("bytes_so_far", base::Int64ToString(bytes_so_far));
151 dict->SetString("hash_state",
152 base::HexEncode(hash_state->data(), hash_state->size()));
153 144
154 return std::move(dict); 145 return std::move(dict);
155 } 146 }
156 147
157 scoped_ptr<base::Value> FileOpenedNetLogCallback( 148 scoped_ptr<base::Value> FileOpenedNetLogCallback(
158 const base::FilePath* file_name, 149 const base::FilePath* file_name,
159 int64_t start_offset, 150 int64_t start_offset,
160 net::NetLogCaptureMode capture_mode) { 151 net::NetLogCaptureMode capture_mode) {
161 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 152 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
162 153
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 202
212 dict->SetString("operation", operation); 203 dict->SetString("operation", operation);
213 if (os_error != 0) 204 if (os_error != 0)
214 dict->SetInteger("os_error", os_error); 205 dict->SetInteger("os_error", os_error);
215 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason)); 206 dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
216 207
217 return std::move(dict); 208 return std::move(dict);
218 } 209 }
219 210
220 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_net_log_parameters.h ('k') | content/browser/download/download_request_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698