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

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

Issue 8549022: Define DevTools content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jam's comments addressed Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/devtools_client.h ('k') | content/worker/shared_worker_devtools_agent.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/devtools_client.h" 5 #include "content/renderer/devtools_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/common/devtools_messages.h" 10 #include "content/common/devtools_messages.h"
(...skipping 14 matching lines...) Expand all
25 web_tools_frontend_.reset( 25 web_tools_frontend_.reset(
26 WebDevToolsFrontend::create( 26 WebDevToolsFrontend::create(
27 render_view->webview(), 27 render_view->webview(),
28 this, 28 this,
29 ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); 29 ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang))));
30 } 30 }
31 31
32 DevToolsClient::~DevToolsClient() { 32 DevToolsClient::~DevToolsClient() {
33 } 33 }
34 34
35 void DevToolsClient::SendToAgent(const IPC::Message& tools_agent_message) {
36 Send(new DevToolsHostMsg_ForwardToAgent(routing_id(), tools_agent_message));
37 }
38
39 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { 35 bool DevToolsClient::OnMessageReceived(const IPC::Message& message) {
40 DCHECK(RenderThreadImpl::current()); 36 DCHECK(RenderThreadImpl::current());
41 37
42 bool handled = true; 38 bool handled = true;
43 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) 39 IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message)
44 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend, 40 IPC_MESSAGE_HANDLER(DevToolsClientMsg_DispatchOnInspectorFrontend,
45 OnDispatchOnInspectorFrontend) 41 OnDispatchOnInspectorFrontend)
46 IPC_MESSAGE_UNHANDLED(handled = false); 42 IPC_MESSAGE_UNHANDLED(handled = false);
47 IPC_END_MESSAGE_MAP() 43 IPC_END_MESSAGE_MAP()
48 44
49 return handled; 45 return handled;
50 } 46 }
51 47
52 void DevToolsClient::sendMessageToBackend(const WebString& message) { 48 void DevToolsClient::sendMessageToBackend(const WebString& message) {
53 SendToAgent(DevToolsAgentMsg_DispatchOnInspectorBackend(MSG_ROUTING_NONE, 49 Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(routing_id(),
54 message.utf8())); 50 message.utf8()));
55 } 51 }
56 52
57 void DevToolsClient::activateWindow() { 53 void DevToolsClient::activateWindow() {
58 Send(new DevToolsHostMsg_ActivateWindow(routing_id())); 54 Send(new DevToolsHostMsg_ActivateWindow(routing_id()));
59 } 55 }
60 56
61 void DevToolsClient::closeWindow() { 57 void DevToolsClient::closeWindow() {
62 Send(new DevToolsHostMsg_CloseWindow(routing_id())); 58 Send(new DevToolsHostMsg_CloseWindow(routing_id()));
63 } 59 }
64 60
(...skipping 13 matching lines...) Expand all
78 const WebKit::WebString& content) { 74 const WebKit::WebString& content) {
79 Send(new DevToolsHostMsg_SaveAs(routing_id(), 75 Send(new DevToolsHostMsg_SaveAs(routing_id(),
80 file_name.utf8(), 76 file_name.utf8(),
81 content.utf8())); 77 content.utf8()));
82 } 78 }
83 79
84 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { 80 void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) {
85 web_tools_frontend_->dispatchOnInspectorFrontend( 81 web_tools_frontend_->dispatchOnInspectorFrontend(
86 WebString::fromUTF8(message)); 82 WebString::fromUTF8(message));
87 } 83 }
OLDNEW
« no previous file with comments | « content/renderer/devtools_client.h ('k') | content/worker/shared_worker_devtools_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698