OLD | NEW |
| (Empty) |
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_PUBLIC_BROWSER_MESSAGE_PORT_DELEGATE_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_DELEGATE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/strings/string16.h" | |
11 #include "content/common/content_export.h" | |
12 | |
13 // Windows headers will redefine SendMessage. | |
14 #ifdef SendMessage | |
15 #undef SendMessage | |
16 #endif | |
17 | |
18 namespace content { | |
19 | |
20 // Delegate used by MessagePortService to send messages to message ports to the | |
21 // correct renderer. Delegates are responsible for managing their own lifetime, | |
22 // and should call MessagePortService::OnMessagePortDelegateClosing if they are | |
23 // destroyed while there are still message ports associated with them. | |
24 class CONTENT_EXPORT MessagePortDelegate { | |
25 public: | |
26 // Sends a message to the given route. Implementations are responsible for | |
27 // updating MessagePortService with new routes for the sent message ports. | |
28 virtual void SendMessage( | |
29 int route_id, | |
30 const base::string16& message, | |
31 const std::vector<int>& sent_message_ports) = 0; | |
32 | |
33 // Requests messages to the given route to be queued. | |
34 virtual void SendMessagesAreQueued(int route_id) = 0; | |
35 | |
36 protected: | |
37 virtual ~MessagePortDelegate() {} | |
38 }; | |
39 | |
40 } // namespace content | |
41 | |
42 #endif // CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_DELEGATE_H_ | |
OLD | NEW |