| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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_ANDROID_APP_WEB_MESSAGE_PORT_MESSAGE_FILTER_H_ | |
| 6 #define CONTENT_BROWSER_ANDROID_APP_WEB_MESSAGE_PORT_MESSAGE_FILTER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "content/public/browser/browser_message_filter.h" | |
| 11 #include "content/public/browser/message_port_delegate.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 // Filter for Aw specific MessagePort related IPC messages (creating and | |
| 16 // destroying a MessagePort, sending a message via a MessagePort etc). | |
| 17 class AppWebMessagePortMessageFilter : public content::BrowserMessageFilter, | |
| 18 public content::MessagePortDelegate { | |
| 19 public: | |
| 20 explicit AppWebMessagePortMessageFilter(int route_id); | |
| 21 | |
| 22 // BrowserMessageFilter implementation. | |
| 23 void OnChannelClosing() override; | |
| 24 bool OnMessageReceived(const IPC::Message& message) override; | |
| 25 void OnDestruct() const override; | |
| 26 | |
| 27 void SendAppToWebMessage(int msg_port_route_id, | |
| 28 const base::string16& message, | |
| 29 const std::vector<int>& sent_message_port_ids); | |
| 30 void SendClosePortMessage(int message_port_id); | |
| 31 | |
| 32 // MessagePortDelegate implementation. | |
| 33 void SendMessage(int msg_port_route_id, | |
| 34 const base::string16& message, | |
| 35 const std::vector<int>& sent_message_ports) override; | |
| 36 void SendMessagesAreQueued(int route_id) override; | |
| 37 | |
| 38 private: | |
| 39 friend class content::BrowserThread; | |
| 40 friend class base::DeleteHelper<AppWebMessagePortMessageFilter>; | |
| 41 | |
| 42 void OnConvertedAppToWebMessage( | |
| 43 int msg_port_id, | |
| 44 const base::string16& message, | |
| 45 const std::vector<int>& sent_message_port_ids); | |
| 46 void OnClosePortAck(int message_port_id); | |
| 47 | |
| 48 int route_id_; | |
| 49 | |
| 50 ~AppWebMessagePortMessageFilter() override; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(AppWebMessagePortMessageFilter); | |
| 53 }; | |
| 54 | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_BROWSER_ANDROID_APP_WEB_MESSAGE_PORT_MESSAGE_FILTER_H_ | |
| OLD | NEW |