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

Side by Side Diff: chrome/renderer/security_filter_peer.cc

Issue 2540023003: Dispatch encoded_data_length separately in content/child (Closed)
Patch Set: fix Created 4 years 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 "chrome/renderer/security_filter_peer.h" 5 #include "chrome/renderer/security_filter_peer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 original_peer_->OnUploadProgress(position, size); 76 original_peer_->OnUploadProgress(position, size);
77 } 77 }
78 78
79 bool SecurityFilterPeer::OnReceivedRedirect( 79 bool SecurityFilterPeer::OnReceivedRedirect(
80 const net::RedirectInfo& redirect_info, 80 const net::RedirectInfo& redirect_info,
81 const content::ResourceResponseInfo& info) { 81 const content::ResourceResponseInfo& info) {
82 NOTREACHED(); 82 NOTREACHED();
83 return false; 83 return false;
84 } 84 }
85 85
86 void SecurityFilterPeer::OnTransferSizeUpdated(int transfer_size_diff) {
87 original_peer_->OnTransferSizeUpdated(transfer_size_diff);
88 }
89
86 // static 90 // static
87 void ProcessResponseInfo(const content::ResourceResponseInfo& info_in, 91 void ProcessResponseInfo(const content::ResourceResponseInfo& info_in,
88 content::ResourceResponseInfo* info_out, 92 content::ResourceResponseInfo* info_out,
89 const std::string& mime_type) { 93 const std::string& mime_type) {
90 DCHECK(info_out); 94 DCHECK(info_out);
91 *info_out = info_in; 95 *info_out = info_in;
92 info_out->mime_type = mime_type; 96 info_out->mime_type = mime_type;
93 // Let's create our own HTTP headers. 97 // Let's create our own HTTP headers.
94 std::string raw_headers; 98 std::string raw_headers;
95 raw_headers.append("HTTP/1.1 200 OK"); 99 raw_headers.append("HTTP/1.1 200 OK");
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 original_peer_->OnReceivedResponse(response_info_); 146 original_peer_->OnReceivedResponse(response_info_);
143 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false, 147 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false,
144 stale_copy_in_cache, completion_time, 148 stale_copy_in_cache, completion_time,
145 total_transfer_size, encoded_body_size); 149 total_transfer_size, encoded_body_size);
146 return; 150 return;
147 } 151 }
148 152
149 original_peer_->OnReceivedResponse(response_info_); 153 original_peer_->OnReceivedResponse(response_info_);
150 if (!data_.empty()) { 154 if (!data_.empty()) {
151 original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>( 155 original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
152 data_.data(), data_.size(), -1)); 156 data_.data(), data_.size()));
153 } 157 }
154 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, 158 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler,
155 stale_copy_in_cache, completion_time, 159 stale_copy_in_cache, completion_time,
156 total_transfer_size, encoded_body_size); 160 total_transfer_size, encoded_body_size);
157 } 161 }
158 162
159 //////////////////////////////////////////////////////////////////////////////// 163 ////////////////////////////////////////////////////////////////////////////////
160 // ReplaceContentPeer 164 // ReplaceContentPeer
161 165
162 ReplaceContentPeer::ReplaceContentPeer( 166 ReplaceContentPeer::ReplaceContentPeer(
(...skipping 20 matching lines...) Expand all
183 bool stale_copy_in_cache, 187 bool stale_copy_in_cache,
184 const base::TimeTicks& completion_time, 188 const base::TimeTicks& completion_time,
185 int64_t total_transfer_size, 189 int64_t total_transfer_size,
186 int64_t encoded_body_size) { 190 int64_t encoded_body_size) {
187 content::ResourceResponseInfo info; 191 content::ResourceResponseInfo info;
188 ProcessResponseInfo(info, &info, mime_type_); 192 ProcessResponseInfo(info, &info, mime_type_);
189 info.content_length = static_cast<int>(data_.size()); 193 info.content_length = static_cast<int>(data_.size());
190 original_peer_->OnReceivedResponse(info); 194 original_peer_->OnReceivedResponse(info);
191 if (!data_.empty()) { 195 if (!data_.empty()) {
192 original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>( 196 original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>(
193 data_.data(), data_.size(), -1)); 197 data_.data(), data_.size()));
194 } 198 }
195 original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache, 199 original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache,
196 completion_time, total_transfer_size, 200 completion_time, total_transfer_size,
197 encoded_body_size); 201 encoded_body_size);
198 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698