diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 15:33:11 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 15:33:11 +0000 |
commit | e4ac5dff67e3f5ea9b3d7c4adad2aade7a21bbe7 (patch) | |
tree | 0cf4c27a1038fcd71bd8d3bc957e5df4b7b7ffeb /chrome/renderer/devtools_client.cc | |
parent | 3f3ae3384634db4fb0601f184b12b585b4a64971 (diff) | |
download | chromium_src-e4ac5dff67e3f5ea9b3d7c4adad2aade7a21bbe7.zip chromium_src-e4ac5dff67e3f5ea9b3d7c4adad2aade7a21bbe7.tar.gz chromium_src-e4ac5dff67e3f5ea9b3d7c4adad2aade7a21bbe7.tar.bz2 |
Use devtool_ prefix instead of dev_tools_ to be consistent with the rest code.
Review URL: http://codereview.chromium.org/42281
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/devtools_client.cc')
-rw-r--r-- | chrome/renderer/devtools_client.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc new file mode 100644 index 0000000..f3f84b1 --- /dev/null +++ b/chrome/renderer/devtools_client.cc @@ -0,0 +1,52 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/devtools_client.h" + +#include "chrome/common/render_messages.h" +#include "chrome/renderer/devtools_messages.h" +#include "chrome/renderer/render_thread.h" +#include "chrome/renderer/render_view.h" +#include "webkit/glue/webdevtoolsclient.h" + +DevToolsClient::DevToolsClient(RenderView* view) + : render_view_(view) { + web_tools_client_.reset( + WebDevToolsClient::Create(view->webview(), this)); +} + +DevToolsClient::~DevToolsClient() { +} + +void DevToolsClient::Send(const IPC::Message& tools_agent_message) { + render_view_->Send(new ViewHostMsg_ForwardToDevToolsAgent( + render_view_->routing_id(), + tools_agent_message)); +} + +bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { + DCHECK(RenderThread::current()->message_loop() == MessageLoop::current()); + + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(DevToolsClient, message) + IPC_MESSAGE_HANDLER(DevToolsClientMsg_DidDebugAttach, DidDebugAttach) + IPC_MESSAGE_HANDLER(DevToolsClientMsg_RpcMessage, OnRpcMessage) + IPC_MESSAGE_UNHANDLED(handled = false); + IPC_END_MESSAGE_MAP() + + return handled; +} + +void DevToolsClient::DidDebugAttach() { + DCHECK(RenderThread::current()->message_loop() == MessageLoop::current()); + // TODO(yurys): delegate to JS frontend. +} + +void DevToolsClient::SendMessageToAgent(const std::string& raw_msg) { + Send(DevToolsAgentMsg_RpcMessage(raw_msg)); +} + +void DevToolsClient::OnRpcMessage(const std::string& raw_msg) { + web_tools_client_->DispatchMessageFromAgent(raw_msg); +} |