| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 inspect_element_at_x_(-1), | 157 inspect_element_at_x_(-1), |
| 158 inspect_element_at_y_(-1), | 158 inspect_element_at_y_(-1), |
| 159 weak_factory_(this) { | 159 weak_factory_(this) { |
| 160 } | 160 } |
| 161 | 161 |
| 162 ShellDevToolsFrontend::~ShellDevToolsFrontend() { | 162 ShellDevToolsFrontend::~ShellDevToolsFrontend() { |
| 163 for (const auto& pair : pending_requests_) | 163 for (const auto& pair : pending_requests_) |
| 164 delete pair.first; | 164 delete pair.first; |
| 165 } | 165 } |
| 166 | 166 |
| 167 #if !defined(OS_ANDROID) |
| 167 void ShellDevToolsFrontend::RenderViewCreated( | 168 void ShellDevToolsFrontend::RenderViewCreated( |
| 168 RenderViewHost* render_view_host) { | 169 RenderViewHost* render_view_host) { |
| 169 if (!frontend_host_) { | 170 if (!frontend_host_) { |
| 170 frontend_host_.reset(DevToolsFrontendHost::Create( | 171 frontend_host_.reset(DevToolsFrontendHost::Create( |
| 171 web_contents()->GetMainFrame(), | 172 web_contents()->GetMainFrame(), |
| 172 base::Bind(&ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend, | 173 base::Bind(&ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend, |
| 173 base::Unretained(this)))); | 174 base::Unretained(this)))); |
| 174 } | 175 } |
| 175 } | 176 } |
| 177 #endif |
| 178 |
| 179 #if defined(OS_ANDROID) |
| 180 void ShellDevToolsFrontend::RenderViewCreated( |
| 181 RenderViewHost* render_view_host) { |
| 182 // No devtools frontend for android |
| 183 } |
| 184 #endif |
| 176 | 185 |
| 177 void ShellDevToolsFrontend::DocumentAvailableInMainFrame() { | 186 void ShellDevToolsFrontend::DocumentAvailableInMainFrame() { |
| 178 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_); | 187 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_); |
| 179 agent_host_->AttachClient(this); | 188 agent_host_->AttachClient(this); |
| 180 if (inspect_element_at_x_ != -1) { | 189 if (inspect_element_at_x_ != -1) { |
| 181 agent_host_->InspectElement( | 190 agent_host_->InspectElement( |
| 182 this, inspect_element_at_x_, inspect_element_at_y_); | 191 this, inspect_element_at_x_, inspect_element_at_y_); |
| 183 inspect_element_at_x_ = -1; | 192 inspect_element_at_x_ = -1; |
| 184 inspect_element_at_y_ = -1; | 193 inspect_element_at_y_ = -1; |
| 185 } | 194 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 &id_value, arg, nullptr); | 383 &id_value, arg, nullptr); |
| 375 } | 384 } |
| 376 | 385 |
| 377 void ShellDevToolsFrontend::AgentHostClosed( | 386 void ShellDevToolsFrontend::AgentHostClosed( |
| 378 DevToolsAgentHost* agent_host, bool replaced) { | 387 DevToolsAgentHost* agent_host, bool replaced) { |
| 379 agent_host_ = nullptr; | 388 agent_host_ = nullptr; |
| 380 frontend_shell_->Close(); | 389 frontend_shell_->Close(); |
| 381 } | 390 } |
| 382 | 391 |
| 383 } // namespace content | 392 } // namespace content |
| OLD | NEW |