1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_MESSAGE_FILTER_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_MESSAGE_FILTER_H_
8 #include "content/child/child_message_filter.h"
9 #include "content/common/content_export.h"
12 class MessageLoopProxy;
17 class ThreadSafeSender;
18 struct ServiceWorkerObjectInfo;
19 struct ServiceWorkerRegistrationObjectInfo;
20 struct ServiceWorkerVersionAttributes;
22 class CONTENT_EXPORT ServiceWorkerMessageFilter
23 : public NON_EXPORTED_BASE(ChildMessageFilter) {
25 explicit ServiceWorkerMessageFilter(ThreadSafeSender* thread_safe_sender);
28 virtual ~ServiceWorkerMessageFilter();
31 // ChildMessageFilter implementation:
32 virtual base::TaskRunner* OverrideTaskRunnerForMessage(
33 const IPC::Message& msg) OVERRIDE;
34 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
35 virtual void OnStaleMessageReceived(const IPC::Message& msg) OVERRIDE;
37 // Message handlers for stale messages.
38 void OnStaleRegistered(
41 const ServiceWorkerRegistrationObjectInfo& info,
42 const ServiceWorkerVersionAttributes& attrs);
43 void OnStaleSetVersionAttributes(
46 int registration_handle_id,
48 const ServiceWorkerVersionAttributes& attrs);
49 void OnStaleSetControllerServiceWorker(
52 const ServiceWorkerObjectInfo& info);
54 scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
55 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
57 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerMessageFilter);
60 } // namespace content
62 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_MESSAGE_FILTER_H_