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

Unified Diff: content/browser/service_worker/service_worker_cache_listener.h

Issue 379303002: Content blink::WebServiceWorkerCacheStorage implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: meets presubmit! Created 6 years, 5 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
Index: content/browser/service_worker/service_worker_cache_listener.h
diff --git a/content/browser/service_worker/service_worker_cache_listener.h b/content/browser/service_worker/service_worker_cache_listener.h
new file mode 100644
index 0000000000000000000000000000000000000000..4dcb8274ef9e0f0a15f0b4869b4b22f24e1c00c2
--- /dev/null
+++ b/content/browser/service_worker/service_worker_cache_listener.h
@@ -0,0 +1,48 @@
+// Copyright (c) 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_
+
+#include "base/strings/string16.h"
+#include "content/browser/service_worker/embedded_worker_instance.h"
+
+namespace content {
+
+class ServiceWorkerVersion;
+
+// This class listens for requests on the Cache APIs, and sends response
+// messages to the renderer process. There is one instance per
+// ServiceWorkerVersion instance.
+class ServiceWorkerCacheListener : public EmbeddedWorkerInstance::Listener {
+ public:
+ explicit ServiceWorkerCacheListener(ServiceWorkerVersion* version);
+ virtual ~ServiceWorkerCacheListener();
+
+ // From EmbeddedWorkerInstance::Listener:
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // Message receiver functions for Cache Storage API.
+ void OnCacheStorageCreate(int request_id,
+ const base::string16& key);
+ void OnCacheStorageRename(int request_id,
+ const base::string16& old_key,
+ const base::string16& new_key);
+ void OnCacheStorageGet(int request_id,
+ const base::string16& key);
+ void OnCacheStorageDelete(int request_id,
+ const base::string16& key);
+ void OnCacheStorageKeys(int request_id);
+
+ private:
+ int GetThreadId();
+ void Send(const IPC::Message& message);
+
+ // The ServiceWorkerVersion to use for messaging back to the renderer thread.
+ ServiceWorkerVersion* version_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_

Powered by Google App Engine
This is Rietveld 408576698