Chromium Code Reviews| 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 #if defined(DEBUG_DEVTOOLS) | |
|
pfeldman
2016/10/08 01:01:44
open it, it is for us.
dgozman
2016/10/10 23:27:27
Done.
| |
| 33 compatibility_script_ += "\n//# sourceURL=devtools_compatibility.js"; | |
| 34 #endif | |
| 32 } | 35 } |
| 33 | 36 |
| 34 DevToolsClient::~DevToolsClient() { | 37 DevToolsClient::~DevToolsClient() { |
| 35 } | 38 } |
| 36 | 39 |
| 37 void DevToolsClient::DidClearWindowObject() { | 40 void DevToolsClient::DidClearWindowObject() { |
| 38 if (!compatibility_script_.empty()) | 41 if (!compatibility_script_.empty()) |
| 39 render_frame()->ExecuteJavaScript(base::UTF8ToUTF16(compatibility_script_)); | 42 render_frame()->ExecuteJavaScript(base::UTF8ToUTF16(compatibility_script_)); |
| 40 } | 43 } |
| 41 | 44 |
| 42 void DevToolsClient::OnDestruct() { | 45 void DevToolsClient::OnDestruct() { |
| 43 delete this; | 46 delete this; |
| 44 } | 47 } |
| 45 | 48 |
| 46 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { | 49 void DevToolsClient::sendMessageToEmbedder(const WebString& message) { |
| 47 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), | 50 Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), |
| 48 message.utf8())); | 51 message.utf8())); |
| 49 } | 52 } |
| 50 | 53 |
| 51 bool DevToolsClient::isUnderTest() { | 54 bool DevToolsClient::isUnderTest() { |
| 52 return RenderThreadImpl::current()->layout_test_mode(); | 55 return RenderThreadImpl::current()->layout_test_mode(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace content | 58 } // namespace content |
| OLD | NEW |