OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // Filter for MessagePort related IPC messages (creating and destroying a | 14 // Filter for MessagePort related IPC messages (creating and destroying a |
15 // MessagePort, sending a message via a MessagePort etc). | 15 // MessagePort, sending a message via a MessagePort etc). |
16 class CONTENT_EXPORT MessagePortMessageFilter : public BrowserMessageFilter { | 16 class CONTENT_EXPORT MessagePortMessageFilter : public BrowserMessageFilter { |
17 public: | 17 public: |
18 typedef base::Callback<int(void)> NextRoutingIDCallback; | 18 typedef base::Callback<int(void)> NextRoutingIDCallback; |
19 | 19 |
20 // |next_routing_id| is owned by this object. It can be used up until | 20 // |next_routing_id| is owned by this object. It can be used up until |
21 // OnChannelClosing. | 21 // OnChannelClosing. |
22 explicit MessagePortMessageFilter(const NextRoutingIDCallback& callback); | 22 explicit MessagePortMessageFilter(const NextRoutingIDCallback& callback); |
23 | 23 |
24 // BrowserMessageFilter implementation. | 24 // BrowserMessageFilter implementation. |
25 virtual void OnChannelClosing() OVERRIDE; | 25 virtual void OnChannelClosing() OVERRIDE; |
26 virtual bool OnMessageReceived(const IPC::Message& message, | 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
27 bool* message_was_ok) OVERRIDE; | |
28 virtual void OnDestruct() const OVERRIDE; | 27 virtual void OnDestruct() const OVERRIDE; |
29 | 28 |
30 int GetNextRoutingID(); | 29 int GetNextRoutingID(); |
31 | 30 |
32 // Updates message ports registered for |message_port_ids| and returns | 31 // Updates message ports registered for |message_port_ids| and returns |
33 // new routing IDs for the updated ports via |new_routing_ids|. | 32 // new routing IDs for the updated ports via |new_routing_ids|. |
34 void UpdateMessagePortsWithNewRoutes( | 33 void UpdateMessagePortsWithNewRoutes( |
35 const std::vector<int>& message_port_ids, | 34 const std::vector<int>& message_port_ids, |
36 std::vector<int>* new_routing_ids); | 35 std::vector<int>* new_routing_ids); |
37 | 36 |
(...skipping 11 matching lines...) Expand all Loading... |
49 // This is guaranteed to be valid until OnChannelClosing is invoked, and it's | 48 // This is guaranteed to be valid until OnChannelClosing is invoked, and it's |
50 // not used after. | 49 // not used after. |
51 NextRoutingIDCallback next_routing_id_; | 50 NextRoutingIDCallback next_routing_id_; |
52 | 51 |
53 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortMessageFilter); | 52 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortMessageFilter); |
54 }; | 53 }; |
55 | 54 |
56 } // namespace content | 55 } // namespace content |
57 | 56 |
58 #endif // CONTENT_BROWSER_WORKER_MESSAGE_FILTER_H_ | 57 #endif // CONTENT_BROWSER_WORKER_MESSAGE_FILTER_H_ |
OLD | NEW |