diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-04 01:56:42 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-04 01:56:42 +0000 |
commit | 1d5222071e5876b345e84d475573ef5db14ba1b4 (patch) | |
tree | 175872c72f290f4e89fd49724fbe6d085a379769 /webkit | |
parent | f25810a9541a15facf4252236432335629d10e50 (diff) | |
download | chromium_src-1d5222071e5876b345e84d475573ef5db14ba1b4.zip chromium_src-1d5222071e5876b345e84d475573ef5db14ba1b4.tar.gz chromium_src-1d5222071e5876b345e84d475573ef5db14ba1b4.tar.bz2 |
Callbacks through ChromeClient->RenderView->RenderViewHost for ContentsDidChangeSize so that extensions can change their toolbar size when the contained contents changes size.
Review URL: http://codereview.chromium.org/56122
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/chrome_client_impl.cc | 9 | ||||
-rw-r--r-- | webkit/glue/chrome_client_impl.h | 3 | ||||
-rw-r--r-- | webkit/glue/webframe.h | 3 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 10 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 1 | ||||
-rw-r--r-- | webkit/glue/webview_delegate.h | 4 |
6 files changed, 29 insertions, 1 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index 60cfe9b..f190551 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -448,6 +448,15 @@ PlatformWidget ChromeClientImpl::platformWindow() const { return delegate ? delegate->GetContainingView(webview_) : NULL; } +void ChromeClientImpl::contentsSizeChanged(WebCore::Frame* frame, const + WebCore::IntSize& size) const { + WebViewDelegate* delegate = webview_->delegate(); + + if (delegate) { + delegate->DidContentsSizeChange(webview_, size.width(), size.height()); + } +} + void ChromeClientImpl::mouseDidMoveOverElement( const WebCore::HitTestResult& result, unsigned modifierFlags) { // Find out if the mouse is over a link, and if so, let our UI know... somehow diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h index bf515d2..ad427f4 100644 --- a/webkit/glue/chrome_client_impl.h +++ b/webkit/glue/chrome_client_impl.h @@ -102,7 +102,8 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium { virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; virtual PlatformWidget platformWindow() const; - virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const {} + virtual void contentsSizeChanged(WebCore::Frame*, + const WebCore::IntSize&) const; virtual void mouseDidMoveOverElement(const WebCore::HitTestResult& result, unsigned modifierFlags); diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 7a2c376..93f5698d 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -140,6 +140,9 @@ class WebFrame { // the page does not have a valid document, an empty GURL is returned. virtual GURL GetOSDDURL() const = 0; + // Return the minPrefWidth of the content contained in the current Document + virtual int GetContentsPreferredWidth() const = 0; + // Return the list of feeds specified in the document for the frame. If // the page does not have a valid document, an empty list is returned. virtual scoped_refptr<class FeedList> GetFeedList() const = 0; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index f647a72..11bdf5e 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -105,6 +105,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #if defined(OS_WIN) #include "RenderThemeChromiumWin.h" #endif +#include "RenderView.h" #include "RenderWidget.h" #include "ReplaceSelectionCommand.h" #include "ResourceHandle.h" @@ -538,6 +539,15 @@ GURL WebFrameImpl::GetOSDDURL() const { return GURL(); } +int WebFrameImpl::GetContentsPreferredWidth() const { + if ((frame_->document() != NULL) && + (frame_->document()->renderView() != NULL)) { + return frame_->document()->renderView()->minPrefWidth(); + } else { + return 0; + } +} + scoped_refptr<FeedList> WebFrameImpl::GetFeedList() const { scoped_refptr<FeedList> feedlist = new FeedList(); diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 8bb334e..11d8731 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -101,6 +101,7 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { virtual GURL GetURL() const; virtual GURL GetFavIconURL() const; virtual GURL GetOSDDURL() const; + virtual int GetContentsPreferredWidth() const; virtual scoped_refptr<class FeedList> GetFeedList() const; virtual WebDataSource* GetDataSource() const; virtual WebDataSource* GetProvisionalDataSource() const; diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 482a24b..e58b518 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -485,6 +485,10 @@ class WebViewDelegate : virtual public WebWidgetDelegate { const std::wstring& value) { } + virtual void DidContentsSizeChange(WebWidget* webwidget, int new_width, + int new_height) { + } + // UIDelegate -------------------------------------------------------------- // Asks the browser to show a modal HTML dialog. The dialog is passed the |