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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_PUSH_MESSAGING_MESSAGE_FILTER_H_
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/browser_message_filter.h"
13 #include "content/public/common/push_messaging_status.h"
18 class PushMessagingService;
19 class ServiceWorkerContextWrapper;
21 class PushMessagingMessageFilter : public BrowserMessageFilter {
23 PushMessagingMessageFilter(
24 int render_process_id,
25 ServiceWorkerContextWrapper* service_worker_context);
28 virtual ~PushMessagingMessageFilter();
30 // BrowserMessageFilter implementation.
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
33 void OnRegister(int render_frame_id,
35 const std::string& sender_id,
37 int service_worker_provider_id);
39 void DoRegister(int render_frame_id,
41 const std::string& sender_id,
44 int64 service_worker_registration_id);
46 void DidRegister(int render_frame_id,
48 const GURL& push_endpoint,
49 const std::string& push_registration_id,
50 PushMessagingStatus status);
52 PushMessagingService* service();
54 int render_process_id_;
55 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
57 // Owned by the content embedder's browsing context.
58 PushMessagingService* service_;
60 base::WeakPtrFactory<PushMessagingMessageFilter> weak_factory_;
62 DISALLOW_COPY_AND_ASSIGN(PushMessagingMessageFilter);
65 } // namespace content
67 #endif // CONTENT_BROWSER_PUSH_MESSAGING_MESSAGE_FILTER_H_