OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "extensions/renderer/extension_frame_helper.h" | 5 #include "extensions/renderer/extension_frame_helper.h" |
6 | 6 |
7 #include "content/public/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
8 #include "extensions/common/api/messaging/message.h" | 8 #include "extensions/common/api/messaging/message.h" |
9 #include "extensions/common/extension_messages.h" | 9 #include "extensions/common/extension_messages.h" |
10 #include "extensions/renderer/console.h" | 10 #include "extensions/renderer/console.h" |
11 #include "extensions/renderer/dispatcher.h" | 11 #include "extensions/renderer/dispatcher.h" |
12 #include "extensions/renderer/messaging_bindings.h" | 12 #include "extensions/renderer/messaging_bindings.h" |
13 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 13 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
14 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 14 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 ExtensionFrameHelper::ExtensionFrameHelper(content::RenderFrame* render_frame, | 18 ExtensionFrameHelper::ExtensionFrameHelper(content::RenderFrame* render_frame, |
19 Dispatcher* extension_dispatcher) | 19 Dispatcher* extension_dispatcher) |
20 : content::RenderFrameObserver(render_frame), | 20 : content::RenderFrameObserver(render_frame), |
21 content::RenderFrameObserverTracker<ExtensionFrameHelper>(render_frame), | 21 content::RenderFrameObserverTracker<ExtensionFrameHelper>(render_frame), |
22 extension_dispatcher_(extension_dispatcher) {} | 22 extension_dispatcher_(extension_dispatcher) {} |
23 | 23 |
24 ExtensionFrameHelper::~ExtensionFrameHelper() { | 24 ExtensionFrameHelper::~ExtensionFrameHelper() { |
25 } | 25 } |
26 | 26 |
27 void ExtensionFrameHelper::DidCreateScriptContext( | 27 void ExtensionFrameHelper::DidCreateScriptContext( |
28 v8::Handle<v8::Context> context, | 28 v8::Local<v8::Context> context, |
29 int extension_group, | 29 int extension_group, |
30 int world_id) { | 30 int world_id) { |
31 extension_dispatcher_->DidCreateScriptContext( | 31 extension_dispatcher_->DidCreateScriptContext( |
32 render_frame()->GetWebFrame(), context, extension_group, world_id); | 32 render_frame()->GetWebFrame(), context, extension_group, world_id); |
33 } | 33 } |
34 | 34 |
35 void ExtensionFrameHelper::WillReleaseScriptContext( | 35 void ExtensionFrameHelper::WillReleaseScriptContext( |
36 v8::Handle<v8::Context> context, | 36 v8::Local<v8::Context> context, |
37 int world_id) { | 37 int world_id) { |
38 extension_dispatcher_->WillReleaseScriptContext( | 38 extension_dispatcher_->WillReleaseScriptContext( |
39 render_frame()->GetWebFrame(), context, world_id); | 39 render_frame()->GetWebFrame(), context, world_id); |
40 } | 40 } |
41 | 41 |
42 bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) { | 42 bool ExtensionFrameHelper::OnMessageReceived(const IPC::Message& message) { |
43 bool handled = true; | 43 bool handled = true; |
44 IPC_BEGIN_MESSAGE_MAP(ExtensionFrameHelper, message) | 44 IPC_BEGIN_MESSAGE_MAP(ExtensionFrameHelper, message) |
45 IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole, | 45 IPC_MESSAGE_HANDLER(ExtensionMsg_AddMessageToConsole, |
46 OnAddMessageToConsole) | 46 OnAddMessageToConsole) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void ExtensionFrameHelper::OnExtensionDispatchOnDisconnect( | 86 void ExtensionFrameHelper::OnExtensionDispatchOnDisconnect( |
87 int port_id, | 87 int port_id, |
88 const std::string& error_message) { | 88 const std::string& error_message) { |
89 MessagingBindings::DispatchOnDisconnect( | 89 MessagingBindings::DispatchOnDisconnect( |
90 extension_dispatcher_->script_context_set(), port_id, error_message, | 90 extension_dispatcher_->script_context_set(), port_id, error_message, |
91 render_frame()); | 91 render_frame()); |
92 } | 92 } |
93 | 93 |
94 } // namespace extensions | 94 } // namespace extensions |
OLD | NEW |