This source file includes following definitions.
- extension_dispatcher_
- WillReleaseScriptContext
- OnMessageReceived
- OnAddMessageToConsole
#include "chrome/renderer/extensions/extension_frame_helper.h"
#include "chrome/renderer/extensions/console.h"
#include "chrome/renderer/extensions/dispatcher.h"
#include "content/public/renderer/render_frame.h"
#include "extensions/common/extension_messages.h"
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
#include "third_party/WebKit/public/web/WebFrame.h"
namespace extensions {
ExtensionFrameHelper::ExtensionFrameHelper(content::RenderFrame* render_frame,
Dispatcher* extension_dispatcher)
: content::RenderFrameObserver(render_frame),
content::RenderFrameObserverTracker<ExtensionFrameHelper>(render_frame),
extension_dispatcher_(extension_dispatcher) {}
ExtensionFrameHelper::~ExtensionFrameHelper() {
}
void ExtensionFrameHelper::WillReleaseScriptContext(
v8::Handle<v8::Context> context,
int world_id) {
extension_dispatcher_->WillReleaseScriptContext(
render_frame()->GetWebFrame(), context, world_id);
}
bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ExtensionFrameHelper, message)
IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole,
OnAddMessageToConsole)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void ExtensionFrameHelper::OnAddMessageToConsole(
content::ConsoleMessageLevel level,
const std::string& message) {
console::AddMessage(render_frame()->GetRenderView(), level, message);
}
}