| 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/renderer/service_worker/service_worker_script_context.h" | 5 #include "content/renderer/service_worker/service_worker_script_context.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ServiceWorkerScriptContext::OnFetchEvent( | 144 void ServiceWorkerScriptContext::OnFetchEvent( |
| 145 int request_id, | 145 int request_id, |
| 146 const ServiceWorkerFetchRequest& request) { | 146 const ServiceWorkerFetchRequest& request) { |
| 147 blink::WebServiceWorkerRequest webRequest; | 147 blink::WebServiceWorkerRequest webRequest; |
| 148 TRACE_EVENT0("ServiceWorker", | 148 TRACE_EVENT0("ServiceWorker", |
| 149 "ServiceWorkerScriptContext::OnFetchEvent"); | 149 "ServiceWorkerScriptContext::OnFetchEvent"); |
| 150 webRequest.setURL(blink::WebURL(request.url)); | 150 webRequest.setURL(blink::WebURL(request.url)); |
| 151 webRequest.setMethod(blink::WebString::fromUTF8(request.method)); | 151 webRequest.setMethod(blink::WebString::fromUTF8(request.method)); |
| 152 for (std::map<std::string, std::string>::const_iterator it = | 152 for (ServiceWorkerHeaderMap::const_iterator it = request.headers.begin(); |
| 153 request.headers.begin(); | |
| 154 it != request.headers.end(); | 153 it != request.headers.end(); |
| 155 ++it) { | 154 ++it) { |
| 156 webRequest.setHeader(blink::WebString::fromUTF8(it->first), | 155 webRequest.setHeader(blink::WebString::fromUTF8(it->first), |
| 157 blink::WebString::fromUTF8(it->second)); | 156 blink::WebString::fromUTF8(it->second)); |
| 158 } | 157 } |
| 159 if (!request.blob_uuid.empty()) { | 158 if (!request.blob_uuid.empty()) { |
| 160 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), | 159 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), |
| 161 request.blob_size); | 160 request.blob_size); |
| 162 } | 161 } |
| 163 webRequest.setReferrer(blink::WebString::fromUTF8(request.referrer.spec()), | 162 webRequest.setReferrer(blink::WebString::fromUTF8(request.referrer.spec()), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 return; | 210 return; |
| 212 } | 211 } |
| 213 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( | 212 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( |
| 214 new blink::WebServiceWorkerClientsInfo); | 213 new blink::WebServiceWorkerClientsInfo); |
| 215 info->clientIDs = client_ids; | 214 info->clientIDs = client_ids; |
| 216 callbacks->onSuccess(info.release()); | 215 callbacks->onSuccess(info.release()); |
| 217 pending_clients_callbacks_.Remove(request_id); | 216 pending_clients_callbacks_.Remove(request_id); |
| 218 } | 217 } |
| 219 | 218 |
| 220 } // namespace content | 219 } // namespace content |
| OLD | NEW |