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

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

Issue 10640019: Remove the HANDLED_EXTERNALLY status code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase + fix nits Created 8 years, 3 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 "chrome/renderer/security_filter_peer.h" 5 #include "chrome/renderer/security_filter_peer.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 NOTREACHED(); 83 NOTREACHED();
84 } 84 }
85 85
86 void SecurityFilterPeer::OnReceivedData(const char* data, 86 void SecurityFilterPeer::OnReceivedData(const char* data,
87 int data_length, 87 int data_length,
88 int encoded_data_length) { 88 int encoded_data_length) {
89 NOTREACHED(); 89 NOTREACHED();
90 } 90 }
91 91
92 void SecurityFilterPeer::OnCompletedRequest( 92 void SecurityFilterPeer::OnCompletedRequest(
93 const net::URLRequestStatus& status, 93 int error_code,
94 bool was_ignored_by_handler,
94 const std::string& security_info, 95 const std::string& security_info,
95 const base::TimeTicks& completion_time) { 96 const base::TimeTicks& completion_time) {
96 NOTREACHED(); 97 NOTREACHED();
97 } 98 }
98 99
99 // static 100 // static
100 void ProcessResponseInfo( 101 void ProcessResponseInfo(
101 const webkit_glue::ResourceResponseInfo& info_in, 102 const webkit_glue::ResourceResponseInfo& info_in,
102 webkit_glue::ResourceResponseInfo* info_out, 103 webkit_glue::ResourceResponseInfo* info_out,
103 const std::string& mime_type) { 104 const std::string& mime_type) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const webkit_glue::ResourceResponseInfo& info) { 144 const webkit_glue::ResourceResponseInfo& info) {
144 ProcessResponseInfo(info, &response_info_, mime_type_); 145 ProcessResponseInfo(info, &response_info_, mime_type_);
145 } 146 }
146 147
147 void BufferedPeer::OnReceivedData(const char* data, 148 void BufferedPeer::OnReceivedData(const char* data,
148 int data_length, 149 int data_length,
149 int encoded_data_length) { 150 int encoded_data_length) {
150 data_.append(data, data_length); 151 data_.append(data, data_length);
151 } 152 }
152 153
153 void BufferedPeer::OnCompletedRequest(const net::URLRequestStatus& status, 154 void BufferedPeer::OnCompletedRequest(int error_code,
155 bool was_ignored_by_handler,
154 const std::string& security_info, 156 const std::string& security_info,
155 const base::TimeTicks& completion_time) { 157 const base::TimeTicks& completion_time) {
156 // Make sure we delete ourselves at the end of this call. 158 // Make sure we delete ourselves at the end of this call.
157 scoped_ptr<BufferedPeer> this_deleter(this); 159 scoped_ptr<BufferedPeer> this_deleter(this);
158 160
159 // Give sub-classes a chance at altering the data. 161 // Give sub-classes a chance at altering the data.
160 if (status.status() != net::URLRequestStatus::SUCCESS || !DataReady()) { 162 if (error_code != net::OK || !DataReady()) {
161 // Pretend we failed to load the resource. 163 // Pretend we failed to load the resource.
162 original_peer_->OnReceivedResponse(response_info_); 164 original_peer_->OnReceivedResponse(response_info_);
163 net::URLRequestStatus status(net::URLRequestStatus::CANCELED, 165 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false, security_info,
164 net::ERR_ABORTED); 166 completion_time);
165 original_peer_->OnCompletedRequest(status, security_info, completion_time);
166 return; 167 return;
167 } 168 }
168 169
169 original_peer_->OnReceivedResponse(response_info_); 170 original_peer_->OnReceivedResponse(response_info_);
170 if (!data_.empty()) 171 if (!data_.empty())
171 original_peer_->OnReceivedData(data_.data(), 172 original_peer_->OnReceivedData(data_.data(),
172 static_cast<int>(data_.size()), 173 static_cast<int>(data_.size()),
173 -1); 174 -1);
174 original_peer_->OnCompletedRequest(status, security_info, completion_time); 175 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler,
176 security_info, completion_time);
175 } 177 }
176 178
177 //////////////////////////////////////////////////////////////////////////////// 179 ////////////////////////////////////////////////////////////////////////////////
178 // ReplaceContentPeer 180 // ReplaceContentPeer
179 181
180 ReplaceContentPeer::ReplaceContentPeer( 182 ReplaceContentPeer::ReplaceContentPeer(
181 webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 183 webkit_glue::ResourceLoaderBridge* resource_loader_bridge,
182 webkit_glue::ResourceLoaderBridge::Peer* peer, 184 webkit_glue::ResourceLoaderBridge::Peer* peer,
183 const std::string& mime_type, 185 const std::string& mime_type,
184 const std::string& data) 186 const std::string& data)
(...skipping 10 matching lines...) Expand all
195 // Ignore this, we'll serve some alternate content in OnCompletedRequest. 197 // Ignore this, we'll serve some alternate content in OnCompletedRequest.
196 } 198 }
197 199
198 void ReplaceContentPeer::OnReceivedData(const char* data, 200 void ReplaceContentPeer::OnReceivedData(const char* data,
199 int data_length, 201 int data_length,
200 int encoded_data_length) { 202 int encoded_data_length) {
201 // Ignore this, we'll serve some alternate content in OnCompletedRequest. 203 // Ignore this, we'll serve some alternate content in OnCompletedRequest.
202 } 204 }
203 205
204 void ReplaceContentPeer::OnCompletedRequest( 206 void ReplaceContentPeer::OnCompletedRequest(
205 const net::URLRequestStatus& status, 207 int error_code,
208 bool was_ignored_by_handler,
206 const std::string& security_info, 209 const std::string& security_info,
207 const base::TimeTicks& completion_time) { 210 const base::TimeTicks& completion_time) {
208 webkit_glue::ResourceResponseInfo info; 211 webkit_glue::ResourceResponseInfo info;
209 ProcessResponseInfo(info, &info, mime_type_); 212 ProcessResponseInfo(info, &info, mime_type_);
210 info.security_info = security_info; 213 info.security_info = security_info;
211 info.content_length = static_cast<int>(data_.size()); 214 info.content_length = static_cast<int>(data_.size());
212 original_peer_->OnReceivedResponse(info); 215 original_peer_->OnReceivedResponse(info);
213 if (!data_.empty()) 216 if (!data_.empty())
214 original_peer_->OnReceivedData(data_.data(), 217 original_peer_->OnReceivedData(data_.data(),
215 static_cast<int>(data_.size()), 218 static_cast<int>(data_.size()),
216 -1); 219 -1);
217 original_peer_->OnCompletedRequest(net::URLRequestStatus(), 220 original_peer_->OnCompletedRequest(net::OK,
221 false,
218 security_info, 222 security_info,
219 completion_time); 223 completion_time);
220 224
221 // The request processing is complete, we must delete ourselves. 225 // The request processing is complete, we must delete ourselves.
222 delete this; 226 delete this;
223 } 227 }
OLDNEW
« no previous file with comments | « chrome/renderer/security_filter_peer.h ('k') | content/browser/renderer_host/async_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698