| 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 15 matching lines...) Expand all Loading... |
| 26 #include "extensions/common/constants.h" | 26 #include "extensions/common/constants.h" |
| 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" | 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.
h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.
h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 33 #include "webkit/glue/image_resource_fetcher.h" | 33 #include "webkit/glue/image_resource_fetcher.h" |
| 34 #include "webkit/glue/resource_fetcher.h" | 34 #include "webkit/glue/resource_fetcher.h" |
| 35 | 35 |
| 36 namespace base { | |
| 37 class ListValue; | |
| 38 } // namespace base | |
| 39 | |
| 40 using content::ConsoleMessageLevel; | 36 using content::ConsoleMessageLevel; |
| 41 using WebKit::WebConsoleMessage; | 37 using WebKit::WebConsoleMessage; |
| 42 using WebKit::WebDataSource; | 38 using WebKit::WebDataSource; |
| 43 using WebKit::WebFrame; | 39 using WebKit::WebFrame; |
| 44 using WebKit::WebURLRequest; | 40 using WebKit::WebURLRequest; |
| 45 using WebKit::WebScopedUserGesture; | 41 using WebKit::WebScopedUserGesture; |
| 46 using WebKit::WebView; | 42 using WebKit::WebView; |
| 47 using webkit_glue::ImageResourceFetcher; | 43 using webkit_glue::ImageResourceFetcher; |
| 48 using webkit_glue::ResourceFetcher; | 44 using webkit_glue::ResourceFetcher; |
| 49 | 45 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 web_user_gesture.reset(new WebScopedUserGesture); | 269 web_user_gesture.reset(new WebScopedUserGesture); |
| 274 } | 270 } |
| 275 | 271 |
| 276 dispatcher_->v8_context_set().DispatchChromeHiddenMethod( | 272 dispatcher_->v8_context_set().DispatchChromeHiddenMethod( |
| 277 extension_id, function_name, args, render_view(), event_url); | 273 extension_id, function_name, args, render_view(), event_url); |
| 278 } | 274 } |
| 279 | 275 |
| 280 void ExtensionHelper::OnExtensionDispatchOnConnect( | 276 void ExtensionHelper::OnExtensionDispatchOnConnect( |
| 281 int target_port_id, | 277 int target_port_id, |
| 282 const std::string& channel_name, | 278 const std::string& channel_name, |
| 283 const std::string& tab_json, | 279 const base::DictionaryValue& source_tab, |
| 284 const std::string& source_extension_id, | 280 const ExtensionMsg_ExternalConnectionInfo& info) { |
| 285 const std::string& target_extension_id) { | |
| 286 MiscellaneousBindings::DispatchOnConnect( | 281 MiscellaneousBindings::DispatchOnConnect( |
| 287 dispatcher_->v8_context_set().GetAll(), | 282 dispatcher_->v8_context_set().GetAll(), |
| 288 target_port_id, channel_name, tab_json, | 283 target_port_id, channel_name, source_tab, |
| 289 source_extension_id, target_extension_id, | 284 info.source_id, info.target_id, info.source_url, |
| 290 render_view()); | 285 render_view()); |
| 291 } | 286 } |
| 292 | 287 |
| 293 void ExtensionHelper::OnExtensionDeliverMessage(int target_id, | 288 void ExtensionHelper::OnExtensionDeliverMessage(int target_id, |
| 294 const std::string& message) { | 289 const std::string& message) { |
| 295 MiscellaneousBindings::DeliverMessage(dispatcher_->v8_context_set().GetAll(), | 290 MiscellaneousBindings::DeliverMessage(dispatcher_->v8_context_set().GetAll(), |
| 296 target_id, | 291 target_id, |
| 297 message, | 292 message, |
| 298 render_view()); | 293 render_view()); |
| 299 } | 294 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 v8::Handle<v8::Context> script_context = | 371 v8::Handle<v8::Context> script_context = |
| 377 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 372 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
| 378 ChromeV8Context* chrome_v8_context = | 373 ChromeV8Context* chrome_v8_context = |
| 379 dispatcher_->v8_context_set().GetByV8Context(script_context); | 374 dispatcher_->v8_context_set().GetByV8Context(script_context); |
| 380 if (!chrome_v8_context) | 375 if (!chrome_v8_context) |
| 381 return; | 376 return; |
| 382 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); | 377 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); |
| 383 } | 378 } |
| 384 | 379 |
| 385 } // namespace extensions | 380 } // namespace extensions |
| OLD | NEW |