| OLD | NEW |
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void ReplaceContentPeer::OnReceivedData(std::unique_ptr<ReceivedData> data) { | 135 void ReplaceContentPeer::OnReceivedData(std::unique_ptr<ReceivedData> data) { |
| 136 // Ignore this, we'll serve some alternate content in OnCompletedRequest. | 136 // Ignore this, we'll serve some alternate content in OnCompletedRequest. |
| 137 } | 137 } |
| 138 | 138 |
| 139 void ReplaceContentPeer::OnCompletedRequest( | 139 void ReplaceContentPeer::OnCompletedRequest( |
| 140 int error_code, | 140 int error_code, |
| 141 bool was_ignored_by_handler, | 141 bool was_ignored_by_handler, |
| 142 bool stale_copy_in_cache, | 142 bool stale_copy_in_cache, |
| 143 const base::TimeTicks& completion_time, | 143 const base::TimeTicks& completion_time, |
| 144 int64_t total_transfer_size, | 144 int64_t total_transfer_size, |
| 145 int64_t encoded_body_size) { | 145 int64_t encoded_body_size, |
| 146 int64_t decoded_body_size) { |
| 146 content::ResourceResponseInfo info; | 147 content::ResourceResponseInfo info; |
| 147 ProcessResponseInfo(info, &info, mime_type_); | 148 ProcessResponseInfo(info, &info, mime_type_); |
| 148 info.content_length = static_cast<int>(data_.size()); | 149 info.content_length = static_cast<int>(data_.size()); |
| 149 original_peer_->OnReceivedResponse(info); | 150 original_peer_->OnReceivedResponse(info); |
| 150 if (!data_.empty()) { | 151 if (!data_.empty()) { |
| 151 original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>( | 152 original_peer_->OnReceivedData(base::MakeUnique<content::FixedReceivedData>( |
| 152 data_.data(), data_.size())); | 153 data_.data(), data_.size())); |
| 153 } | 154 } |
| 154 original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache, | 155 original_peer_->OnCompletedRequest(net::OK, false, stale_copy_in_cache, |
| 155 completion_time, total_transfer_size, | 156 completion_time, total_transfer_size, |
| 156 encoded_body_size); | 157 encoded_body_size, decoded_body_size); |
| 157 } | 158 } |
| OLD | NEW |