| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_helper.h" | 5 #include "extensions/renderer/extension_helper.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "content/public/renderer/render_view.h" | 8 #include "content/public/renderer/render_view.h" |
| 9 #include "content/public/renderer/render_view_visitor.h" | 9 #include "content/public/renderer/render_view_visitor.h" |
| 10 #include "extensions/common/api/messaging/message.h" | 10 #include "extensions/common/api/messaging/message.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 render_view(), extension_id, module_name, function_name, args, | 260 render_view(), extension_id, module_name, function_name, args, |
| 261 user_gesture); | 261 user_gesture); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void ExtensionHelper::OnExtensionDispatchOnConnect( | 264 void ExtensionHelper::OnExtensionDispatchOnConnect( |
| 265 int target_port_id, | 265 int target_port_id, |
| 266 const std::string& channel_name, | 266 const std::string& channel_name, |
| 267 const base::DictionaryValue& source_tab, | 267 const base::DictionaryValue& source_tab, |
| 268 const ExtensionMsg_ExternalConnectionInfo& info, | 268 const ExtensionMsg_ExternalConnectionInfo& info, |
| 269 const std::string& tls_channel_id) { | 269 const std::string& tls_channel_id) { |
| 270 MessagingBindings::DispatchOnConnect( | 270 MessagingBindings::DispatchOnConnect(dispatcher_->script_context_set(), |
| 271 dispatcher_->script_context_set().GetAll(), | 271 target_port_id, |
| 272 target_port_id, | 272 channel_name, |
| 273 channel_name, | 273 source_tab, |
| 274 source_tab, | 274 info, |
| 275 info.source_id, | 275 tls_channel_id, |
| 276 info.target_id, | 276 render_view()); |
| 277 info.source_url, | |
| 278 tls_channel_id, | |
| 279 render_view()); | |
| 280 } | 277 } |
| 281 | 278 |
| 282 void ExtensionHelper::OnExtensionDeliverMessage(int target_id, | 279 void ExtensionHelper::OnExtensionDeliverMessage(int target_id, |
| 283 const Message& message) { | 280 const Message& message) { |
| 284 MessagingBindings::DeliverMessage(dispatcher_->script_context_set().GetAll(), | 281 MessagingBindings::DeliverMessage( |
| 285 target_id, | 282 dispatcher_->script_context_set(), target_id, message, render_view()); |
| 286 message, | |
| 287 render_view()); | |
| 288 } | 283 } |
| 289 | 284 |
| 290 void ExtensionHelper::OnExtensionDispatchOnDisconnect( | 285 void ExtensionHelper::OnExtensionDispatchOnDisconnect( |
| 291 int port_id, | 286 int port_id, |
| 292 const std::string& error_message) { | 287 const std::string& error_message) { |
| 293 MessagingBindings::DispatchOnDisconnect( | 288 MessagingBindings::DispatchOnDisconnect( |
| 294 dispatcher_->script_context_set().GetAll(), | 289 dispatcher_->script_context_set(), port_id, error_message, render_view()); |
| 295 port_id, | |
| 296 error_message, | |
| 297 render_view()); | |
| 298 } | 290 } |
| 299 | 291 |
| 300 void ExtensionHelper::OnExecuteCode( | 292 void ExtensionHelper::OnExecuteCode( |
| 301 const ExtensionMsg_ExecuteCode_Params& params) { | 293 const ExtensionMsg_ExecuteCode_Params& params) { |
| 302 WebView* webview = render_view()->GetWebView(); | 294 WebView* webview = render_view()->GetWebView(); |
| 303 WebFrame* main_frame = webview->mainFrame(); | 295 WebFrame* main_frame = webview->mainFrame(); |
| 304 if (!main_frame) { | 296 if (!main_frame) { |
| 305 base::ListValue val; | 297 base::ListValue val; |
| 306 Send(new ExtensionHostMsg_ExecuteCodeFinished(routing_id(), | 298 Send(new ExtensionHostMsg_ExecuteCodeFinished(routing_id(), |
| 307 params.request_id, | 299 params.request_id, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 script_context->module_system()->CallModuleMethod("app.window", | 341 script_context->module_system()->CallModuleMethod("app.window", |
| 350 "onAppWindowClosed"); | 342 "onAppWindowClosed"); |
| 351 } | 343 } |
| 352 | 344 |
| 353 void ExtensionHelper::OnGrantContentScriptPermission(int request_id) { | 345 void ExtensionHelper::OnGrantContentScriptPermission(int request_id) { |
| 354 dispatcher_->user_script_slave()->OnContentScriptGrantedPermission( | 346 dispatcher_->user_script_slave()->OnContentScriptGrantedPermission( |
| 355 render_view(), request_id); | 347 render_view(), request_id); |
| 356 } | 348 } |
| 357 | 349 |
| 358 } // namespace extensions | 350 } // namespace extensions |
| OLD | NEW |