diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 09:13:01 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 09:13:01 +0000 |
commit | 503683f23ea6fe3eb728f2d09f81f2603ffc7d6f (patch) | |
tree | f9bb89d453f8d1dbd4689f0d14c477ca10e2356f /chrome/browser/tab_contents | |
parent | c8c4f954af8b55d12a3d76a0ef41def31594aceb (diff) | |
download | chromium_src-503683f23ea6fe3eb728f2d09f81f2603ffc7d6f.zip chromium_src-503683f23ea6fe3eb728f2d09f81f2603ffc7d6f.tar.gz chromium_src-503683f23ea6fe3eb728f2d09f81f2603ffc7d6f.tar.bz2 |
Developer tools messages are forwarded as wrapped IPC::Messages(previously they were represented as int type+string body).
I stole IPC::Message serialization code from jam's CL(http://codereview.chromium.org/20413).
jam: please look at message forwarding code. When tools messages are send from browser to renderer they are also wrapped(unlike worker messages which are unwrapped and sent as is). It allows to describe developer tools messages in its own file instead of putting all of them into render_messages_internal.h
brettw: please check if it's OK to have ForwardMessageToToolsClient in WebContentsView
Review URL: http://codereview.chromium.org/21540
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
8 files changed, 63 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index 4511447..9781a0e 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -87,6 +87,7 @@ class InterstitialPage::InterstitialPageRVHViewDelegate virtual void UpdateDragCursor(bool is_drop_target); virtual void TakeFocus(bool reverse); virtual void HandleKeyboardEvent(const WebKeyboardEvent& event); + virtual void ForwardMessageToDevToolsClient(const IPC::Message& message); virtual void OnFindReply(int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -502,6 +503,11 @@ void InterstitialPage::InterstitialPageRVHViewDelegate::HandleKeyboardEvent( interstitial_page_->tab()->GetViewDelegate()->HandleKeyboardEvent(event); } +void InterstitialPage::InterstitialPageRVHViewDelegate:: + ForwardMessageToDevToolsClient(const IPC::Message& message) { + NOTREACHED() << "InterstitialPage does not support developer tools content."; +} + void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) { diff --git a/chrome/browser/tab_contents/web_contents_view.h b/chrome/browser/tab_contents/web_contents_view.h index 1a8b4f6..f9d7075 100644 --- a/chrome/browser/tab_contents/web_contents_view.h +++ b/chrome/browser/tab_contents/web_contents_view.h @@ -108,6 +108,13 @@ class WebContentsView : public RenderViewHostDelegate::View { // RenderWidgetHost is deleted. Removes |host| from internal maps. void RenderWidgetHostDestroyed(RenderWidgetHost* host); + // Opens developer tools window for the page. + virtual void OpenDeveloperTools() = 0; + + // Forwards message to DevToolsClient in developer tools window open for this + // page. + virtual void ForwardMessageToDevToolsClient(const IPC::Message& message) = 0; + protected: WebContentsView() {} // Abstract interface. diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc index 62fbd3a..e82b128 100644 --- a/chrome/browser/tab_contents/web_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc @@ -89,6 +89,15 @@ void WebContentsViewGtk::SizeContents(const gfx::Size& size) { NOTIMPLEMENTED(); } +void WebContentsViewGtk::OpenDeveloperTools() { + NOTIMPLEMENTED(); +} + +void WebContentsViewGtk::ForwardMessageToDevToolsClient( + const IPC::Message& message) { + NOTIMPLEMENTED(); +} + void WebContentsViewGtk::FindInPage(const Browser& browser, bool find_next, bool forward_direction) { NOTIMPLEMENTED(); diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.h b/chrome/browser/tab_contents/web_contents_view_gtk.h index a4273f5..ea5e38c 100644 --- a/chrome/browser/tab_contents/web_contents_view_gtk.h +++ b/chrome/browser/tab_contents/web_contents_view_gtk.h @@ -30,6 +30,8 @@ class WebContentsViewGtk : public WebContentsView { virtual void SetPageTitle(const std::wstring& title); virtual void Invalidate(); virtual void SizeContents(const gfx::Size& size); + virtual void OpenDeveloperTools(); + virtual void ForwardMessageToDevToolsClient(const IPC::Message& message); virtual void FindInPage(const Browser& browser, bool find_next, bool forward_direction); virtual void HideFindBar(bool end_session); diff --git a/chrome/browser/tab_contents/web_contents_view_mac.h b/chrome/browser/tab_contents/web_contents_view_mac.h index d576605..44772a5 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.h +++ b/chrome/browser/tab_contents/web_contents_view_mac.h @@ -46,6 +46,8 @@ class WebContentsViewMac : public WebContentsView, virtual void SetPageTitle(const std::wstring& title); virtual void Invalidate(); virtual void SizeContents(const gfx::Size& size); + virtual void OpenDeveloperTools(); + virtual void ForwardMessageToDevToolsClient(const IPC::Message& message); virtual void FindInPage(const Browser& browser, bool find_next, bool forward_direction); virtual void HideFindBar(bool end_session); diff --git a/chrome/browser/tab_contents/web_contents_view_mac.mm b/chrome/browser/tab_contents/web_contents_view_mac.mm index c784ee0..a382bca 100644 --- a/chrome/browser/tab_contents/web_contents_view_mac.mm +++ b/chrome/browser/tab_contents/web_contents_view_mac.mm @@ -99,6 +99,15 @@ void WebContentsViewMac::SizeContents(const gfx::Size& size) { NOTIMPLEMENTED(); // Leaving the hack unimplemented. } +void WebContentsViewMac::OpenDeveloperTools() { + NOTIMPLEMENTED(); +} + +void WebContentsViewMac::ForwardMessageToDevToolsClient( + const IPC::Message& message) { + NOTIMPLEMENTED(); +} + void WebContentsViewMac::FindInPage(const Browser& browser, bool find_next, bool forward_direction) { if (!find_bar_.get()) { diff --git a/chrome/browser/tab_contents/web_contents_view_win.cc b/chrome/browser/tab_contents/web_contents_view_win.cc index b88a899..73602d7 100644 --- a/chrome/browser/tab_contents/web_contents_view_win.cc +++ b/chrome/browser/tab_contents/web_contents_view_win.cc @@ -9,6 +9,7 @@ #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. #include "chrome/browser/browser_process.h" +#include "chrome/browser/debugger/dev_tools_window.h" #include "chrome/browser/download/download_request_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -212,6 +213,26 @@ void WebContentsViewWin::SizeContents(const gfx::Size& size) { WasSized(size); } +void WebContentsViewWin::OpenDeveloperTools() { + if (!dev_tools_window_.get()) + dev_tools_window_.reset(new DevToolsWindow); + + RenderViewHost* host = web_contents_->render_view_host(); + if (!host) + return; + + dev_tools_window_->Show(host->process()->host_id(), host->routing_id()); +} + +void WebContentsViewWin::ForwardMessageToDevToolsClient( + const IPC::Message& message) { + if (!dev_tools_window_.get()) { + NOTREACHED() << "Developer tools window is not open."; + return; + } + dev_tools_window_->SendDevToolsClientMessage(message); +} + void WebContentsViewWin::UpdateDragCursor(bool is_drop_target) { drop_target_->set_is_drop_target(is_drop_target); } diff --git a/chrome/browser/tab_contents/web_contents_view_win.h b/chrome/browser/tab_contents/web_contents_view_win.h index 6b891cf..afa2c3a 100644 --- a/chrome/browser/tab_contents/web_contents_view_win.h +++ b/chrome/browser/tab_contents/web_contents_view_win.h @@ -10,10 +10,12 @@ #include "chrome/browser/tab_contents/web_contents_view.h" #include "chrome/views/widget_win.h" +class DevToolsWindow; class SadTabView; struct WebDropData; class WebDropTarget; + // Windows-specific implementation of the WebContentsView. It is a HWND that // contains all of the contents of the tab and associated child views. class WebContentsViewWin : public WebContentsView, @@ -39,6 +41,8 @@ class WebContentsViewWin : public WebContentsView, virtual void SetPageTitle(const std::wstring& title); virtual void Invalidate(); virtual void SizeContents(const gfx::Size& size); + virtual void OpenDeveloperTools(); + virtual void ForwardMessageToDevToolsClient(const IPC::Message& message); // Backend implementation of RenderViewHostDelegate::View. virtual WebContents* CreateNewWindowInternal( @@ -96,6 +100,9 @@ class WebContentsViewWin : public WebContentsView, WebContents* web_contents_; + // Allows to show exactly one developer tools window for this page. + scoped_ptr<DevToolsWindow> dev_tools_window_; + // A drop target object that handles drags over this WebContents. scoped_refptr<WebDropTarget> drop_target_; |