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. 4 5 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_MESSAGE_FILTER_H_ 6 #define CONTENT_BROWSER_PUSH_MESSAGING_MESSAGE_FILTER_H_ 7 8 #include <string> 9 10 #include "base/memory/weak_ptr.h" 11 #include "content/public/browser/browser_message_filter.h" 12 #include "url/gurl.h" 13 14 namespace content { 15 16 class PushMessagingService; 17 18 class PushMessagingMessageFilter : public BrowserMessageFilter { 19 public: 20 explicit PushMessagingMessageFilter(int render_process_id); 21 22 private: 23 virtual ~PushMessagingMessageFilter(); 24 25 // BrowserMessageFilter implementation. 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 27 28 void OnRegister(int routing_id, 29 int callbacks_id, 30 const std::string& sender_id); 31 32 void DoRegister(int routing_id, 33 int callbacks_id, 34 const std::string& sender_id); 35 36 void DidRegister(int routing_id, 37 int callbacks_id, 38 const GURL& endpoint, 39 const std::string& registration_id, 40 bool success); 41 42 PushMessagingService* service(); 43 44 int render_process_id_; 45 PushMessagingService* service_; // Not owned. 46 47 base::WeakPtrFactory<PushMessagingMessageFilter> weak_factory_; 48 49 DISALLOW_COPY_AND_ASSIGN(PushMessagingMessageFilter); 50 }; 51 52 } // namespace content 53 54 #endif // CONTENT_BROWSER_PUSH_MESSAGING_MESSAGE_FILTER_H_ 55