| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 EvaluateInOverlay("reset", std::move(reset_data)); | 617 EvaluateInOverlay("reset", std::move(reset_data)); |
| 618 } | 618 } |
| 619 | 619 |
| 620 void InspectorOverlay::EvaluateInOverlay(const String& method, | 620 void InspectorOverlay::EvaluateInOverlay(const String& method, |
| 621 const String& argument) { | 621 const String& argument) { |
| 622 ScriptForbiddenScope::AllowUserAgentScript allow_script; | 622 ScriptForbiddenScope::AllowUserAgentScript allow_script; |
| 623 std::unique_ptr<protocol::ListValue> command = protocol::ListValue::create(); | 623 std::unique_ptr<protocol::ListValue> command = protocol::ListValue::create(); |
| 624 command->pushValue(protocol::StringValue::create(method)); | 624 command->pushValue(protocol::StringValue::create(method)); |
| 625 command->pushValue(protocol::StringValue::create(argument)); | 625 command->pushValue(protocol::StringValue::create(argument)); |
| 626 ToLocalFrame(OverlayPage()->MainFrame()) | 626 ToLocalFrame(OverlayPage()->MainFrame()) |
| 627 ->Script() | 627 ->GetScriptController() |
| 628 .ExecuteScriptInMainWorld( | 628 .ExecuteScriptInMainWorld( |
| 629 "dispatch(" + command->serialize() + ")", | 629 "dispatch(" + command->serialize() + ")", |
| 630 ScriptController::kExecuteScriptWhenScriptsDisabled); | 630 ScriptController::kExecuteScriptWhenScriptsDisabled); |
| 631 } | 631 } |
| 632 | 632 |
| 633 void InspectorOverlay::EvaluateInOverlay( | 633 void InspectorOverlay::EvaluateInOverlay( |
| 634 const String& method, | 634 const String& method, |
| 635 std::unique_ptr<protocol::Value> argument) { | 635 std::unique_ptr<protocol::Value> argument) { |
| 636 ScriptForbiddenScope::AllowUserAgentScript allow_script; | 636 ScriptForbiddenScope::AllowUserAgentScript allow_script; |
| 637 std::unique_ptr<protocol::ListValue> command = protocol::ListValue::create(); | 637 std::unique_ptr<protocol::ListValue> command = protocol::ListValue::create(); |
| 638 command->pushValue(protocol::StringValue::create(method)); | 638 command->pushValue(protocol::StringValue::create(method)); |
| 639 command->pushValue(std::move(argument)); | 639 command->pushValue(std::move(argument)); |
| 640 ToLocalFrame(OverlayPage()->MainFrame()) | 640 ToLocalFrame(OverlayPage()->MainFrame()) |
| 641 ->Script() | 641 ->GetScriptController() |
| 642 .ExecuteScriptInMainWorld( | 642 .ExecuteScriptInMainWorld( |
| 643 "dispatch(" + command->serialize() + ")", | 643 "dispatch(" + command->serialize() + ")", |
| 644 ScriptController::kExecuteScriptWhenScriptsDisabled); | 644 ScriptController::kExecuteScriptWhenScriptsDisabled); |
| 645 } | 645 } |
| 646 | 646 |
| 647 String InspectorOverlay::EvaluateInOverlayForTest(const String& script) { | 647 String InspectorOverlay::EvaluateInOverlayForTest(const String& script) { |
| 648 ScriptForbiddenScope::AllowUserAgentScript allow_script; | 648 ScriptForbiddenScope::AllowUserAgentScript allow_script; |
| 649 v8::HandleScope handle_scope(ToIsolate(OverlayMainFrame())); | 649 v8::HandleScope handle_scope(ToIsolate(OverlayMainFrame())); |
| 650 v8::Local<v8::Value> string = | 650 v8::Local<v8::Value> string = |
| 651 ToLocalFrame(OverlayPage()->MainFrame()) | 651 ToLocalFrame(OverlayPage()->MainFrame()) |
| 652 ->Script() | 652 ->GetScriptController() |
| 653 .ExecuteScriptInMainWorldAndReturnValue( | 653 .ExecuteScriptInMainWorldAndReturnValue( |
| 654 ScriptSourceCode(script), | 654 ScriptSourceCode(script), |
| 655 ScriptController::kExecuteScriptWhenScriptsDisabled); | 655 ScriptController::kExecuteScriptWhenScriptsDisabled); |
| 656 return ToCoreStringWithUndefinedOrNullCheck(string); | 656 return ToCoreStringWithUndefinedOrNullCheck(string); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void InspectorOverlay::OnTimer(TimerBase*) { | 659 void InspectorOverlay::OnTimer(TimerBase*) { |
| 660 resize_timer_active_ = false; | 660 resize_timer_active_ = false; |
| 661 ScheduleUpdate(); | 661 ScheduleUpdate(); |
| 662 } | 662 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 bool InspectorOverlay::ShouldSearchForNode() { | 805 bool InspectorOverlay::ShouldSearchForNode() { |
| 806 return inspect_mode_ != InspectorDOMAgent::kNotSearching; | 806 return inspect_mode_ != InspectorDOMAgent::kNotSearching; |
| 807 } | 807 } |
| 808 | 808 |
| 809 void InspectorOverlay::Inspect(Node* node) { | 809 void InspectorOverlay::Inspect(Node* node) { |
| 810 if (dom_agent_) | 810 if (dom_agent_) |
| 811 dom_agent_->Inspect(node); | 811 dom_agent_->Inspect(node); |
| 812 } | 812 } |
| 813 | 813 |
| 814 } // namespace blink | 814 } // namespace blink |
| OLD | NEW |