From d2f46b1d31044a6cb76b2a4695cadfd8ed786d2f Mon Sep 17 00:00:00 2001 From: "kinuko@chromium.org" Date: Thu, 6 Feb 2014 01:34:28 +0000 Subject: Implement ServiceWorkerVersion::DispatchInstallEvent() This doesn't hook any blink code yet, but sends InstallEvent to the child process and dispatches callback for InstallEventFinished response. This depends on: https://codereview.chromium.org/139923005/ BUG=313530 TEST=ServiceWorkerBrowserTest.Install Review URL: https://codereview.chromium.org/142863009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249201 0039d316-1c4b-4281-b951-d872f2087c98 --- .../service_worker/service_worker_script_context.cc | 15 +++++++++++++++ .../service_worker/service_worker_script_context.h | 3 +++ 2 files changed, 18 insertions(+) (limited to 'content/renderer') diff --git a/content/renderer/service_worker/service_worker_script_context.cc b/content/renderer/service_worker/service_worker_script_context.cc index 90d656e..34c858b 100644 --- a/content/renderer/service_worker/service_worker_script_context.cc +++ b/content/renderer/service_worker/service_worker_script_context.cc @@ -29,6 +29,7 @@ void ServiceWorkerScriptContext::OnMessageReceived( current_request_id_ = request_id; bool handled = true; IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) + IPC_MESSAGE_HANDLER(ServiceWorkerMsg_InstallEvent, OnInstallEvent) IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FetchEvent, OnFetchEvent) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -36,11 +37,25 @@ void ServiceWorkerScriptContext::OnMessageReceived( current_request_id_ = -1; } +void ServiceWorkerScriptContext::DidHandleInstallEvent(int request_id) { + Send(request_id, ServiceWorkerHostMsg_InstallEventFinished()); +} + void ServiceWorkerScriptContext::Send(int request_id, const IPC::Message& message) { embedded_context_->SendMessageToBrowser(request_id, message); } +void ServiceWorkerScriptContext::OnInstallEvent( + int active_version_embedded_worker_id) { + // TODO(kinuko): Uncomment this when blink side becomes ready. + // proxy_->dispatchInstallEvent(current_request_id_); + + // TODO(kinuko): this should be called asynchronously from blink side + // when blink-side plumbing is done. + DidHandleInstallEvent(current_request_id_); +} + void ServiceWorkerScriptContext::OnFetchEvent( const ServiceWorkerFetchRequest& request) { NOTIMPLEMENTED(); diff --git a/content/renderer/service_worker/service_worker_script_context.h b/content/renderer/service_worker/service_worker_script_context.h index 9bed978..20c7584 100644 --- a/content/renderer/service_worker/service_worker_script_context.h +++ b/content/renderer/service_worker/service_worker_script_context.h @@ -33,10 +33,13 @@ class ServiceWorkerScriptContext { void OnMessageReceived(int request_id, const IPC::Message& message); + void DidHandleInstallEvent(int request_id); + private: // Send message back to the browser. void Send(int request_id, const IPC::Message& message); + void OnInstallEvent(int active_version_embedded_worker_id); void OnFetchEvent(const ServiceWorkerFetchRequest& request); // Not owned; embedded_context_ owns this. -- cgit v1.1