| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/renderer/extensions/extension_helper.h" | 5 #include "chrome/renderer/extensions/extension_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 bool success, | 243 bool success, |
| 244 const base::ListValue& response, | 244 const base::ListValue& response, |
| 245 const std::string& error) { | 245 const std::string& error) { |
| 246 dispatcher_->OnExtensionResponse(request_id, | 246 dispatcher_->OnExtensionResponse(request_id, |
| 247 success, | 247 success, |
| 248 response, | 248 response, |
| 249 error); | 249 error); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id, | 252 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id, |
| 253 const std::string& module_name, |
| 253 const std::string& function_name, | 254 const std::string& function_name, |
| 254 const base::ListValue& args, | 255 const base::ListValue& args, |
| 255 bool user_gesture) { | 256 bool user_gesture) { |
| 256 scoped_ptr<WebScopedUserGesture> web_user_gesture; | 257 dispatcher_->InvokeModuleSystemMethod( |
| 257 if (user_gesture) { | 258 render_view(), extension_id, module_name, function_name, args, |
| 258 web_user_gesture.reset(new WebScopedUserGesture); | 259 user_gesture); |
| 259 } | |
| 260 | |
| 261 dispatcher_->v8_context_set().DispatchChromeHiddenMethod( | |
| 262 extension_id, function_name, args, render_view()); | |
| 263 } | 260 } |
| 264 | 261 |
| 265 void ExtensionHelper::OnExtensionDispatchOnConnect( | 262 void ExtensionHelper::OnExtensionDispatchOnConnect( |
| 266 int target_port_id, | 263 int target_port_id, |
| 267 const std::string& channel_name, | 264 const std::string& channel_name, |
| 268 const base::DictionaryValue& source_tab, | 265 const base::DictionaryValue& source_tab, |
| 269 const ExtensionMsg_ExternalConnectionInfo& info) { | 266 const ExtensionMsg_ExternalConnectionInfo& info) { |
| 270 MiscellaneousBindings::DispatchOnConnect( | 267 MiscellaneousBindings::DispatchOnConnect( |
| 271 dispatcher_->v8_context_set().GetAll(), | 268 dispatcher_->v8_context_set().GetAll(), |
| 272 target_port_id, channel_name, source_tab, | 269 target_port_id, channel_name, source_tab, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 354 } |
| 358 | 355 |
| 359 void ExtensionHelper::OnAppWindowClosed() { | 356 void ExtensionHelper::OnAppWindowClosed() { |
| 360 v8::HandleScope scope; | 357 v8::HandleScope scope; |
| 361 v8::Handle<v8::Context> script_context = | 358 v8::Handle<v8::Context> script_context = |
| 362 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 359 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
| 363 ChromeV8Context* chrome_v8_context = | 360 ChromeV8Context* chrome_v8_context = |
| 364 dispatcher_->v8_context_set().GetByV8Context(script_context); | 361 dispatcher_->v8_context_set().GetByV8Context(script_context); |
| 365 if (!chrome_v8_context) | 362 if (!chrome_v8_context) |
| 366 return; | 363 return; |
| 367 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); | 364 chrome_v8_context->module_system()->CallModuleMethod( |
| 365 "app.window", "onAppWindowClosed"); |
| 368 } | 366 } |
| 369 | 367 |
| 370 } // namespace extensions | 368 } // namespace extensions |
| OLD | NEW |