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

Side by Side Diff: chrome/renderer/devtools_client.cc

Issue 3005044: DevTools: Get rid of DevTools RPC. (Closed)
Patch Set: More files removed Created 10 years, 4 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 | « chrome/renderer/devtools_client.h ('k') | webkit/glue/devtools_message_data.cc » ('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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/renderer/devtools_client.h" 5 #include "chrome/renderer/devtools_client.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/devtools_messages.h" 10 #include "chrome/common/devtools_messages.h"
11 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
12 #include "chrome/renderer/render_thread.h" 12 #include "chrome/renderer/render_thread.h"
13 #include "chrome/renderer/render_view.h" 13 #include "chrome/renderer/render_view.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontend.h" 14 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontend.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsMessageData.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
17 16
18 using WebKit::WebDevToolsFrontend; 17 using WebKit::WebDevToolsFrontend;
19 using WebKit::WebString; 18 using WebKit::WebString;
20 19
21 DevToolsClient::DevToolsClient(RenderView* view) 20 DevToolsClient::DevToolsClient(RenderView* view)
22 : render_view_(view) { 21 : render_view_(view) {
23 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 22 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
24 web_tools_frontend_.reset( 23 web_tools_frontend_.reset(
25 WebDevToolsFrontend::create( 24 WebDevToolsFrontend::create(
26 view->webview(), 25 view->webview(),
27 this, 26 this,
28 WideToUTF16Hack(command_line.GetSwitchValue(switches::kLang)))); 27 WideToUTF16Hack(command_line.GetSwitchValue(switches::kLang))));
29 } 28 }
30 29
31 DevToolsClient::~DevToolsClient() { 30 DevToolsClient::~DevToolsClient() {
32 } 31 }
33 32
34 void DevToolsClient::Send(const IPC::Message& tools_agent_message) { 33 void DevToolsClient::Send(const IPC::Message& tools_agent_message) {
35 render_view_->Send(new ViewHostMsg_ForwardToDevToolsAgent( 34 render_view_->Send(new ViewHostMsg_ForwardToDevToolsAgent(
36 render_view_->routing_id(), 35 render_view_->routing_id(),
37 tools_agent_message)); 36 tools_agent_message));
38 } 37 }
39 38
40 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { 39 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) {
41 DCHECK(RenderThread::current()->message_loop() == MessageLoop::current()); 40 DCHECK(RenderThread::current()->message_loop() == MessageLoop::current());
42 41
43 bool handled = true; 42 bool handled = true;
44 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) 43 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message)
45 IPC_MESSAGE_HANDLER(DevToolsClientMsg_RpcMessage, OnRpcMessage) 44 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend,
45 OnDispatchOnInspectorFrontend)
46 IPC_MESSAGE_UNHANDLED(handled = false); 46 IPC_MESSAGE_UNHANDLED(handled = false);
47 IPC_END_MESSAGE_MAP() 47 IPC_END_MESSAGE_MAP()
48 48
49 return handled; 49 return handled;
50 } 50 }
51 51
52 void DevToolsClient::sendMessageToAgent( 52 void DevToolsClient::sendMessageToBackend(const WebString& message) {
53 const WebKit::WebDevToolsMessageData& data) { 53 Send(DevToolsAgentMsg_DispatchOnInspectorBackend(message.utf8()));
54 Send(DevToolsAgentMsg_RpcMessage(DevToolsMessageData(data)));
55 } 54 }
56 55
57 void DevToolsClient::sendDebuggerCommandToAgent(const WebString& command) { 56 void DevToolsClient::sendDebuggerCommandToAgent(const WebString& command) {
58 Send(DevToolsAgentMsg_DebuggerCommand(command.utf8())); 57 Send(DevToolsAgentMsg_DebuggerCommand(command.utf8()));
59 } 58 }
60 59
61 void DevToolsClient::sendDebuggerPauseScript() { 60 void DevToolsClient::sendDebuggerPauseScript() {
62 Send(DevToolsAgentMsg_DebuggerPauseScript()); 61 Send(DevToolsAgentMsg_DebuggerPauseScript());
63 } 62 }
64 63
(...skipping 10 matching lines...) Expand all
75 void DevToolsClient::requestDockWindow() { 74 void DevToolsClient::requestDockWindow() {
76 render_view_->Send(new ViewHostMsg_RequestDockDevToolsWindow( 75 render_view_->Send(new ViewHostMsg_RequestDockDevToolsWindow(
77 render_view_->routing_id())); 76 render_view_->routing_id()));
78 } 77 }
79 78
80 void DevToolsClient::requestUndockWindow() { 79 void DevToolsClient::requestUndockWindow() {
81 render_view_->Send(new ViewHostMsg_RequestUndockDevToolsWindow( 80 render_view_->Send(new ViewHostMsg_RequestUndockDevToolsWindow(
82 render_view_->routing_id())); 81 render_view_->routing_id()));
83 } 82 }
84 83
85 void DevToolsClient::OnRpcMessage(const DevToolsMessageData& data) { 84 void DevToolsClient::OnDispatchOnInspectorFrontend(
86 web_tools_frontend_->dispatchMessageFromAgent( 85 const std::string& message) {
87 data.ToWebDevToolsMessageData()); 86 web_tools_frontend_->dispatchOnInspectorFrontend(
87 WebString::fromUTF8(message));
88 } 88 }
89 89
90 bool DevToolsClient::shouldHideScriptsPanel() { 90 bool DevToolsClient::shouldHideScriptsPanel() {
91 CommandLine* cmd = CommandLine::ForCurrentProcess(); 91 CommandLine* cmd = CommandLine::ForCurrentProcess();
92 return cmd->HasSwitch(switches::kRemoteShellPort); 92 return cmd->HasSwitch(switches::kRemoteShellPort);
93 } 93 }
OLDNEW
« no previous file with comments | « chrome/renderer/devtools_client.h ('k') | webkit/glue/devtools_message_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698