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

Side by Side Diff: content/browser/devtools/devtools_frontend_host_impl.cc

Issue 2755973003: DevTools: android shouldn't depend on devtools frontend (Closed)
Patch Set: back out dmitry changes 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
« no previous file with comments | « content/browser/devtools/BUILD.gn ('k') | content/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/devtools/devtools_frontend_host_impl.h" 5 #include "content/browser/devtools/devtools_frontend_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "content/browser/bad_message.h" 9 #include "content/browser/bad_message.h"
10 #include "content/browser/devtools/grit/devtools_resources_map.h"
11 #include "content/common/devtools_messages.h" 10 #include "content/common/devtools_messages.h"
12 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/render_frame_host.h" 12 #include "content/public/browser/render_frame_host.h"
14 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/content_client.h" 14 #include "content/public/common/content_client.h"
16 15
16 #if !defined(OS_ANDROID)
17 #include "content/browser/devtools/grit/devtools_resources_map.h" // nogncheck
chenwilliam 2017/03/16 23:08:13 gn complains when cross-compiling (Linux compiling
dgozman 2017/03/16 23:09:39 That means we should not compile this file on andr
18 #endif
19
17 namespace content { 20 namespace content {
18 21
19 namespace { 22 namespace {
20 const char kCompatibilityScript[] = "devtools_compatibility.js"; 23 const char kCompatibilityScript[] = "devtools_compatibility.js";
21 const char kCompatibilityScriptSourceURL[] = 24 const char kCompatibilityScriptSourceURL[] =
22 "\n//# " 25 "\n//# "
23 "sourceURL=chrome-devtools://devtools/bundled/devtools_compatibility.js"; 26 "sourceURL=chrome-devtools://devtools/bundled/devtools_compatibility.js";
24 } 27 }
25 28
26 // static 29 // static
27 DevToolsFrontendHost* DevToolsFrontendHost::Create( 30 DevToolsFrontendHost* DevToolsFrontendHost::Create(
28 RenderFrameHost* frontend_main_frame, 31 RenderFrameHost* frontend_main_frame,
29 const HandleMessageCallback& handle_message_callback) { 32 const HandleMessageCallback& handle_message_callback) {
30 return new DevToolsFrontendHostImpl(frontend_main_frame, 33 return new DevToolsFrontendHostImpl(frontend_main_frame,
31 handle_message_callback); 34 handle_message_callback);
32 } 35 }
33 36
34 // static 37 // static
38 #if !defined(OS_ANDROID)
35 base::StringPiece DevToolsFrontendHost::GetFrontendResource( 39 base::StringPiece DevToolsFrontendHost::GetFrontendResource(
36 const std::string& path) { 40 const std::string& path) {
37 for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { 41 for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) {
38 if (path == kDevtoolsResources[i].name) { 42 if (path == kDevtoolsResources[i].name) {
39 return GetContentClient()->GetDataResource( 43 return GetContentClient()->GetDataResource(
40 kDevtoolsResources[i].value, ui::SCALE_FACTOR_NONE); 44 kDevtoolsResources[i].value, ui::SCALE_FACTOR_NONE);
41 } 45 }
42 } 46 }
43 return std::string(); 47 return std::string();
44 } 48 }
49 #endif
50
51 // static
52 #if defined(OS_ANDROID)
53 base::StringPiece DevToolsFrontendHost::GetFrontendResource(
54 const std::string& path) {
55 return std::string();
56 }
57 #endif
45 58
46 DevToolsFrontendHostImpl::DevToolsFrontendHostImpl( 59 DevToolsFrontendHostImpl::DevToolsFrontendHostImpl(
47 RenderFrameHost* frontend_main_frame, 60 RenderFrameHost* frontend_main_frame,
48 const HandleMessageCallback& handle_message_callback) 61 const HandleMessageCallback& handle_message_callback)
49 : WebContentsObserver( 62 : WebContentsObserver(
50 WebContents::FromRenderFrameHost(frontend_main_frame)), 63 WebContents::FromRenderFrameHost(frontend_main_frame)),
51 handle_message_callback_(handle_message_callback) { 64 handle_message_callback_(handle_message_callback) {
52 frontend_main_frame->Send(new DevToolsMsg_SetupDevToolsClient( 65 frontend_main_frame->Send(new DevToolsMsg_SetupDevToolsClient(
53 frontend_main_frame->GetRoutingID(), 66 frontend_main_frame->GetRoutingID(),
54 DevToolsFrontendHost::GetFrontendResource(kCompatibilityScript) 67 DevToolsFrontendHost::GetFrontendResource(kCompatibilityScript)
(...skipping 22 matching lines...) Expand all
77 IPC_END_MESSAGE_MAP() 90 IPC_END_MESSAGE_MAP()
78 return handled; 91 return handled;
79 } 92 }
80 93
81 void DevToolsFrontendHostImpl::OnDispatchOnEmbedder( 94 void DevToolsFrontendHostImpl::OnDispatchOnEmbedder(
82 const std::string& message) { 95 const std::string& message) {
83 handle_message_callback_.Run(message); 96 handle_message_callback_.Run(message);
84 } 97 }
85 98
86 } // namespace content 99 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/BUILD.gn ('k') | content/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698