diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 18:51:34 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 18:51:34 +0000 |
commit | 611cad45a3bc67189d273eaba0171b96f7bdbd97 (patch) | |
tree | 3fc4655ab572b37310dc43c53a510affd430496d | |
parent | 12e0eed769a220d8ff490f092a7235af6f68270e (diff) | |
download | chromium_src-611cad45a3bc67189d273eaba0171b96f7bdbd97.zip chromium_src-611cad45a3bc67189d273eaba0171b96f7bdbd97.tar.gz chromium_src-611cad45a3bc67189d273eaba0171b96f7bdbd97.tar.bz2 |
Wire DevTools agent in the Glue to the Renderer DevTools IPC transport: DevToolsAgent now implements WebDevToolsAgentDelegate, DevToolsClient covers WebDevToolsClientDelegate.
WebDevToolsAgent instance is being created by the WebView early in the init code and belongs to it. WebView exposes interface for accessing the agent; it also extends its delegate interface to pass WebDevToolsAgentDelegate into it.
Note that there is no call overhead unless particular sub-agents are enabled in the WebDevToolsAgent.
WebDevToolsClient instance is being created externally by the DevToolsClient.
Review URL: http://codereview.chromium.org/46032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11752 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/dev_tools_agent.cc | 33 | ||||
-rw-r--r-- | chrome/renderer/dev_tools_agent.h | 13 | ||||
-rw-r--r-- | chrome/renderer/dev_tools_client.cc | 12 | ||||
-rw-r--r-- | chrome/renderer/dev_tools_client.h | 14 | ||||
-rw-r--r-- | chrome/renderer/dev_tools_messages_internal.h | 8 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 3 | ||||
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.cc | 74 | ||||
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.h | 4 | ||||
-rw-r--r-- | webkit/glue/webview.h | 4 | ||||
-rw-r--r-- | webkit/glue/webview_delegate.h | 7 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 15 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 7 |
13 files changed, 186 insertions, 16 deletions
diff --git a/chrome/renderer/dev_tools_agent.cc b/chrome/renderer/dev_tools_agent.cc index ac453d5..d66881d 100644 --- a/chrome/renderer/dev_tools_agent.cc +++ b/chrome/renderer/dev_tools_agent.cc @@ -2,6 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// DevToolsAgent belongs to the inspectable renderer and provides Glue's +// agents with the communication capabilities. All messages from/to Glue's +// agents infrastructure are flowing through this comminucation agent. +// +// DevToolsAgent 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. + #include "chrome/renderer/dev_tools_agent.h" #include "base/message_loop.h" @@ -13,10 +24,13 @@ #endif // OS_WIN #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_view.h" +#include "webkit/glue/webdevtoolsagent.h" -DevToolsAgent::DevToolsAgent(RenderView* view, MessageLoop* view_loop) +DevToolsAgent::DevToolsAgent(int routing_id, + RenderView* view, + MessageLoop* view_loop) : debugger_(NULL), - routing_id_(view->routing_id()), + routing_id_(routing_id), view_(view), view_loop_(view_loop), channel_(NULL), @@ -72,6 +86,7 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebugDetach, OnDebugDetach) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebugBreak, OnDebugBreak) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebugCommand, OnDebugCommand) + IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -150,3 +165,17 @@ void DevToolsAgent::OnDebugCommand(const std::wstring& cmd) { debugger_->Command(cmd); } } + +void DevToolsAgent::SendMessageToClient(const std::string& raw_msg) { + Send(DevToolsClientMsg_RpcMessage(raw_msg)); +} + +void DevToolsAgent::OnRpcMessage(const std::string& raw_msg) { + view_loop_->PostTask(FROM_HERE, NewRunnableMethod( + this, &DevToolsAgent::DispatchRpcMessage, raw_msg)); +} + +void DevToolsAgent::DispatchRpcMessage(const std::string& raw_msg) { + WebDevToolsAgent* web_agent = view_->webview()->GetWebDevToolsAgent(); + web_agent->DispatchMessageFromClient(raw_msg); +} diff --git a/chrome/renderer/dev_tools_agent.h b/chrome/renderer/dev_tools_agent.h index 86b2d33..8ee1885 100644 --- a/chrome/renderer/dev_tools_agent.h +++ b/chrome/renderer/dev_tools_agent.h @@ -11,7 +11,9 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "chrome/common/ipc_channel_proxy.h" +#include "chrome/renderer/dev_tools_messages.h" #include "webkit/glue/debugger_bridge.h" +#include "webkit/glue/webdevtoolsagent_delegate.h" class MessageLoop; class RenderView; @@ -21,13 +23,17 @@ class RenderView; // go through browser process. On the renderer side of the tools UI there's // a corresponding ToolsClient object. class DevToolsAgent : public IPC::ChannelProxy::MessageFilter, - public DebuggerBridge::Delegate { + public DebuggerBridge::Delegate, + public WebDevToolsAgentDelegate { public: // DevToolsAgent is a field of the RenderView. The view is supposed to remove // this agent from message filter list on IO thread before dying. - explicit DevToolsAgent(RenderView* view, MessageLoop* view_loop); + DevToolsAgent(int routing_id, RenderView* view, MessageLoop* view_loop); virtual ~DevToolsAgent(); + // WebDevToolsAgentDelegate implementation + virtual void SendMessageToClient(const std::string& raw_msg); + // DevToolsAgent is created by RenderView which is supposed to call this // method from its destructor. void RenderViewDestroyed(); @@ -48,6 +54,8 @@ class DevToolsAgent : public IPC::ChannelProxy::MessageFilter, // Debugger::Delegate callback method to handle debugger output. void DebuggerOutput(const std::wstring& out); + void DispatchRpcMessage(const std::string& raw_msg); + // Evaluate javascript URL in the renderer void EvaluateScript(const std::wstring& script); @@ -57,6 +65,7 @@ class DevToolsAgent : public IPC::ChannelProxy::MessageFilter, void OnDebugDetach(); void OnDebugBreak(bool force); void OnDebugCommand(const std::wstring& cmd); + void OnRpcMessage(const std::string& raw_msg); scoped_refptr<DebuggerBridge> debugger_; diff --git a/chrome/renderer/dev_tools_client.cc b/chrome/renderer/dev_tools_client.cc index 502ef39..eb1523d 100644 --- a/chrome/renderer/dev_tools_client.cc +++ b/chrome/renderer/dev_tools_client.cc @@ -8,9 +8,12 @@ #include "chrome/renderer/dev_tools_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() { @@ -28,6 +31,7 @@ bool DevToolsClient::OnMessageReceived(const IPC::Message& message) { 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() @@ -38,3 +42,11 @@ 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); +} diff --git a/chrome/renderer/dev_tools_client.h b/chrome/renderer/dev_tools_client.h index fd92dcf..4419a4f 100644 --- a/chrome/renderer/dev_tools_client.h +++ b/chrome/renderer/dev_tools_client.h @@ -5,13 +5,18 @@ #ifndef CHROME_RENDERER_DEV_TOOLS_CLIENT_H_ #define CHROME_RENDERER_DEV_TOOLS_CLIENT_H_ -#include "base/basictypes.h" +#include <string> + +#include "base/scoped_ptr.h" +#include "chrome/renderer/dev_tools_messages.h" +#include "webkit/glue/webdevtoolsclient_delegate.h" namespace IPC { class Message; } class MessageLoop; class RenderView; +class WebDevToolsClient; // Developer tools UI end of communication channel between the render process of // the page being inspected and tools UI renderer process. All messages will @@ -19,7 +24,7 @@ class RenderView; // corresponding DevToolsAgent object. // TODO(yurys): now the client is almost empty later it will delegate calls to // code in glue -class DevToolsClient { +class DevToolsClient : public WebDevToolsClientDelegate { public: explicit DevToolsClient(RenderView* view); virtual ~DevToolsClient(); @@ -28,13 +33,18 @@ class DevToolsClient { // handled. Called in render thread. bool OnMessageReceived(const IPC::Message& message); + // WebDevToolsClient::Delegate implementation + virtual void SendMessageToAgent(const std::string& raw_msg); + private: void DidDebugAttach(); + void OnRpcMessage(const std::string& raw_msg); // Sends message to DevToolsAgent. void Send(const IPC::Message& tools_agent_message); RenderView* render_view_; // host render view + scoped_ptr<WebDevToolsClient> web_tools_client_; DISALLOW_COPY_AND_ASSIGN(DevToolsClient); }; diff --git a/chrome/renderer/dev_tools_messages_internal.h b/chrome/renderer/dev_tools_messages_internal.h index 8922f18..49eee11 100644 --- a/chrome/renderer/dev_tools_messages_internal.h +++ b/chrome/renderer/dev_tools_messages_internal.h @@ -53,6 +53,10 @@ IPC_BEGIN_MESSAGES(DevToolsClient) IPC_MESSAGE_CONTROL1(DevToolsClientMsg_DebuggerOutput, std::wstring /* msg */) + // Sends glue-level Rpc message to the client. + IPC_MESSAGE_CONTROL1(DevToolsClientMsg_RpcMessage, + std::string /* raw_msg */) + IPC_END_MESSAGES(DevToolsClient) @@ -75,4 +79,8 @@ IPC_BEGIN_MESSAGES(DevToolsAgent) IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_DebugCommand, std::wstring /* cmd */) + // Sends glue-level Rpc message to the agent. + IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_RpcMessage, + std::string /* raw_msg */) + IPC_END_MESSAGES(DevToolsAgent) diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 50c98ec..000443e 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -51,6 +51,7 @@ #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/searchable_form_data.h" #include "webkit/glue/webdatasource.h" +#include "webkit/glue/webdevtoolsagent_delegate.h" #include "webkit/glue/webdropdata.h" #include "webkit/glue/weberror.h" #include "webkit/glue/webframe.h" @@ -294,6 +295,8 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd, decrement_shared_popup_at_destruction_ = false; } + dev_tools_agent_ = new DevToolsAgent(routing_id, this, + MessageLoop::current()); webwidget_ = WebView::Create(this, webkit_prefs); // Don't let WebCore keep a B/F list - we have our own. @@ -326,7 +329,6 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd, debug_message_handler_ = new DebugMessageHandler(this); render_thread_->AddFilter(debug_message_handler_); - dev_tools_agent_ = new DevToolsAgent(this, MessageLoop::current()); render_thread_->AddFilter(dev_tools_agent_); } @@ -2461,6 +2463,10 @@ void RenderView::DownloadUrl(const GURL& url, const GURL& referrer) { Send(new ViewHostMsg_DownloadUrl(routing_id_, url, referrer)); } +WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() { + return dev_tools_agent_; +} + WebFrame* RenderView::GetChildFrame(const std::wstring& frame_xpath) const { WebFrame* web_frame; if (frame_xpath.empty()) { diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 8973346..47472db 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -57,6 +57,7 @@ class WebError; class WebFrame; class WebPluginDelegate; class WebPluginDelegateProxy; +class WebDevToolsAgentDelegate; struct AccessibilityInParams; struct AccessibilityOutParams; struct FindInPageRequest; @@ -274,6 +275,8 @@ class RenderView : public RenderWidget, virtual void DownloadUrl(const GURL& url, const GURL& referrer); + virtual WebDevToolsAgentDelegate* GetWebDevToolsAgentDelegate(); + virtual void OnPasswordFormsSeen(WebView* webview, const std::vector<PasswordForm>& forms); diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index 7634fb0..7855cb6 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -44,11 +44,13 @@ MSVC_POP_WARNING(); #endif #include "webkit/glue/autofill_form.h" #include "webkit/glue/alt_404_page_resource_fetcher.h" +#include "webkit/glue/devtools/net_agent_impl.h" #include "webkit/glue/glue_util.h" #include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/searchable_form_data.h" #include "webkit/glue/webdatasource_impl.h" +#include "webkit/glue/webdevtoolsagent_impl.h" #include "webkit/glue/weberror_impl.h" #include "webkit/glue/webframeloaderclient_impl.h" #include "webkit/glue/webhistoryitem_impl.h" @@ -163,6 +165,10 @@ void WebFrameLoaderClient::assignIdentifierToInitialRequest( WebRequestImpl webreq(request); d->AssignIdentifierToRequest(webview, identifier, webreq); } + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->AssignIdentifierToRequest(loader, identifier, request); + } } // Determines whether the request being loaded by |loader| is a frame or a @@ -212,6 +218,10 @@ void WebFrameLoaderClient::dispatchWillSendRequest( d->WillSendRequest(webview, identifier, &webreq); request = webreq.frame_load_request().resourceRequest(); } + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->WillSendRequest(loader, identifier, request); + } } bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, @@ -276,12 +286,21 @@ void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, // Cancel any pending loads. alt_404_page_fetcher_.reset(NULL); + + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->DidReceiveResponse(loader, identifier, response); + } } -void WebFrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader* loader, - unsigned long identifier, - int lengthReceived) { - // FIXME +void WebFrameLoaderClient::dispatchDidReceiveContentLength( + DocumentLoader* loader, + unsigned long identifier, + int length_received) { + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->DidReceiveContentLength(loader, identifier, length_received); + } } // Called when a particular resource load completes @@ -301,6 +320,11 @@ void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader* loader, WebViewDelegate* d = webview->delegate(); if (d) d->DidFinishLoading(webview, identifier); + + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->DidFinishLoading(loader, identifier); + } } GURL WebFrameLoaderClient::GetAlt404PageUrl(DocumentLoader* loader) { @@ -342,6 +366,10 @@ void WebFrameLoaderClient::dispatchDidFailLoading(DocumentLoader* loader, webview->delegate()->DidFailLoadingWithError(webview, identifier, WebErrorImpl(error)); } + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->DidFailLoading(loader, identifier, error); + } } void WebFrameLoaderClient::dispatchDidFinishDocumentLoad() { @@ -392,14 +420,23 @@ bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache( int length) { WebViewImpl* webview = webframe_->webview_impl(); WebViewDelegate* d = webview->delegate(); + + bool result = false; if (d) { WebRequestImpl webreq(request); WebResponseImpl webresp(response); - return d->DidLoadResourceFromMemoryCache(webview, webreq, webresp, - webframe_); + result = d->DidLoadResourceFromMemoryCache(webview, webreq, webresp, + webframe_); } - - return false; + NetAgentImpl* net_agent = GetNetAgentImpl(); + if (net_agent) { + net_agent->DidLoadResourceFromMemoryCache( + loader, + request, + response, + length); + } + return result; } void WebFrameLoaderClient::dispatchDidHandleOnloadEvents() { @@ -1048,7 +1085,13 @@ void WebFrameLoaderClient::postProgressFinishedNotification() { } void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready) { - // FIXME + if (hasWebView()) { + WebDevToolsAgentImpl* tools_agent = + webframe_->webview_impl()->GetWebDevToolsAgentImpl(); + if (tools_agent) { + tools_agent->SetMainFrameDocumentReady(ready); + } + } } // Creates a new connection and begins downloading from that (contrast this @@ -1520,3 +1563,16 @@ bool WebFrameLoaderClient::ActionSpecifiesDisposition( *disposition = shift ? NEW_WINDOW : SAVE_TO_DISK; return true; } + +NetAgentImpl* WebFrameLoaderClient::GetNetAgentImpl() { + WebViewImpl* web_view = webframe_->webview_impl(); + if (!web_view) { + return NULL; + } + WebDevToolsAgentImpl* tools_agent = web_view->GetWebDevToolsAgentImpl(); + if (tools_agent) { + return tools_agent->net_agent_impl(); + } else { + return NULL; + } +} diff --git a/webkit/glue/webframeloaderclient_impl.h b/webkit/glue/webframeloaderclient_impl.h index 4281d2f..b322f10 100644 --- a/webkit/glue/webframeloaderclient_impl.h +++ b/webkit/glue/webframeloaderclient_impl.h @@ -25,6 +25,7 @@ class Widget; } class Alt404PageResourceFetcher; +class NetAgentImpl; class WebFrameImpl; class WebPluginContainer; @@ -216,6 +217,9 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { // otherwise returns NavigationGestureUnknown. NavigationGesture NavigationGestureForLastLoad(); + // Returns NetAgent instance if network tracking is enabled. + NetAgentImpl* GetNetAgentImpl(); + // The WebFrame that owns this object and manages its lifetime. Therefore, // the web frame object is guaranteed to exist. WebFrameImpl* webframe_; diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index e2e9520..4a569d6 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -14,6 +14,7 @@ struct WebDropData; struct WebPreferences; class GURL; +class WebDevToolsAgent; class WebFrame; class WebViewDelegate; @@ -196,6 +197,9 @@ class WebView : public WebWidget { // Hides the autofill popup if any are showing. virtual void HideAutofillPopup() = 0; + // Returns development tools agent instance belonging to this view. + virtual WebDevToolsAgent* GetWebDevToolsAgent() = 0; + private: DISALLOW_EVIL_CONSTRUCTORS(WebView); }; diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index a1a90d2..b7e9d0d 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -45,6 +45,7 @@ struct WebDropData; struct WebPreferences; class AutofillForm; class SkBitmap; +class WebDevToolsAgentDelegate; class WebError; class WebFrame; class WebHistoryItem; @@ -741,6 +742,12 @@ class WebViewDelegate : virtual public WebWidgetDelegate { virtual void DownloadUrl(const GURL& url, const GURL& referrer) { } + // DevTools ---------------------------------------------------------------- + + virtual WebDevToolsAgentDelegate* GetWebDevToolsAgentDelegate() { + return NULL; + } + // Editor Client ----------------------------------------------------------- // Returns true if the word is spelled correctly. The word may begin or end diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 0d05a2b..ca57b7b 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -86,6 +86,7 @@ MSVC_POP_WARNING(); #include "webkit/glue/chrome_client_impl.h" #include "webkit/glue/clipboard_conversion.h" #include "webkit/glue/context_menu_client_impl.h" +#include "webkit/glue/webdevtoolsagent_impl.h" #include "webkit/glue/dragclient_impl.h" #include "webkit/glue/editor_client_impl.h" #include "webkit/glue/event_conversion.h" @@ -99,6 +100,8 @@ MSVC_POP_WARNING(); #include "webkit/glue/webinputevent.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" +#include "webkit/glue/webdevtoolsagent.h" +#include "webkit/glue/webdevtoolsclient.h" #include "webkit/glue/webview_delegate.h" #include "webkit/glue/webview_impl.h" #include "webkit/glue/webwidget_impl.h" @@ -315,6 +318,9 @@ WebView* WebView::Create(WebViewDelegate* delegate, // Set the delegate after initializing the main frame, to avoid trying to // respond to notifications before we're fully initialized. instance->delegate_ = delegate; + instance->devtools_agent_.reset( + new WebDevToolsAgentImpl(instance, + delegate->GetWebDevToolsAgentDelegate())); // Restrict the access to the local file system // (see WebView.mm WebView::_commonInitializationWithFrameName). FrameLoader::setLocalLoadPolicy( @@ -815,6 +821,7 @@ void WebViewImpl::Close() { // Do this first to prevent reentrant notifications from being sent to the // initiator of the close. delegate_ = NULL; + devtools_agent_.reset(NULL); if (page_.get()) { // Initiate shutdown for the entire frameset. This will cause a lot of @@ -1605,6 +1612,14 @@ void WebViewImpl::AutofillSuggestionsForNode( } } +WebDevToolsAgent* WebViewImpl::GetWebDevToolsAgent() { + return GetWebDevToolsAgentImpl(); +} + +WebDevToolsAgentImpl* WebViewImpl::GetWebDevToolsAgentImpl() { + return devtools_agent_.get(); +} + void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { if (is_new_navigation) *is_new_navigation = observed_new_navigation_; diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 61bb396..78e0a63 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -42,6 +42,8 @@ class WebHistoryItemImpl; class WebKeyboardEvent; class WebMouseEvent; class WebMouseWheelEvent; +class WebDevToolsAgent; +class WebDevToolsAgentImpl; class WebViewDelegate; class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { @@ -107,6 +109,9 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { int default_suggestion_index); virtual void HideAutofillPopup(); + virtual WebDevToolsAgent* GetWebDevToolsAgent(); + WebDevToolsAgentImpl* GetWebDevToolsAgentImpl(); + // WebViewImpl const gfx::Size& size() const { return size_; } @@ -311,6 +316,8 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // The autocomplete client. scoped_ptr<AutocompletePopupMenuClient> autocomplete_popup_client_; + scoped_ptr<WebDevToolsAgentImpl> devtools_agent_; + // HACK: current_input_event is for ChromeClientImpl::show(), until we can fix // WebKit to pass enough information up into ChromeClient::show() so we can // decide if the window.open event was caused by a middle-mouse click |