| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gfx/codec/png_codec.h" | 7 #include "app/gfx/codec/png_codec.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status, | 186 void BufferedPeer::OnCompletedRequest(const URLRequestStatus& status, |
| 187 const std::string& security_info) { | 187 const std::string& security_info) { |
| 188 // Make sure we delete ourselves at the end of this call. | 188 // Make sure we delete ourselves at the end of this call. |
| 189 scoped_ptr<BufferedPeer> this_deleter(this); | 189 scoped_ptr<BufferedPeer> this_deleter(this); |
| 190 | 190 |
| 191 // Give sub-classes a chance at altering the data. | 191 // Give sub-classes a chance at altering the data. |
| 192 if (status.status() != URLRequestStatus::SUCCESS || !DataReady()) { | 192 if (status.status() != URLRequestStatus::SUCCESS || !DataReady()) { |
| 193 // Pretend we failed to load the resource. | 193 // Pretend we failed to load the resource. |
| 194 original_peer_->OnReceivedResponse(response_info_, true); | 194 original_peer_->OnReceivedResponse(response_info_, true); |
| 195 URLRequestStatus status(URLRequestStatus::CANCELED, 0); | 195 URLRequestStatus status(URLRequestStatus::CANCELED, net::ERR_ABORTED); |
| 196 original_peer_->OnCompletedRequest(status, security_info); | 196 original_peer_->OnCompletedRequest(status, security_info); |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 | 199 |
| 200 original_peer_->OnReceivedResponse(response_info_, true); | 200 original_peer_->OnReceivedResponse(response_info_, true); |
| 201 if (!data_.empty()) | 201 if (!data_.empty()) |
| 202 original_peer_->OnReceivedData(data_.data(), | 202 original_peer_->OnReceivedData(data_.data(), |
| 203 static_cast<int>(data_.size())); | 203 static_cast<int>(data_.size())); |
| 204 original_peer_->OnCompletedRequest(status, security_info); | 204 original_peer_->OnCompletedRequest(status, security_info); |
| 205 } | 205 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return false; | 315 return false; |
| 316 } | 316 } |
| 317 | 317 |
| 318 // Copy the vector content to data_ which is a string. | 318 // Copy the vector content to data_ which is a string. |
| 319 data_.clear(); | 319 data_.clear(); |
| 320 data_.resize(output.size()); | 320 data_.resize(output.size()); |
| 321 std::copy(output.begin(), output.end(), data_.begin()); | 321 std::copy(output.begin(), output.end(), data_.begin()); |
| 322 | 322 |
| 323 return true; | 323 return true; |
| 324 } | 324 } |
| OLD | NEW |