| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/blob_storage/blob_url_loader_factory.h" | 5 #include "content/browser/blob_storage/blob_url_loader_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // mojom::URLLoader implementation: | 129 // mojom::URLLoader implementation: |
| 130 void FollowRedirect() override { NOTREACHED(); } | 130 void FollowRedirect() override { NOTREACHED(); } |
| 131 | 131 |
| 132 void SetPriority(net::RequestPriority priority, | 132 void SetPriority(net::RequestPriority priority, |
| 133 int32_t intra_priority_value) override {} | 133 int32_t intra_priority_value) override {} |
| 134 | 134 |
| 135 // Notifies the client that the request completed. Takes care of deleting this | 135 // Notifies the client that the request completed. Takes care of deleting this |
| 136 // object now if possible (i.e. no outstanding data pipe), otherwise this | 136 // object now if possible (i.e. no outstanding data pipe), otherwise this |
| 137 // object will be deleted when the data pipe is closed. | 137 // object will be deleted when the data pipe is closed. |
| 138 void NotifyCompleted(int error_code) { | 138 void NotifyCompleted(int error_code) { |
| 139 if (error_code != net::OK && !sent_headers_) { | |
| 140 net::HttpStatusCode status_code = | |
| 141 storage::BlobURLRequestJob::NetErrorToHttpStatusCode(error_code); | |
| 142 ResourceResponseHead response; | |
| 143 response.headers = storage::BlobURLRequestJob::GenerateHeaders( | |
| 144 status_code, nullptr, nullptr, nullptr, nullptr); | |
| 145 client_->OnReceiveResponse(response, base::nullopt, nullptr); | |
| 146 } | |
| 147 ResourceRequestCompletionStatus request_complete_data; | 139 ResourceRequestCompletionStatus request_complete_data; |
| 140 request_complete_data.error_code = error_code; |
| 148 client_->OnComplete(request_complete_data); | 141 client_->OnComplete(request_complete_data); |
| 149 | 142 |
| 150 DeleteIfNeeded(); | 143 DeleteIfNeeded(); |
| 151 } | 144 } |
| 152 | 145 |
| 153 void DidCalculateSize(int result) { | 146 void DidCalculateSize(int result) { |
| 154 if (result != net::OK) { | 147 if (result != net::OK) { |
| 155 NotifyCompleted(result); | 148 NotifyCompleted(result); |
| 156 return; | 149 return; |
| 157 } | 150 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 386 } |
| 394 | 387 |
| 395 void BlobURLLoaderFactory::SyncLoad(int32_t routing_id, | 388 void BlobURLLoaderFactory::SyncLoad(int32_t routing_id, |
| 396 int32_t request_id, | 389 int32_t request_id, |
| 397 const ResourceRequest& request, | 390 const ResourceRequest& request, |
| 398 SyncLoadCallback callback) { | 391 SyncLoadCallback callback) { |
| 399 NOTREACHED(); | 392 NOTREACHED(); |
| 400 } | 393 } |
| 401 | 394 |
| 402 } // namespace content | 395 } // namespace content |
| OLD | NEW |