| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "webkit/tools/test_shell/test_shell_devtools_agent.h" | 5 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "grit/webkit_chromium_resources.h" | 8 #include "grit/webkit_chromium_resources.h" |
| 9 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 current->RunAllPending(); | 50 current->RunAllPending(); |
| 51 current->SetNestableTasksAllowed(old_state); | 51 current->SetNestableTasksAllowed(old_state); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Warning at call_method_factory_(this) treated as error is switched off. | 54 // Warning at call_method_factory_(this) treated as error is switched off. |
| 55 | 55 |
| 56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 57 #pragma warning(disable : 4355) | 57 #pragma warning(disable : 4355) |
| 58 #endif // defined(OS_WIN) | 58 #endif // defined(OS_WIN) |
| 59 | 59 |
| 60 TestShellDevToolsAgent::TestShellDevToolsAgent(WebView* web_view) | 60 TestShellDevToolsAgent::TestShellDevToolsAgent() |
| 61 : call_method_factory_(this), | 61 : call_method_factory_(this), |
| 62 dev_tools_client_(NULL), | 62 dev_tools_client_(NULL) { |
| 63 web_view_(web_view) { | |
| 64 static int dev_tools_agent_counter; | 63 static int dev_tools_agent_counter; |
| 65 routing_id_ = ++dev_tools_agent_counter; | 64 routing_id_ = ++dev_tools_agent_counter; |
| 66 if (routing_id_ == 1) | 65 if (routing_id_ == 1) |
| 67 WebDevToolsAgent::setMessageLoopDispatchHandler( | 66 WebDevToolsAgent::setMessageLoopDispatchHandler( |
| 68 &TestShellDevToolsAgent::DispatchMessageLoop); | 67 &TestShellDevToolsAgent::DispatchMessageLoop); |
| 69 web_dev_tools_agent_ = WebDevToolsAgent::create(web_view_, this); | 68 } |
| 70 web_view_->setDevToolsAgent(web_dev_tools_agent_); | 69 |
| 70 void TestShellDevToolsAgent::SetWebView(WebKit::WebView* web_view) { |
| 71 web_view_ = web_view; |
| 71 } | 72 } |
| 72 | 73 |
| 73 void TestShellDevToolsAgent::sendMessageToFrontend( | 74 void TestShellDevToolsAgent::sendMessageToFrontend( |
| 74 const WebDevToolsMessageData& data) { | 75 const WebDevToolsMessageData& data) { |
| 75 if (dev_tools_client_) | 76 if (dev_tools_client_) |
| 76 dev_tools_client_->AsyncCall(TestShellDevToolsCallArgs(data)); | 77 dev_tools_client_->AsyncCall(TestShellDevToolsCallArgs(data)); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void TestShellDevToolsAgent::forceRepaint() { | 80 void TestShellDevToolsAgent::forceRepaint() { |
| 80 } | 81 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 156 |
| 156 bool TestShellDevToolsAgent::evaluateInWebInspector( | 157 bool TestShellDevToolsAgent::evaluateInWebInspector( |
| 157 long call_id, | 158 long call_id, |
| 158 const std::string& script) { | 159 const std::string& script) { |
| 159 WebDevToolsAgent* agent = GetWebAgent(); | 160 WebDevToolsAgent* agent = GetWebAgent(); |
| 160 if (!agent) | 161 if (!agent) |
| 161 return false; | 162 return false; |
| 162 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); | 163 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); |
| 163 return true; | 164 return true; |
| 164 } | 165 } |
| OLD | NEW |