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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_FRAME_HELPER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_FRAME_HELPER_H_
8 #include "content/public/common/console_message_level.h"
9 #include "content/public/renderer/render_frame_observer.h"
10 #include "content/public/renderer/render_frame_observer_tracker.h"
12 struct ExtensionMsg_ExternalConnectionInfo
;
13 struct ExtensionMsg_TabConnectionInfo
;
15 namespace extensions
{
20 // RenderFrame-level plumbing for extension features.
21 class ExtensionFrameHelper
22 : public content::RenderFrameObserver
,
23 public content::RenderFrameObserverTracker
<ExtensionFrameHelper
> {
25 ExtensionFrameHelper(content::RenderFrame
* render_frame
,
26 Dispatcher
* extension_dispatcher
);
27 ~ExtensionFrameHelper() override
;
30 // RenderFrameObserver implementation.
31 void WillReleaseScriptContext(v8::Handle
<v8::Context
>, int world_id
) override
;
32 bool OnMessageReceived(const IPC::Message
& message
) override
;
35 void OnAddMessageToConsole(content::ConsoleMessageLevel level
,
36 const std::string
& message
);
37 void OnExtensionDispatchOnConnect(
39 const std::string
& channel_name
,
40 const ExtensionMsg_TabConnectionInfo
& source
,
41 const ExtensionMsg_ExternalConnectionInfo
& info
,
42 const std::string
& tls_channel_id
);
43 void OnExtensionDeliverMessage(int target_port_id
,
44 const Message
& message
);
45 void OnExtensionDispatchOnDisconnect(int port_id
,
46 const std::string
& error_message
);
48 Dispatcher
* extension_dispatcher_
;
50 DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper
);
53 } // namespace extensions
55 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_FRAME_HELPER_H_