OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell/browser/shell_devtools_frontend.h" | 5 #include "content/shell/browser/shell_devtools_frontend.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( | 138 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( |
139 const std::string& message) { | 139 const std::string& message) { |
140 DevToolsManager::GetInstance()->DispatchOnInspectorBackend( | 140 DevToolsManager::GetInstance()->DispatchOnInspectorBackend( |
141 this, message); | 141 this, message); |
142 } | 142 } |
143 | 143 |
144 void ShellDevToolsFrontend::DispatchOnInspectorFrontend( | 144 void ShellDevToolsFrontend::DispatchOnInspectorFrontend( |
145 const std::string& message) { | 145 const std::string& message) { |
146 std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");"; | 146 if (frontend_host_) |
147 base::string16 javascript = base::UTF8ToUTF16(code); | 147 frontend_host_->DispatchOnDevToolsFrontend(message); |
148 web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); | |
149 } | 148 } |
150 | 149 |
151 void ShellDevToolsFrontend::InspectedContentsClosing() { | 150 void ShellDevToolsFrontend::InspectedContentsClosing() { |
152 frontend_shell_->Close(); | 151 frontend_shell_->Close(); |
153 } | 152 } |
154 | 153 |
155 } // namespace content | 154 } // namespace content |
OLD | NEW |