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

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

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
« no previous file with comments | « chrome/common/resource_response.h ('k') | chrome/plugin/chrome_plugin_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/security_filter_peer.h" 5 #include "chrome/common/security_filter_peer.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "grit/generated_resources.h" 8 #include "grit/generated_resources.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
11 11
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void SecurityFilterPeer::OnReceivedResponse( 77 void SecurityFilterPeer::OnReceivedResponse(
78 const webkit_glue::ResourceResponseInfo& info, 78 const webkit_glue::ResourceResponseInfo& info,
79 bool content_filtered) { 79 bool content_filtered) {
80 NOTREACHED(); 80 NOTREACHED();
81 } 81 }
82 82
83 void SecurityFilterPeer::OnReceivedData(const char* data, int len) { 83 void SecurityFilterPeer::OnReceivedData(const char* data, int len) {
84 NOTREACHED(); 84 NOTREACHED();
85 } 85 }
86 86
87 void SecurityFilterPeer::OnCompletedRequest(const URLRequestStatus& status, 87 void SecurityFilterPeer::OnCompletedRequest(const net::URLRequestStatus& status,
88 const std::string& security_info, 88 const std::string& security_info,
89 const base::Time& completion_time) { 89 const base::Time& completion_time) {
90 NOTREACHED(); 90 NOTREACHED();
91 } 91 }
92 92
93 // static 93 // static
94 void ProcessResponseInfo( 94 void ProcessResponseInfo(
95 const webkit_glue::ResourceResponseInfo& info_in, 95 const webkit_glue::ResourceResponseInfo& info_in,
96 webkit_glue::ResourceResponseInfo* info_out, 96 webkit_glue::ResourceResponseInfo* info_out,
97 const std::string& mime_type) { 97 const std::string& mime_type) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void BufferedPeer::OnReceivedResponse( 136 void BufferedPeer::OnReceivedResponse(
137 const webkit_glue::ResourceResponseInfo& info, 137 const webkit_glue::ResourceResponseInfo& info,
138 bool response_filtered) { 138 bool response_filtered) {
139 ProcessResponseInfo(info, &response_info_, mime_type_); 139 ProcessResponseInfo(info, &response_info_, mime_type_);
140 } 140 }
141 141
142 void BufferedPeer::OnReceivedData(const char* data, int len) { 142 void BufferedPeer::OnReceivedData(const char* data, int len) {
143 data_.append(data, len); 143 data_.append(data, len);
144 } 144 }
145 145
146 void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status, 146 void BufferedPeer::OnCompletedRequest(const net::URLRequestStatus& status,
147 const std::string& security_info, 147 const std::string& security_info,
148 const base::Time& completion_time) { 148 const base::Time& completion_time) {
149 // Make sure we delete ourselves at the end of this call. 149 // Make sure we delete ourselves at the end of this call.
150 scoped_ptr<BufferedPeer> this_deleter(this); 150 scoped_ptr<BufferedPeer> this_deleter(this);
151 151
152 // Give sub-classes a chance at altering the data. 152 // Give sub-classes a chance at altering the data.
153 if (status.status() != URLRequestStatus::SUCCESS || !DataReady()) { 153 if (status.status() != net::URLRequestStatus::SUCCESS || !DataReady()) {
154 // Pretend we failed to load the resource. 154 // Pretend we failed to load the resource.
155 original_peer_->OnReceivedResponse(response_info_, true); 155 original_peer_->OnReceivedResponse(response_info_, true);
156 URLRequestStatus status(URLRequestStatus::CANCELED, net::ERR_ABORTED); 156 net::URLRequestStatus status(net::URLRequestStatus::CANCELED,
157 net::ERR_ABORTED);
157 original_peer_->OnCompletedRequest(status, security_info, completion_time); 158 original_peer_->OnCompletedRequest(status, security_info, completion_time);
158 return; 159 return;
159 } 160 }
160 161
161 original_peer_->OnReceivedResponse(response_info_, true); 162 original_peer_->OnReceivedResponse(response_info_, true);
162 if (!data_.empty()) 163 if (!data_.empty())
163 original_peer_->OnReceivedData(data_.data(), 164 original_peer_->OnReceivedData(data_.data(),
164 static_cast<int>(data_.size())); 165 static_cast<int>(data_.size()));
165 original_peer_->OnCompletedRequest(status, security_info, completion_time); 166 original_peer_->OnCompletedRequest(status, security_info, completion_time);
166 } 167 }
(...skipping 18 matching lines...) Expand all
185 const webkit_glue::ResourceResponseInfo& info, 186 const webkit_glue::ResourceResponseInfo& info,
186 bool content_filtered) { 187 bool content_filtered) {
187 // Ignore this, we'll serve some alternate content in OnCompletedRequest. 188 // Ignore this, we'll serve some alternate content in OnCompletedRequest.
188 } 189 }
189 190
190 void ReplaceContentPeer::OnReceivedData(const char* data, int len) { 191 void ReplaceContentPeer::OnReceivedData(const char* data, int len) {
191 // Ignore this, we'll serve some alternate content in OnCompletedRequest. 192 // Ignore this, we'll serve some alternate content in OnCompletedRequest.
192 } 193 }
193 194
194 void ReplaceContentPeer::OnCompletedRequest( 195 void ReplaceContentPeer::OnCompletedRequest(
195 const URLRequestStatus& status, 196 const net::URLRequestStatus& status,
196 const std::string& security_info, 197 const std::string& security_info,
197 const base::Time& completion_time) { 198 const base::Time& completion_time) {
198 webkit_glue::ResourceResponseInfo info; 199 webkit_glue::ResourceResponseInfo info;
199 ProcessResponseInfo(info, &info, mime_type_); 200 ProcessResponseInfo(info, &info, mime_type_);
200 info.security_info = security_info; 201 info.security_info = security_info;
201 info.content_length = static_cast<int>(data_.size()); 202 info.content_length = static_cast<int>(data_.size());
202 original_peer_->OnReceivedResponse(info, true); 203 original_peer_->OnReceivedResponse(info, true);
203 if (!data_.empty()) 204 if (!data_.empty())
204 original_peer_->OnReceivedData(data_.data(), 205 original_peer_->OnReceivedData(data_.data(),
205 static_cast<int>(data_.size())); 206 static_cast<int>(data_.size()));
206 original_peer_->OnCompletedRequest(URLRequestStatus(), 207 original_peer_->OnCompletedRequest(net::URLRequestStatus(),
207 security_info, 208 security_info,
208 completion_time); 209 completion_time);
209 210
210 // The request processing is complete, we must delete ourselves. 211 // The request processing is complete, we must delete ourselves.
211 delete this; 212 delete this;
212 } 213 }
OLDNEW
« no previous file with comments | « chrome/common/resource_response.h ('k') | chrome/plugin/chrome_plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698