Index: content/renderer/service_worker/service_worker_script_context.h |
diff --git a/content/renderer/service_worker/service_worker_script_context.h b/content/renderer/service_worker/service_worker_script_context.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..86f1d8e5edc5fc390b4dc6f1a36f3b5106559904 |
--- /dev/null |
+++ b/content/renderer/service_worker/service_worker_script_context.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
+#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
+ |
+#include "base/basictypes.h" |
+ |
+namespace blink { |
+class WebServiceWorkerContextProxy; |
+} |
+ |
+namespace IPC { |
+class Message; |
+} |
+ |
+namespace content { |
+ |
+class EmbeddedWorkerContextClient; |
+struct ServiceWorkerFetchRequest; |
+ |
+// TODO(kinuko): This should implement WebServiceWorkerContextClient |
+// rather than having EmbeddedWorkerContextClient implement it. |
+// See the header comment in embedded_worker_context_client.h for the |
+// potential EW/SW layering concerns. |
+class ServiceWorkerScriptContext { |
+ public: |
+ ServiceWorkerScriptContext( |
+ EmbeddedWorkerContextClient* embedded_context, |
+ blink::WebServiceWorkerContextProxy* proxy); |
+ ~ServiceWorkerScriptContext(); |
+ |
+ void OnMessageReceived(const IPC::Message& message); |
+ |
+ private: |
+ // Send message back to the browser. |
+ void Send(const IPC::Message& message); |
+ |
+ void OnFetchEvent(const ServiceWorkerFetchRequest& request); |
+ |
+ // Not owned; embedded_context_ owns this. |
+ EmbeddedWorkerContextClient* embedded_context_; |
+ |
+ // Not owned; this object is destroyed when proxy_ becomes invalid. |
+ blink::WebServiceWorkerContextProxy* proxy_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |