| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 routing_id_ = ++dev_tools_agent_counter; | 64 routing_id_ = ++dev_tools_agent_counter; |
| 65 if (routing_id_ == 1) | 65 if (routing_id_ == 1) |
| 66 WebDevToolsAgent::setMessageLoopDispatchHandler( | 66 WebDevToolsAgent::setMessageLoopDispatchHandler( |
| 67 &TestShellDevToolsAgent::DispatchMessageLoop); | 67 &TestShellDevToolsAgent::DispatchMessageLoop); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void TestShellDevToolsAgent::SetWebView(WebKit::WebView* web_view) { | 70 void TestShellDevToolsAgent::SetWebView(WebKit::WebView* web_view) { |
| 71 web_view_ = web_view; | 71 web_view_ = web_view; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void TestShellDevToolsAgent::sendMessageToFrontend( | 74 void TestShellDevToolsAgent::sendMessageToInspectorFrontend( |
| 75 const WebDevToolsMessageData& data) { | 75 const WebString& data) { |
| 76 if (dev_tools_client_) | 76 if (dev_tools_client_) |
| 77 dev_tools_client_->AsyncCall(TestShellDevToolsCallArgs(data)); | 77 dev_tools_client_->AsyncCall(TestShellDevToolsCallArgs(data)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void TestShellDevToolsAgent::forceRepaint() { | 80 void TestShellDevToolsAgent::forceRepaint() { |
| 81 } | 81 } |
| 82 | 82 |
| 83 void TestShellDevToolsAgent::runtimeFeatureStateChanged( | 83 void TestShellDevToolsAgent::runtimeFeatureStateChanged( |
| 84 const WebKit::WebString& feature, bool enabled) { | 84 const WebKit::WebString& feature, bool enabled) { |
| 85 // TODO(loislo): implement this. | 85 // TODO(loislo): implement this. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 112 MessageLoop::current()->PostDelayedTask( | 112 MessageLoop::current()->PostDelayedTask( |
| 113 FROM_HERE, | 113 FROM_HERE, |
| 114 call_method_factory_.NewRunnableMethod(&TestShellDevToolsAgent::Call, | 114 call_method_factory_.NewRunnableMethod(&TestShellDevToolsAgent::Call, |
| 115 args), | 115 args), |
| 116 0); | 116 0); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void TestShellDevToolsAgent::Call(const TestShellDevToolsCallArgs &args) { | 119 void TestShellDevToolsAgent::Call(const TestShellDevToolsCallArgs &args) { |
| 120 WebDevToolsAgent* web_agent = GetWebAgent(); | 120 WebDevToolsAgent* web_agent = GetWebAgent(); |
| 121 if (web_agent) | 121 if (web_agent) |
| 122 web_agent->dispatchMessageFromFrontend(args.data_); | 122 web_agent->dispatchOnInspectorBackend(args.data_); |
| 123 if (TestShellDevToolsCallArgs::calls_count() == 1 && dev_tools_client_) | 123 if (TestShellDevToolsCallArgs::calls_count() == 1 && dev_tools_client_) |
| 124 dev_tools_client_->all_messages_processed(); | 124 dev_tools_client_->all_messages_processed(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 WebDevToolsAgent* TestShellDevToolsAgent::GetWebAgent() { | 127 WebDevToolsAgent* TestShellDevToolsAgent::GetWebAgent() { |
| 128 if (!web_view_) | 128 if (!web_view_) |
| 129 return NULL; | 129 return NULL; |
| 130 return web_view_->devToolsAgent(); | 130 return web_view_->devToolsAgent(); |
| 131 } | 131 } |
| 132 | 132 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 156 | 156 |
| 157 bool TestShellDevToolsAgent::evaluateInWebInspector( | 157 bool TestShellDevToolsAgent::evaluateInWebInspector( |
| 158 long call_id, | 158 long call_id, |
| 159 const std::string& script) { | 159 const std::string& script) { |
| 160 WebDevToolsAgent* agent = GetWebAgent(); | 160 WebDevToolsAgent* agent = GetWebAgent(); |
| 161 if (!agent) | 161 if (!agent) |
| 162 return false; | 162 return false; |
| 163 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); | 163 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); |
| 164 return true; | 164 return true; |
| 165 } | 165 } |
| OLD | NEW |