| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 port_id, error_message, | 306 port_id, error_message, |
| 307 render_view()); | 307 render_view()); |
| 308 } | 308 } |
| 309 | 309 |
| 310 void ExtensionHelper::OnExecuteCode( | 310 void ExtensionHelper::OnExecuteCode( |
| 311 const ExtensionMsg_ExecuteCode_Params& params) { | 311 const ExtensionMsg_ExecuteCode_Params& params) { |
| 312 WebView* webview = render_view()->GetWebView(); | 312 WebView* webview = render_view()->GetWebView(); |
| 313 WebFrame* main_frame = webview->mainFrame(); | 313 WebFrame* main_frame = webview->mainFrame(); |
| 314 if (!main_frame) { | 314 if (!main_frame) { |
| 315 ListValue val; | 315 ListValue val; |
| 316 Send(new ExtensionHostMsg_ExecuteCodeFinished( | 316 Send(new ExtensionHostMsg_ExecuteCodeFinished(routing_id(), |
| 317 routing_id(), params.request_id, "No main frame", -1, GURL(""), val)); | 317 params.request_id, |
| 318 "No main frame", |
| 319 -1, |
| 320 GURL(std::string()), |
| 321 val)); |
| 318 return; | 322 return; |
| 319 } | 323 } |
| 320 | 324 |
| 321 // chrome.tabs.executeScript() only supports execution in either the top frame | 325 // chrome.tabs.executeScript() only supports execution in either the top frame |
| 322 // or all frames. We handle both cases in the top frame. | 326 // or all frames. We handle both cases in the top frame. |
| 323 SchedulerMap::iterator i = g_schedulers.Get().find(main_frame); | 327 SchedulerMap::iterator i = g_schedulers.Get().find(main_frame); |
| 324 if (i != g_schedulers.Get().end()) | 328 if (i != g_schedulers.Get().end()) |
| 325 i->second->ExecuteCode(params); | 329 i->second->ExecuteCode(params); |
| 326 } | 330 } |
| 327 | 331 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 v8::Handle<v8::Context> script_context = | 376 v8::Handle<v8::Context> script_context = |
| 373 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 377 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
| 374 ChromeV8Context* chrome_v8_context = | 378 ChromeV8Context* chrome_v8_context = |
| 375 dispatcher_->v8_context_set().GetByV8Context(script_context); | 379 dispatcher_->v8_context_set().GetByV8Context(script_context); |
| 376 if (!chrome_v8_context) | 380 if (!chrome_v8_context) |
| 377 return; | 381 return; |
| 378 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); | 382 chrome_v8_context->CallChromeHiddenMethod("OnAppWindowClosed", 0, NULL, NULL); |
| 379 } | 383 } |
| 380 | 384 |
| 381 } // namespace extensions | 385 } // namespace extensions |
| OLD | NEW |