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() | 60 TestShellDevToolsAgent::TestShellDevToolsAgent(WebView* web_view) |
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) { |
63 static int dev_tools_agent_counter; | 64 static int dev_tools_agent_counter; |
64 routing_id_ = ++dev_tools_agent_counter; | 65 routing_id_ = ++dev_tools_agent_counter; |
65 if (routing_id_ == 1) | 66 if (routing_id_ == 1) |
66 WebDevToolsAgent::setMessageLoopDispatchHandler( | 67 WebDevToolsAgent::setMessageLoopDispatchHandler( |
67 &TestShellDevToolsAgent::DispatchMessageLoop); | 68 &TestShellDevToolsAgent::DispatchMessageLoop); |
68 } | 69 web_dev_tools_agent_ = WebDevToolsAgent::create(web_view_, this); |
69 | 70 web_view_->setDevToolsAgent(web_dev_tools_agent_); |
70 void TestShellDevToolsAgent::SetWebView(WebKit::WebView* web_view) { | |
71 web_view_ = web_view; | |
72 } | 71 } |
73 | 72 |
74 void TestShellDevToolsAgent::sendMessageToFrontend( | 73 void TestShellDevToolsAgent::sendMessageToFrontend( |
75 const WebDevToolsMessageData& data) { | 74 const WebDevToolsMessageData& data) { |
76 if (dev_tools_client_) | 75 if (dev_tools_client_) |
77 dev_tools_client_->AsyncCall(TestShellDevToolsCallArgs(data)); | 76 dev_tools_client_->AsyncCall(TestShellDevToolsCallArgs(data)); |
78 } | 77 } |
79 | 78 |
80 void TestShellDevToolsAgent::forceRepaint() { | 79 void TestShellDevToolsAgent::forceRepaint() { |
81 } | 80 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 155 |
157 bool TestShellDevToolsAgent::evaluateInWebInspector( | 156 bool TestShellDevToolsAgent::evaluateInWebInspector( |
158 long call_id, | 157 long call_id, |
159 const std::string& script) { | 158 const std::string& script) { |
160 WebDevToolsAgent* agent = GetWebAgent(); | 159 WebDevToolsAgent* agent = GetWebAgent(); |
161 if (!agent) | 160 if (!agent) |
162 return false; | 161 return false; |
163 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); | 162 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); |
164 return true; | 163 return true; |
165 } | 164 } |
OLD | NEW |