Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1522)

Unified Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 305893003: ServiceWorker: support Request.{url,method,origin,headers} [chromium] (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove #include "base/strings/utf_string_conversions.h" Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/service_worker/service_worker_script_context.cc
diff --git a/content/renderer/service_worker/service_worker_script_context.cc b/content/renderer/service_worker/service_worker_script_context.cc
index bb3bf9a1b1821c566df3fa7776a540a3e301fbc8..e76bc6504021c480103ae2da11b3855f19c88e67 100644
--- a/content/renderer/service_worker/service_worker_script_context.cc
+++ b/content/renderer/service_worker/service_worker_script_context.cc
@@ -10,6 +10,8 @@
#include "content/common/service_worker/service_worker_messages.h"
#include "content/renderer/service_worker/embedded_worker_context_client.h"
#include "ipc/ipc_message.h"
+#include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h"
#include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h"
@@ -121,8 +123,17 @@ void ServiceWorkerScriptContext::OnInstallEvent(int request_id,
void ServiceWorkerScriptContext::OnFetchEvent(
int request_id,
const ServiceWorkerFetchRequest& request) {
- // TODO(falken): Pass in the request.
- proxy_->dispatchFetchEvent(request_id);
+ blink::WebServiceWorkerRequest webRequest;
+ webRequest.setURL(blink::WebURL(request.url));
+ webRequest.setMethod(blink::WebString::fromUTF8(request.method));
+ for (std::map<std::string, std::string>::const_iterator it =
+ request.headers.begin();
+ it != request.headers.end();
+ ++it) {
+ webRequest.setHeader(blink::WebString::fromUTF8(it->first),
+ blink::WebString::fromUTF8(it->second));
+ }
+ proxy_->dispatchFetchEvent(request_id, webRequest);
}
void ServiceWorkerScriptContext::OnSyncEvent(int request_id) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698