diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 09:57:20 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 09:57:20 +0000 |
commit | 8262245d384be025f13e2a5b3a03b7e5c98374ce (patch) | |
tree | b92377c4ce653f721bf7339c8fa33f7a7049ce67 /chrome/renderer | |
parent | 2469a22063c3539147f55fe899a8dabc12901c01 (diff) | |
download | chromium_src-8262245d384be025f13e2a5b3a03b7e5c98374ce.zip chromium_src-8262245d384be025f13e2a5b3a03b7e5c98374ce.tar.gz chromium_src-8262245d384be025f13e2a5b3a03b7e5c98374ce.tar.bz2 |
DevTools: move DevToolsAgent/Client into content.
BUG=84078
TEST=
Review URL: http://codereview.chromium.org/7461019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent.cc | 214 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent.h | 76 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent_filter.cc | 100 | ||||
-rw-r--r-- | chrome/renderer/devtools_agent_filter.h | 54 | ||||
-rw-r--r-- | chrome/renderer/devtools_client.cc | 96 | ||||
-rw-r--r-- | chrome/renderer/devtools_client.h | 65 |
7 files changed, 0 insertions, 609 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 597b8e4..770f6ae 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -33,8 +33,6 @@ #include "chrome/renderer/chrome_render_process_observer.h" #include "chrome/renderer/chrome_render_view_observer.h" #include "chrome/renderer/content_settings_observer.h" -#include "chrome/renderer/devtools_agent.h" -#include "chrome/renderer/devtools_agent_filter.h" #include "chrome/renderer/extensions/bindings_utils.h" #include "chrome/renderer/extensions/event_bindings.h" #include "chrome/renderer/extensions/extension_dispatcher.h" @@ -165,7 +163,6 @@ void ChromeContentRendererClient::RenderThreadStarted() { #endif RenderThread* thread = RenderThread::current(); - thread->AddFilter(new DevToolsAgentFilter()); thread->AddObserver(chrome_observer_.get()); thread->AddObserver(extension_dispatcher_.get()); @@ -214,7 +211,6 @@ void ChromeContentRendererClient::RenderThreadStarted() { void ChromeContentRendererClient::RenderViewCreated(RenderView* render_view) { ContentSettingsObserver* content_settings = new ContentSettingsObserver(render_view); - new DevToolsAgent(render_view); new ExtensionHelper(render_view, extension_dispatcher_.get()); new PageLoadHistograms(render_view, histogram_snapshots_.get()); new PrintWebViewHelper(render_view); diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc deleted file mode 100644 index 7593ab4..0000000 --- a/chrome/renderer/devtools_agent.cc +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2011 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_agent.h" - -#include <map> - -#include "base/command_line.h" -#include "base/message_loop.h" -#include "base/process.h" -#include "base/string_number_conversions.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/renderer/devtools_agent_filter.h" -#include "chrome/renderer/devtools_client.h" -#include "content/common/devtools_messages.h" -#include "content/common/view_messages.h" -#include "content/renderer/render_view.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" - -using WebKit::WebDevToolsAgent; -using WebKit::WebDevToolsAgentClient; -using WebKit::WebPoint; -using WebKit::WebString; -using WebKit::WebCString; -using WebKit::WebVector; -using WebKit::WebView; - -namespace { - -class WebKitClientMessageLoopImpl - : public WebDevToolsAgentClient::WebKitClientMessageLoop { - public: - WebKitClientMessageLoopImpl() : message_loop_(MessageLoop::current()) { } - virtual ~WebKitClientMessageLoopImpl() { - message_loop_ = NULL; - } - virtual void run() { - bool old_state = message_loop_->NestableTasksAllowed(); - message_loop_->SetNestableTasksAllowed(true); - message_loop_->Run(); - message_loop_->SetNestableTasksAllowed(old_state); - } - virtual void quitNow() { - message_loop_->QuitNow(); - } - private: - MessageLoop* message_loop_; -}; - -} // namespace - -// static -std::map<int, DevToolsAgent*> DevToolsAgent::agent_for_routing_id_; - -DevToolsAgent::DevToolsAgent(RenderView* render_view) - : RenderViewObserver(render_view) { - agent_for_routing_id_[routing_id()] = this; - - CommandLine* cmd = CommandLine::ForCurrentProcess(); - expose_v8_debugger_protocol_ = cmd->HasSwitch(switches::kRemoteShellPort); - - render_view->webview()->setDevToolsAgentClient(this); - render_view->webview()->devToolsAgent()->setProcessId( - base::Process::Current().pid()); -} - -DevToolsAgent::~DevToolsAgent() { - agent_for_routing_id_.erase(routing_id()); -} - -// Called on the Renderer thread. -bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_FrontendLoaded, OnFrontendLoaded) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, - OnDispatchOnInspectorBackend) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) - IPC_MESSAGE_HANDLER(DevToolsMsg_SetupDevToolsClient, OnSetupDevToolsClient) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - - if (message.type() == ViewMsg_Navigate::ID) - OnNavigate(); // Don't want to swallow the message. - - return handled; -} - -void DevToolsAgent::sendMessageToInspectorFrontend( - const WebKit::WebString& message) { - Send(new DevToolsHostMsg_ForwardToClient( - routing_id(), - DevToolsClientMsg_DispatchOnInspectorFrontend(MSG_ROUTING_NONE, - message.utf8()))); -} - -void DevToolsAgent::sendDebuggerOutput(const WebKit::WebString& data) { - Send(new DevToolsHostMsg_ForwardToClient( - routing_id(), - DevToolsClientMsg_DebuggerOutput(MSG_ROUTING_NONE, data.utf8()))); -} - -int DevToolsAgent::hostIdentifier() { - return routing_id(); -} - -void DevToolsAgent::runtimeFeatureStateChanged( - const WebKit::WebString& feature, - bool enabled) { - Send(new DevToolsHostMsg_RuntimePropertyChanged( - routing_id(), - feature.utf8(), - enabled ? "true" : "false")); -} - -void DevToolsAgent::runtimePropertyChanged( - const WebKit::WebString& name, - const WebKit::WebString& value) { - Send(new DevToolsHostMsg_RuntimePropertyChanged( - routing_id(), - name.utf8(), - value.utf8())); -} - -WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* - DevToolsAgent::createClientMessageLoop() { - return new WebKitClientMessageLoopImpl(); -} - -bool DevToolsAgent::exposeV8DebuggerProtocol() { - return expose_v8_debugger_protocol_; -} - -void DevToolsAgent::clearBrowserCache() { - Send(new DevToolsHostMsg_ClearBrowserCache(routing_id())); -} - -void DevToolsAgent::clearBrowserCookies() { - Send(new DevToolsHostMsg_ClearBrowserCookies(routing_id())); -} - -// static -DevToolsAgent* DevToolsAgent::FromHostId(int host_id) { - std::map<int, DevToolsAgent*>::iterator it = - agent_for_routing_id_.find(host_id); - if (it != agent_for_routing_id_.end()) { - return it->second; - } - return NULL; -} - -void DevToolsAgent::OnAttach( - const DevToolsRuntimeProperties& runtime_properties) { - WebDevToolsAgent* web_agent = GetWebAgent(); - if (web_agent) { - web_agent->attach(); - for (DevToolsRuntimeProperties::const_iterator it = - runtime_properties.begin(); - it != runtime_properties.end(); ++it) { - web_agent->setRuntimeProperty(WebString::fromUTF8(it->first), - WebString::fromUTF8(it->second)); - } - } -} - -void DevToolsAgent::OnDetach() { - WebDevToolsAgent* web_agent = GetWebAgent(); - if (web_agent) - web_agent->detach(); -} - -void DevToolsAgent::OnFrontendLoaded() { - WebDevToolsAgent* web_agent = GetWebAgent(); - if (web_agent) - web_agent->frontendLoaded(); -} - -void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) { - WebDevToolsAgent* web_agent = GetWebAgent(); - if (web_agent) - web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message)); -} - -void DevToolsAgent::OnInspectElement(int x, int y) { - WebDevToolsAgent* web_agent = GetWebAgent(); - if (web_agent) { - web_agent->attach(); - web_agent->inspectElementAt(WebPoint(x, y)); - } -} - -void DevToolsAgent::OnNavigate() { - WebDevToolsAgent* web_agent = GetWebAgent(); - if (web_agent) { - web_agent->didNavigate(); - } -} - -void DevToolsAgent::OnSetupDevToolsClient() { - new DevToolsClient(render_view()); -} - -WebDevToolsAgent* DevToolsAgent::GetWebAgent() { - WebView* web_view = render_view()->webview(); - if (!web_view) - return NULL; - return web_view->devToolsAgent(); -} diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h deleted file mode 100644 index 9f21fa3..0000000 --- a/chrome/renderer/devtools_agent.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2011 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. - -#ifndef CHROME_RENDERER_DEVTOOLS_AGENT_H_ -#define CHROME_RENDERER_DEVTOOLS_AGENT_H_ -#pragma once - -#include <map> -#include <string> - -#include "base/basictypes.h" -#include "content/renderer/render_view_observer.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h" - -namespace WebKit { -class WebDevToolsAgent; -} - -struct DevToolsMessageData; - -typedef std::map<std::string, std::string> DevToolsRuntimeProperties; - -// DevToolsAgent belongs to the inspectable RenderView and provides Glue's -// agents with the communication capabilities. All messages from/to Glue's -// agents infrastructure are flowing through this communication agent. -// There is a corresponding DevToolsClient object on the client side. -class DevToolsAgent : public RenderViewObserver, - public WebKit::WebDevToolsAgentClient { - public: - explicit DevToolsAgent(RenderView* render_view); - virtual ~DevToolsAgent(); - - // Returns agent instance for its host id. - static DevToolsAgent* FromHostId(int host_id); - - WebKit::WebDevToolsAgent* GetWebAgent(); - - private: - friend class DevToolsAgentFilter; - - // RenderView::Observer implementation. - virtual bool OnMessageReceived(const IPC::Message& message); - - // WebDevToolsAgentClient implementation - virtual void sendMessageToInspectorFrontend(const WebKit::WebString& data); - virtual void sendDebuggerOutput(const WebKit::WebString& data); - - virtual int hostIdentifier(); - virtual void runtimeFeatureStateChanged(const WebKit::WebString& feature, - bool enabled); - virtual void runtimePropertyChanged(const WebKit::WebString& name, - const WebKit::WebString& value); - virtual WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* - createClientMessageLoop(); - virtual bool exposeV8DebuggerProtocol(); - virtual void clearBrowserCache(); - virtual void clearBrowserCookies(); - - void OnAttach(const DevToolsRuntimeProperties& runtime_properties); - void OnDetach(); - void OnFrontendLoaded(); - void OnDispatchOnInspectorBackend(const std::string& message); - void OnInspectElement(int x, int y); - void OnSetApuAgentEnabled(bool enabled); - void OnNavigate(); - void OnSetupDevToolsClient(); - - static std::map<int, DevToolsAgent*> agent_for_routing_id_; - - bool expose_v8_debugger_protocol_; - - DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); -}; - -#endif // CHROME_RENDERER_DEVTOOLS_AGENT_H_ diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc deleted file mode 100644 index 330fca3..0000000 --- a/chrome/renderer/devtools_agent_filter.cc +++ /dev/null @@ -1,100 +0,0 @@ -// 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_agent_filter.h" - -#include "base/message_loop.h" -#include "chrome/common/render_messages.h" -#include "chrome/renderer/devtools_agent.h" -#include "content/common/devtools_messages.h" -#include "content/renderer/plugin_channel_host.h" -#include "content/renderer/render_view.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" - -using WebKit::WebDevToolsAgent; -using WebKit::WebString; - -namespace { - -class MessageImpl : public WebDevToolsAgent::MessageDescriptor { - public: - MessageImpl(const std::string& message, int host_id) - : msg(message), - host_id(host_id) {} - virtual ~MessageImpl() {} - virtual WebDevToolsAgent* agent() { - DevToolsAgent* agent = DevToolsAgent::FromHostId(host_id); - if (!agent) - return 0; - return agent->GetWebAgent(); - } - virtual WebString message() { return WebString::fromUTF8(msg); } - private: - std::string msg; - int host_id; -}; - -} - -// static -void DevToolsAgentFilter::DispatchMessageLoop() { - MessageLoop* current = MessageLoop::current(); - bool old_state = current->NestableTasksAllowed(); - current->SetNestableTasksAllowed(true); - current->RunAllPending(); - current->SetNestableTasksAllowed(old_state); -} - -// static -IPC::Channel* DevToolsAgentFilter::channel_ = NULL; -// static -int DevToolsAgentFilter::current_routing_id_ = 0; - -DevToolsAgentFilter::DevToolsAgentFilter() - : message_handled_(false), - render_thread_loop_(MessageLoop::current()) { - WebDevToolsAgent::setMessageLoopDispatchHandler( - &DevToolsAgentFilter::DispatchMessageLoop); -} - -DevToolsAgentFilter::~DevToolsAgentFilter() { -} - -bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) { - // Dispatch debugger commands directly from IO. - message_handled_ = true; - current_routing_id_ = message.routing_id(); - IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, - OnDispatchOnInspectorBackend) - IPC_MESSAGE_UNHANDLED(message_handled_ = false) - IPC_END_MESSAGE_MAP() - return message_handled_; -} - -void DevToolsAgentFilter::OnFilterAdded(IPC::Channel* channel) { - channel_ = channel; -} - -void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) { - WebDevToolsAgent::executeDebuggerCommand( - WebString::fromUTF8(command), current_routing_id_); -} - -void DevToolsAgentFilter::OnDispatchOnInspectorBackend( - const std::string& message) { - if (!WebDevToolsAgent::shouldInterruptForMessage( - WebString::fromUTF8(message))) { - message_handled_ = false; - return; - } - WebDevToolsAgent::interruptAndDispatch( - new MessageImpl(message, current_routing_id_)); - - render_thread_loop_->PostTask( - FROM_HERE, - NewRunnableFunction(&WebDevToolsAgent::processPendingMessages)); -} diff --git a/chrome/renderer/devtools_agent_filter.h b/chrome/renderer/devtools_agent_filter.h deleted file mode 100644 index efe6280..0000000 --- a/chrome/renderer/devtools_agent_filter.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef CHROME_RENDERER_DEVTOOLS_AGENT_FILTER_H_ -#define CHROME_RENDERER_DEVTOOLS_AGENT_FILTER_H_ -#pragma once - -#include <string> - -#include "ipc/ipc_channel_proxy.h" - -class MessageLoop; -struct DevToolsMessageData; - -// DevToolsAgentFilter is registered as an IPC filter in order to be able to -// dispatch messages while on the IO thread. The reason for that is that while -// debugging, Render thread is being held by the v8 and hence no messages -// are being dispatched there. While holding the thread in a tight loop, -// v8 provides thread-safe Api for controlling debugger. In our case v8's Api -// is being used from this communication agent on the IO thread. -class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter { - public: - // There is a single instance of this class instantiated by the RenderThread. - DevToolsAgentFilter(); - virtual ~DevToolsAgentFilter(); - - static void SendRpcMessage(const DevToolsMessageData& data); - - private: - // IPC::ChannelProxy::MessageFilter override. Called on IO thread. - virtual bool OnMessageReceived(const IPC::Message& message); - - virtual void OnFilterAdded(IPC::Channel* channel); - - static void DispatchMessageLoop(); - - // OnDebuggerCommand will be executed in the IO thread so that we can - // handle debug messages even when v8 is stopped. - void OnDebuggerCommand(const std::string& command); - void OnDispatchOnInspectorBackend(const std::string& message); - - bool message_handled_; - MessageLoop* render_thread_loop_; - - // Made static to allow DevToolsAgent to use it for replying directly - // from IO thread. - static int current_routing_id_; - static IPC::Channel* channel_; - - DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter); -}; - -#endif // CHROME_RENDERER_DEVTOOLS_AGENT_FILTER_H_ diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc deleted file mode 100644 index d4b4c53..0000000 --- a/chrome/renderer/devtools_client.cc +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2011 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 "base/command_line.h" -#include "base/message_loop.h" -#include "base/utf_string_conversions.h" -#include "chrome/common/chrome_switches.h" -#include "content/common/devtools_messages.h" -#include "content/renderer/render_thread.h" -#include "content/renderer/render_view.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontend.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" -#include "ui/base/ui_base_switches.h" - -using WebKit::WebDevToolsFrontend; -using WebKit::WebString; - -DevToolsClient::DevToolsClient(RenderView* render_view) - : RenderViewObserver(render_view) { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - web_tools_frontend_.reset( - WebDevToolsFrontend::create( - render_view->webview(), - this, - ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); -} - -DevToolsClient::~DevToolsClient() { -} - -void DevToolsClient::SendToAgent(const IPC::Message& tools_agent_message) { - Send(new DevToolsHostMsg_ForwardToAgent(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_DispatchOnInspectorFrontend, - OnDispatchOnInspectorFrontend) - IPC_MESSAGE_UNHANDLED(handled = false); - IPC_END_MESSAGE_MAP() - - return handled; -} - -void DevToolsClient::sendFrontendLoaded() { - SendToAgent(DevToolsAgentMsg_FrontendLoaded(MSG_ROUTING_NONE)); -} - -void DevToolsClient::sendMessageToBackend(const WebString& message) { - SendToAgent(DevToolsAgentMsg_DispatchOnInspectorBackend(MSG_ROUTING_NONE, - message.utf8())); -} - -void DevToolsClient::sendDebuggerCommandToAgent(const WebString& command) { - SendToAgent(DevToolsAgentMsg_DebuggerCommand(MSG_ROUTING_NONE, - command.utf8())); -} - -void DevToolsClient::activateWindow() { - Send(new DevToolsHostMsg_ActivateWindow(routing_id())); -} - -void DevToolsClient::closeWindow() { - Send(new DevToolsHostMsg_CloseWindow(routing_id())); -} - -void DevToolsClient::requestDockWindow() { - Send(new DevToolsHostMsg_RequestDockWindow(routing_id())); -} - -void DevToolsClient::requestUndockWindow() { - Send(new DevToolsHostMsg_RequestUndockWindow(routing_id())); -} - -void DevToolsClient::saveAs(const WebKit::WebString& file_name, - const WebKit::WebString& content) { - Send(new DevToolsHostMsg_SaveAs(routing_id(), - file_name.utf8(), - content.utf8())); -} - -void DevToolsClient::OnDispatchOnInspectorFrontend(const std::string& message) { - web_tools_frontend_->dispatchOnInspectorFrontend( - WebString::fromUTF8(message)); -} - -bool DevToolsClient::shouldHideScriptsPanel() { - CommandLine* cmd = CommandLine::ForCurrentProcess(); - return cmd->HasSwitch(switches::kRemoteShellPort); -} diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h deleted file mode 100644 index c4687fc..0000000 --- a/chrome/renderer/devtools_client.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2011 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. - -#ifndef CHROME_RENDERER_DEVTOOLS_CLIENT_H_ -#define CHROME_RENDERER_DEVTOOLS_CLIENT_H_ -#pragma once - -#include <string> - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "content/renderer/render_view_observer.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h" - -class MessageLoop; - -namespace WebKit { -class WebDevToolsFrontend; -class WebString; -} - -struct DevToolsMessageData; - -// Developer tools UI end of communication channel between the render process of -// the page being inspected and tools UI renderer process. All messages will -// go through browser process. On the side of the inspected page there's -// corresponding DevToolsAgent object. -// TODO(yurys): now the client is almost empty later it will delegate calls to -// code in glue -class DevToolsClient : public RenderViewObserver, - public WebKit::WebDevToolsFrontendClient { - public: - explicit DevToolsClient(RenderView* render_view); - virtual ~DevToolsClient(); - - private: - // RenderView::Observer implementation. - virtual bool OnMessageReceived(const IPC::Message& message); - - // WebDevToolsFrontendClient implementation - virtual void sendFrontendLoaded(); - virtual void sendMessageToBackend(const WebKit::WebString&); - virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command); - - virtual void activateWindow(); - virtual void closeWindow(); - virtual void requestDockWindow(); - virtual void requestUndockWindow(); - virtual void saveAs(const WebKit::WebString& file_name, - const WebKit::WebString& content); - - virtual bool shouldHideScriptsPanel(); - - void OnDispatchOnInspectorFrontend(const std::string& message); - - // Sends message to DevToolsAgent. - void SendToAgent(const IPC::Message& tools_agent_message); - - scoped_ptr<WebKit::WebDevToolsFrontend> web_tools_frontend_; - - DISALLOW_COPY_AND_ASSIGN(DevToolsClient); -}; - -#endif // CHROME_RENDERER_DEVTOOLS_CLIENT_H_ |