OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/api/messaging/message_service.h" | 8 #include "chrome/browser/extensions/api/messaging/message_service.h" |
9 | 9 |
10 class GURL; | 10 class GURL; |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class RenderProcessHost; | 13 class RenderProcessHost; |
14 } // namespace content | 14 } // namespace content |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 // A port that manages communication with an extension. | 18 // A port that manages communication with an extension. |
19 class ExtensionMessagePort : public MessageService::MessagePort { | 19 class ExtensionMessagePort : public MessageService::MessagePort { |
20 public: | 20 public: |
21 ExtensionMessagePort(content::RenderProcessHost* process, | 21 ExtensionMessagePort(content::RenderProcessHost* process, |
22 int routing_id, | 22 int routing_id, |
23 const std::string& extension_id); | 23 const std::string& extension_id); |
24 void DispatchOnConnect(int dest_port_id, | 24 void DispatchOnConnect(int dest_port_id, |
25 const std::string& channel_name, | 25 const std::string& channel_name, |
26 const base::DictionaryValue& source_tab, | 26 scoped_ptr<base::DictionaryValue> source_tab, |
| 27 int source_frame_id, |
27 const std::string& source_extension_id, | 28 const std::string& source_extension_id, |
28 const std::string& target_extension_id, | 29 const std::string& target_extension_id, |
29 const GURL& source_url, | 30 const GURL& source_url, |
30 const std::string& tls_channel_id) override; | 31 const std::string& tls_channel_id) override; |
31 void DispatchOnDisconnect(int source_port_id, | 32 void DispatchOnDisconnect(int source_port_id, |
32 const std::string& error_message) override; | 33 const std::string& error_message) override; |
33 void DispatchOnMessage(const Message& message, int target_port_id) override; | 34 void DispatchOnMessage(const Message& message, int target_port_id) override; |
34 void IncrementLazyKeepaliveCount() override; | 35 void IncrementLazyKeepaliveCount() override; |
35 void DecrementLazyKeepaliveCount() override; | 36 void DecrementLazyKeepaliveCount() override; |
36 content::RenderProcessHost* GetRenderProcessHost() override; | 37 content::RenderProcessHost* GetRenderProcessHost() override; |
37 | 38 |
38 private: | 39 private: |
39 content::RenderProcessHost* process_; | 40 content::RenderProcessHost* process_; |
40 int routing_id_; | 41 int routing_id_; |
41 std::string extension_id_; | 42 std::string extension_id_; |
42 void* background_host_ptr_; // used in IncrementLazyKeepaliveCount | 43 void* background_host_ptr_; // used in IncrementLazyKeepaliveCount |
43 }; | 44 }; |
44 | 45 |
45 } // namespace extensions | 46 } // namespace extensions |
46 | 47 |
47 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ | 48 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_ |
OLD | NEW |