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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_
8 #include "chrome/browser/extensions/api/messaging/message_service.h"
13 class RenderProcessHost
;
14 } // namespace content
16 namespace extensions
{
18 // A port that manages communication with an extension.
19 class ExtensionMessagePort
: public MessageService::MessagePort
{
21 ExtensionMessagePort(content::RenderProcessHost
* process
,
23 const std::string
& extension_id
);
24 void DispatchOnConnect(int dest_port_id
,
25 const std::string
& channel_name
,
26 scoped_ptr
<base::DictionaryValue
> source_tab
,
31 int guest_render_frame_routing_id
,
32 const std::string
& source_extension_id
,
33 const std::string
& target_extension_id
,
34 const GURL
& source_url
,
35 const std::string
& tls_channel_id
) override
;
36 void DispatchOnDisconnect(int source_port_id
,
37 const std::string
& error_message
) override
;
38 void DispatchOnMessage(const Message
& message
, int target_port_id
) override
;
39 void IncrementLazyKeepaliveCount() override
;
40 void DecrementLazyKeepaliveCount() override
;
41 content::RenderProcessHost
* GetRenderProcessHost() override
;
44 content::RenderProcessHost
* process_
;
46 std::string extension_id_
;
47 void* background_host_ptr_
; // used in IncrementLazyKeepaliveCount
50 } // namespace extensions
52 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_EXTENSION_MESSAGE_PORT_H_