Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: content/shell/browser/shell_devtools_frontend.cc

Issue 2755973003: DevTools: android shouldn't depend on devtools frontend (Closed)
Patch Set: fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 #include "content/shell/browser/shell_browser_context.h" 24 #include "content/shell/browser/shell_browser_context.h"
25 #include "content/shell/browser/shell_browser_main_parts.h" 25 #include "content/shell/browser/shell_browser_main_parts.h"
26 #include "content/shell/browser/shell_content_browser_client.h" 26 #include "content/shell/browser/shell_content_browser_client.h"
27 #include "content/shell/browser/shell_devtools_manager_delegate.h" 27 #include "content/shell/browser/shell_devtools_manager_delegate.h"
28 #include "net/base/io_buffer.h" 28 #include "net/base/io_buffer.h"
29 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
30 #include "net/http/http_response_headers.h" 30 #include "net/http/http_response_headers.h"
31 #include "net/url_request/url_fetcher.h" 31 #include "net/url_request/url_fetcher.h"
32 #include "net/url_request/url_fetcher_response_writer.h" 32 #include "net/url_request/url_fetcher_response_writer.h"
33 33
34 #if !defined(OS_ANDROID)
35 #include "content/public/browser/devtools_frontend_host.h"
36 #endif
37
34 namespace content { 38 namespace content {
35 39
36 namespace { 40 namespace {
37 41
38 42
39 // ResponseWriter ------------------------------------------------------------- 43 // ResponseWriter -------------------------------------------------------------
40 44
41 class ResponseWriter : public net::URLFetcherResponseWriter { 45 class ResponseWriter : public net::URLFetcherResponseWriter {
42 public: 46 public:
43 ResponseWriter(base::WeakPtr<ShellDevToolsFrontend> shell_devtools_, 47 ResponseWriter(base::WeakPtr<ShellDevToolsFrontend> shell_devtools_,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 inspect_element_at_x_(-1), 161 inspect_element_at_x_(-1),
158 inspect_element_at_y_(-1), 162 inspect_element_at_y_(-1),
159 weak_factory_(this) { 163 weak_factory_(this) {
160 } 164 }
161 165
162 ShellDevToolsFrontend::~ShellDevToolsFrontend() { 166 ShellDevToolsFrontend::~ShellDevToolsFrontend() {
163 for (const auto& pair : pending_requests_) 167 for (const auto& pair : pending_requests_)
164 delete pair.first; 168 delete pair.first;
165 } 169 }
166 170
171 #if !defined(OS_ANDROID)
167 void ShellDevToolsFrontend::RenderViewCreated( 172 void ShellDevToolsFrontend::RenderViewCreated(
168 RenderViewHost* render_view_host) { 173 RenderViewHost* render_view_host) {
169 if (!frontend_host_) { 174 if (!frontend_host_) {
170 frontend_host_.reset(DevToolsFrontendHost::Create( 175 frontend_host_.reset(DevToolsFrontendHost::Create(
171 web_contents()->GetMainFrame(), 176 web_contents()->GetMainFrame(),
172 base::Bind(&ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend, 177 base::Bind(&ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend,
173 base::Unretained(this)))); 178 base::Unretained(this))));
174 } 179 }
175 } 180 }
181 #endif
182
183 #if defined(OS_ANDROID)
184 void ShellDevToolsFrontend::RenderViewCreated(
185 RenderViewHost* render_view_host) {
186 // No devtools frontend for android
187 }
188 #endif
176 189
177 void ShellDevToolsFrontend::DocumentAvailableInMainFrame() { 190 void ShellDevToolsFrontend::DocumentAvailableInMainFrame() {
178 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_); 191 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_);
179 agent_host_->AttachClient(this); 192 agent_host_->AttachClient(this);
180 if (inspect_element_at_x_ != -1) { 193 if (inspect_element_at_x_ != -1) {
181 agent_host_->InspectElement( 194 agent_host_->InspectElement(
182 this, inspect_element_at_x_, inspect_element_at_y_); 195 this, inspect_element_at_x_, inspect_element_at_y_);
183 inspect_element_at_x_ = -1; 196 inspect_element_at_x_ = -1;
184 inspect_element_at_y_ = -1; 197 inspect_element_at_y_ = -1;
185 } 198 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 &id_value, arg, nullptr); 387 &id_value, arg, nullptr);
375 } 388 }
376 389
377 void ShellDevToolsFrontend::AgentHostClosed( 390 void ShellDevToolsFrontend::AgentHostClosed(
378 DevToolsAgentHost* agent_host, bool replaced) { 391 DevToolsAgentHost* agent_host, bool replaced) {
379 agent_host_ = nullptr; 392 agent_host_ = nullptr;
380 frontend_shell_->Close(); 393 frontend_shell_->Close();
381 } 394 }
382 395
383 } // namespace content 396 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.h ('k') | content/shell/browser/shell_devtools_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698