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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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& function_name, | 253 const std::string& function_name, |
254 const base::ListValue& args, | 254 const base::ListValue& args, |
255 const GURL& event_url, | |
256 bool user_gesture) { | 255 bool user_gesture) { |
257 scoped_ptr<WebScopedUserGesture> web_user_gesture; | 256 scoped_ptr<WebScopedUserGesture> web_user_gesture; |
258 if (user_gesture) { | 257 if (user_gesture) { |
259 web_user_gesture.reset(new WebScopedUserGesture); | 258 web_user_gesture.reset(new WebScopedUserGesture); |
260 } | 259 } |
261 | 260 |
262 dispatcher_->v8_context_set().DispatchChromeHiddenMethod( | 261 dispatcher_->v8_context_set().DispatchChromeHiddenMethod( |
263 extension_id, function_name, args, render_view(), event_url); | 262 extension_id, function_name, args, render_view()); |
264 } | 263 } |
265 | 264 |
266 void ExtensionHelper::OnExtensionDispatchOnConnect( | 265 void ExtensionHelper::OnExtensionDispatchOnConnect( |
267 int target_port_id, | 266 int target_port_id, |
268 const std::string& channel_name, | 267 const std::string& channel_name, |
269 const base::DictionaryValue& source_tab, | 268 const base::DictionaryValue& source_tab, |
270 const ExtensionMsg_ExternalConnectionInfo& info) { | 269 const ExtensionMsg_ExternalConnectionInfo& info) { |
271 MiscellaneousBindings::DispatchOnConnect( | 270 MiscellaneousBindings::DispatchOnConnect( |
272 dispatcher_->v8_context_set().GetAll(), | 271 dispatcher_->v8_context_set().GetAll(), |
273 target_port_id, channel_name, source_tab, | 272 target_port_id, channel_name, source_tab, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 v8::Handle<v8::Context> script_context = | 360 v8::Handle<v8::Context> script_context = |
362 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 361 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
363 ChromeV8Context* chrome_v8_context = | 362 ChromeV8Context* chrome_v8_context = |
364 dispatcher_->v8_context_set().GetByV8Context(script_context); | 363 dispatcher_->v8_context_set().GetByV8Context(script_context); |
365 if (!chrome_v8_context) | 364 if (!chrome_v8_context) |
366 return; | 365 return; |
367 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); | 366 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); |
368 } | 367 } |
369 | 368 |
370 } // namespace extensions | 369 } // namespace extensions |
OLD | NEW |