OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker/service_worker_url_request_job.h" | 5 #include "content/browser/service_worker/service_worker_url_request_job.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); | 257 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); |
258 if (info) { | 258 if (info) { |
259 request->is_reload = PageTransitionCoreTypeIs(info->GetPageTransition(), | 259 request->is_reload = PageTransitionCoreTypeIs(info->GetPageTransition(), |
260 PAGE_TRANSITION_RELOAD); | 260 PAGE_TRANSITION_RELOAD); |
261 } | 261 } |
262 return request.Pass(); | 262 return request.Pass(); |
263 } | 263 } |
264 | 264 |
265 bool ServiceWorkerURLRequestJob::CreateRequestBodyBlob(std::string* blob_uuid, | 265 bool ServiceWorkerURLRequestJob::CreateRequestBodyBlob(std::string* blob_uuid, |
266 uint64* blob_size) { | 266 uint64* blob_size) { |
267 if (!body_ || !blob_storage_context_) | 267 if (!body_.get() || !blob_storage_context_) |
268 return false; | 268 return false; |
269 const std::string uuid(base::GenerateGUID()); | 269 const std::string uuid(base::GenerateGUID()); |
270 uint64 size = 0; | 270 uint64 size = 0; |
271 std::vector<const ResourceRequestBody::Element*> resolved_elements; | 271 std::vector<const ResourceRequestBody::Element*> resolved_elements; |
272 for (size_t i = 0; i < body_->elements()->size(); ++i) { | 272 for (size_t i = 0; i < body_->elements()->size(); ++i) { |
273 const ResourceRequestBody::Element& element = (*body_->elements())[i]; | 273 const ResourceRequestBody::Element& element = (*body_->elements())[i]; |
274 if (element.type() != ResourceRequestBody::Element::TYPE_BLOB) { | 274 if (element.type() != ResourceRequestBody::Element::TYPE_BLOB) { |
275 resolved_elements.push_back(&element); | 275 resolved_elements.push_back(&element); |
276 continue; | 276 continue; |
277 } | 277 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 void ServiceWorkerURLRequestJob::DeliverErrorResponse() { | 405 void ServiceWorkerURLRequestJob::DeliverErrorResponse() { |
406 // TODO(falken): Print an error to the console of the ServiceWorker and of | 406 // TODO(falken): Print an error to the console of the ServiceWorker and of |
407 // the requesting page. | 407 // the requesting page. |
408 CreateResponseHeader(500, | 408 CreateResponseHeader(500, |
409 "Service Worker Response Error", | 409 "Service Worker Response Error", |
410 std::map<std::string, std::string>()); | 410 std::map<std::string, std::string>()); |
411 CommitResponseHeader(); | 411 CommitResponseHeader(); |
412 } | 412 } |
413 | 413 |
414 } // namespace content | 414 } // namespace content |
OLD | NEW |