Chromium Code Reviews| 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 "base/debug/stack_trace.h" | |
|
nhiroki
2014/02/14 09:03:21
It looks like this is not used for now. Are you pl
kinuko
2014/02/14 09:19:13
This is WIP patch, I believe it's for his local de
nhiroki
2014/02/14 09:41:50
Ah, that make sense.
falken
2014/02/19 05:32:19
Right it was just for debugging. Removed.
| |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "content/common/service_worker/service_worker_messages.h" | 9 #include "content/common/service_worker/service_worker_messages.h" |
| 9 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 10 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
| 10 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
| 11 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 12 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 ServiceWorkerScriptContext::ServiceWorkerScriptContext( | 16 ServiceWorkerScriptContext::ServiceWorkerScriptContext( |
| 16 EmbeddedWorkerContextClient* embedded_context, | 17 EmbeddedWorkerContextClient* embedded_context, |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 34 IPC_MESSAGE_UNHANDLED(handled = false) | 35 IPC_MESSAGE_UNHANDLED(handled = false) |
| 35 IPC_END_MESSAGE_MAP() | 36 IPC_END_MESSAGE_MAP() |
| 36 DCHECK(handled); | 37 DCHECK(handled); |
| 37 current_request_id_ = kInvalidRequestId; | 38 current_request_id_ = kInvalidRequestId; |
| 38 } | 39 } |
| 39 | 40 |
| 40 void ServiceWorkerScriptContext::DidHandleInstallEvent(int request_id) { | 41 void ServiceWorkerScriptContext::DidHandleInstallEvent(int request_id) { |
| 41 Send(request_id, ServiceWorkerHostMsg_InstallEventFinished()); | 42 Send(request_id, ServiceWorkerHostMsg_InstallEventFinished()); |
| 42 } | 43 } |
| 43 | 44 |
| 45 void ServiceWorkerScriptContext::DidHandleFetchEvent( | |
| 46 int request_id, | |
| 47 const ServiceWorkerFetchResponse& response) { | |
| 48 Send(request_id, ServiceWorkerHostMsg_FetchEventFinished(response)); | |
| 49 } | |
| 50 | |
| 44 void ServiceWorkerScriptContext::Send(int request_id, | 51 void ServiceWorkerScriptContext::Send(int request_id, |
| 45 const IPC::Message& message) { | 52 const IPC::Message& message) { |
| 46 embedded_context_->SendMessageToBrowser(request_id, message); | 53 embedded_context_->SendMessageToBrowser(request_id, message); |
| 47 } | 54 } |
| 48 | 55 |
| 49 void ServiceWorkerScriptContext::OnInstallEvent( | 56 void ServiceWorkerScriptContext::OnInstallEvent( |
| 50 int active_version_embedded_worker_id) { | 57 int active_version_embedded_worker_id) { |
| 51 proxy_->dispatchInstallEvent(current_request_id_); | 58 proxy_->dispatchInstallEvent(current_request_id_); |
| 52 } | 59 } |
| 53 | 60 |
| 54 void ServiceWorkerScriptContext::OnFetchEvent( | 61 void ServiceWorkerScriptContext::OnFetchEvent( |
| 55 const ServiceWorkerFetchRequest& request) { | 62 const ServiceWorkerFetchRequest& request) { |
| 56 NOTIMPLEMENTED(); | 63 // TODO(falken): Dispatch the event to Blink and wait for the response from |
| 64 // respondWith. This is just a dummy response now. | |
| 65 DidHandleFetchEvent(current_request_id_, ServiceWorkerFetchResponse( | |
| 66 200, "OK", "GET", std::map<std::string, std::string>())); | |
| 57 } | 67 } |
| 58 | 68 |
| 59 } // namespace content | 69 } // namespace content |
| OLD | NEW |