| 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/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( | 174 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( |
| 175 const std::string& message) { | 175 const std::string& message) { |
| 176 DevToolsManager::GetInstance()->DispatchOnInspectorBackend( | 176 DevToolsManager::GetInstance()->DispatchOnInspectorBackend( |
| 177 this, message); | 177 this, message); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ShellDevToolsFrontend::DispatchOnInspectorFrontend( | 180 void ShellDevToolsFrontend::DispatchOnInspectorFrontend( |
| 181 const std::string& message) { | 181 const std::string& message) { |
| 182 if (frontend_host_) | 182 std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");"; |
| 183 frontend_host_->DispatchOnDevToolsFrontend(message); | 183 base::string16 javascript = base::UTF8ToUTF16(code); |
| 184 web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void ShellDevToolsFrontend::InspectedContentsClosing() { | 187 void ShellDevToolsFrontend::InspectedContentsClosing() { |
| 187 frontend_shell_->Close(); | 188 frontend_shell_->Close(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace content | 191 } // namespace content |
| OLD | NEW |