| 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 "content/renderer/devtools/devtools_client.h" | 5 #include "content/renderer/devtools/devtools_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/common/devtools_messages.h" | 10 #include "content/common/devtools_messages.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 DevToolsClient::DevToolsClient( | 25 DevToolsClient::DevToolsClient( |
| 26 RenderFrame* main_render_frame, | 26 RenderFrame* main_render_frame, |
| 27 const std::string& compatibility_script) | 27 const std::string& compatibility_script) |
| 28 : RenderFrameObserver(main_render_frame), | 28 : RenderFrameObserver(main_render_frame), |
| 29 compatibility_script_(compatibility_script), | 29 compatibility_script_(compatibility_script), |
| 30 web_tools_frontend_( | 30 web_tools_frontend_( |
| 31 WebDevToolsFrontend::create(main_render_frame->GetWebFrame(), this)) { | 31 WebDevToolsFrontend::create(main_render_frame->GetWebFrame(), this)) { |
| 32 compatibility_script_ += "\n//# sourceURL=devtools_compatibility.js"; |
| 32 } | 33 } |
| 33 | 34 |
| 34 DevToolsClient::~DevToolsClient() { | 35 DevToolsClient::~DevToolsClient() { |
| 35 } | 36 } |
| 36 | 37 |
| 37 void DevToolsClient::DidClearWindowObject() { | 38 void DevToolsClient::DidClearWindowObject() { |
| 38 if (!compatibility_script_.empty()) | 39 if (!compatibility_script_.empty()) |
| 39 render_frame()->ExecuteJavaScript(base::UTF8ToUTF16(compatibility_script_)); | 40 render_frame()->ExecuteJavaScript(base::UTF8ToUTF16(compatibility_script_)); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void DevToolsClient::OnDestruct() { | 43 void DevToolsClient::OnDestruct() { |
| 43 delete this; | 44 delete this; |
| 44 } | 45 } |
| 45 | 46 |
| 46 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { | 47 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { |
| 47 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), | 48 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), |
| 48 message.utf8())); | 49 message.utf8())); |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool DevToolsClient::isUnderTest() { | 52 bool DevToolsClient::isUnderTest() { |
| 52 return RenderThreadImpl::current()->layout_test_mode(); | 53 return RenderThreadImpl::current()->layout_test_mode(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 } // namespace content | 56 } // namespace content |
| OLD | NEW |