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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 render_view()); | 338 render_view()); |
339 } | 339 } |
340 | 340 |
341 void ExtensionHelper::OnExecuteCode( | 341 void ExtensionHelper::OnExecuteCode( |
342 const ExtensionMsg_ExecuteCode_Params& params) { | 342 const ExtensionMsg_ExecuteCode_Params& params) { |
343 WebView* webview = render_view()->GetWebView(); | 343 WebView* webview = render_view()->GetWebView(); |
344 WebFrame* main_frame = webview->mainFrame(); | 344 WebFrame* main_frame = webview->mainFrame(); |
345 if (!main_frame) { | 345 if (!main_frame) { |
346 ListValue val; | 346 ListValue val; |
347 Send(new ExtensionHostMsg_ExecuteCodeFinished( | 347 Send(new ExtensionHostMsg_ExecuteCodeFinished( |
348 routing_id(), params.request_id, false, -1, "", val)); | 348 routing_id(), params.request_id, "No main frame", -1, GURL(""), val)); |
349 return; | 349 return; |
350 } | 350 } |
351 | 351 |
352 // chrome.tabs.executeScript() only supports execution in either the top frame | 352 // chrome.tabs.executeScript() only supports execution in either the top frame |
353 // or all frames. We handle both cases in the top frame. | 353 // or all frames. We handle both cases in the top frame. |
354 SchedulerMap::iterator i = g_schedulers.Get().find(main_frame); | 354 SchedulerMap::iterator i = g_schedulers.Get().find(main_frame); |
355 if (i != g_schedulers.Get().end()) | 355 if (i != g_schedulers.Get().end()) |
356 i->second->ExecuteCode(params); | 356 i->second->ExecuteCode(params); |
357 } | 357 } |
358 | 358 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 target_level = WebConsoleMessage::LevelWarning; | 510 target_level = WebConsoleMessage::LevelWarning; |
511 break; | 511 break; |
512 case content::CONSOLE_MESSAGE_LEVEL_ERROR: | 512 case content::CONSOLE_MESSAGE_LEVEL_ERROR: |
513 target_level = WebConsoleMessage::LevelError; | 513 target_level = WebConsoleMessage::LevelError; |
514 break; | 514 break; |
515 } | 515 } |
516 render_view()->GetWebView()->mainFrame()->addMessageToConsole( | 516 render_view()->GetWebView()->mainFrame()->addMessageToConsole( |
517 WebConsoleMessage(target_level, message)); | 517 WebConsoleMessage(target_level, message)); |
518 } | 518 } |
519 } | 519 } |
OLD | NEW |