Index: content/browser/service_worker/service_worker_cache_listener.cc |
diff --git a/content/browser/service_worker/service_worker_cache_listener.cc b/content/browser/service_worker/service_worker_cache_listener.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ee9761ae9c8fca7888a82b1449f9eb6368527fa3 |
--- /dev/null |
+++ b/content/browser/service_worker/service_worker_cache_listener.cc |
@@ -0,0 +1,86 @@ |
+// 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. |
+ |
+#include "content/browser/service_worker/service_worker_cache_listener.h" |
+ |
+#include "content/browser/service_worker/service_worker_version.h" |
+#include "content/common/service_worker/service_worker_messages.h" |
+#include "third_party/WebKit/public/platform/WebServiceWorkerCacheStorageError.h" |
+ |
+namespace content { |
+ |
+ServiceWorkerCacheListener::ServiceWorkerCacheListener( |
+ ServiceWorkerVersion* version) : version_(version) {} |
+ |
+ServiceWorkerCacheListener::~ServiceWorkerCacheListener() {} |
+ |
+bool ServiceWorkerCacheListener::OnMessageReceived( |
+ const IPC::Message& message) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP(ServiceWorkerCacheListener, message) |
+ IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageCreate, |
+ OnCacheStorageCreate) |
+ IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageRename, |
+ OnCacheStorageRename) |
+ IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageGet, |
+ OnCacheStorageGet) |
+ IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageDelete, |
+ OnCacheStorageDelete) |
+ IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheStorageKeys, |
+ OnCacheStorageKeys) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP() |
+ |
+ return handled; |
+} |
+ |
+void ServiceWorkerCacheListener::OnCacheStorageCreate( |
+ int request_id, |
+ const base::string16& key) { |
+ // TODO(gavinp,jkarlin): Implement this method. |
+ Send(ServiceWorkerMsg_CacheStorageCreateError( |
+ request_id, |
+ blink::WebServiceWorkerCacheStorageErrorNotImplemented)); |
+} |
+ |
+ |
+void ServiceWorkerCacheListener::OnCacheStorageRename( |
+ int request_id, |
+ const base::string16& oldKey, |
+ const base::string16& newKey) { |
+ // TODO(gavinp,jkarlin): Implement this method. |
+ Send(ServiceWorkerMsg_CacheStorageRenameError( |
+ request_id, |
+ blink::WebServiceWorkerCacheStorageErrorNotImplemented)); |
+} |
+ |
+void ServiceWorkerCacheListener::OnCacheStorageGet( |
+ int request_id, |
+ const base::string16& key) { |
+ // TODO(gavinp,jkarlin): Implement this method. |
+ Send(ServiceWorkerMsg_CacheStorageGetError( |
+ request_id, |
+ blink::WebServiceWorkerCacheStorageErrorNotImplemented)); |
+} |
+ |
+void ServiceWorkerCacheListener::OnCacheStorageDelete( |
+ int request_id, |
+ const base::string16& key) { |
+ // TODO(gavinp,jkarlin): Implement this method. |
+ Send(ServiceWorkerMsg_CacheStorageDeleteError( |
+ request_id, blink::WebServiceWorkerCacheStorageErrorNotImplemented)); |
+} |
+ |
+void ServiceWorkerCacheListener::OnCacheStorageKeys( |
+ int request_id) { |
+ // TODO(gavinp,jkarlin): Implement this method. |
+ Send(ServiceWorkerMsg_CacheStorageKeysError( |
+ request_id, blink::WebServiceWorkerCacheStorageErrorNotImplemented)); |
+} |
+ |
+void ServiceWorkerCacheListener::Send(const IPC::Message& message) { |
+ version_->embedded_worker()->SendMessage(message); |
+} |
+ |
+} // namespace content |