diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 23:20:35 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 23:20:35 +0000 |
commit | e6fae1bb7b0da3005d0d5f3d5106e36fba1690c5 (patch) | |
tree | ba7d5d8bf7357f66d41292d347e1e4ff0500f5b0 | |
parent | 26865477e028ccee54a243467693e7cc25bf6783 (diff) | |
download | chromium_src-e6fae1bb7b0da3005d0d5f3d5106e36fba1690c5.zip chromium_src-e6fae1bb7b0da3005d0d5f3d5106e36fba1690c5.tar.gz chromium_src-e6fae1bb7b0da3005d0d5f3d5106e36fba1690c5.tar.bz2 |
Move ClosePage method to WebView.
Since it is about closing a page, WebView is a better home for it.
R=dglazkov
BUG=10034
TEST=none
Review URL: http://codereview.chromium.org/164105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22689 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/render_view.cc | 2 | ||||
-rw-r--r-- | webkit/glue/webframe.h | 7 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 6 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 2 | ||||
-rw-r--r-- | webkit/glue/webview.h | 9 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 5 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 1 |
7 files changed, 16 insertions, 16 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 6b3d127f..0b9898c 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2857,8 +2857,8 @@ void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { // multiple times for the same frame, but it will simplify things. if (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme)) DumpLoadHistograms(); - main_frame->ClosePage(); } + webview()->ClosePage(); // Just echo back the params in the ACK. Send(new ViewHostMsg_ClosePage_ACK(routing_id_, params)); diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 9ee7b23..ca3d063 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -394,13 +394,6 @@ class WebFrame { // Adds a message to the frame's console. virtual void AddMessageToConsole(const WebKit::WebConsoleMessage&) = 0; - // Tells the current page to close, running the onunload handler. - // TODO(creis): We'd rather use WebView::Close(), but that sets its delegate_ - // to NULL, preventing any JavaScript dialogs in the onunload handler from - // appearing. This lets us shortcut that for now, but we should refactor - // close messages so that this isn't necessary. - virtual void ClosePage() = 0; - // The current scroll offset from the top of frame in pixels. virtual WebKit::WebSize ScrollOffset() const = 0; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 6870280..2dad34d 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -1709,12 +1709,6 @@ void WebFrameImpl::AddMessageToConsole(const WebConsoleMessage& message) { 1, String()); } -void WebFrameImpl::ClosePage() { - // TODO(creis): Find a way to use WebView::Close() instead. (See comments in - // webframe.h and RenderView::OnClosePage.) - frame_->loader()->closeURL(); -} - WebSize WebFrameImpl::ScrollOffset() const { WebCore::FrameView* view = frameview(); if (view) diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index 81ba435..bdfac0c 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -181,8 +181,6 @@ class WebFrameImpl : public WebFrame, public base::RefCounted<WebFrameImpl> { virtual void AddMessageToConsole(const WebKit::WebConsoleMessage&); - virtual void ClosePage(); - virtual WebKit::WebSize ScrollOffset() const; virtual int PrintBegin(const WebKit::WebSize& page_size); diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index dcc3643..1ada9cf 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -82,6 +82,15 @@ class WebView : public WebKit::WebWidget { // onbeforeunload event handlers. virtual bool ShouldClose() = 0; + // Tells the current page to close, running the onunload handler. + // TODO(creis): We'd rather use WebWidget::Close(), but that sets its + // delegate_ to NULL, preventing any JavaScript dialogs in the onunload + // handler from appearing. This lets us shortcut that for now, but we should + // refactor close messages so that this isn't necessary. + // TODO(darin): This comment is out-of-date, and we should be able to use + // WebWidget::Close now. + virtual void ClosePage() = 0; + // // @method mainFrame // @abstract Return the top level frame. diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 0629c31..5a9b607 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1259,6 +1259,11 @@ bool WebViewImpl::ShouldClose() { return frame->shouldClose(); } +void WebViewImpl::ClosePage() { + // Run unload handlers. + page_->mainFrame()->loader()->closeURL(); +} + WebViewDelegate* WebViewImpl::GetDelegate() { return delegate_; } diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 4ab05dd..6dea768 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -70,6 +70,7 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { // WebView methods: virtual bool ShouldClose(); + virtual void ClosePage(); virtual WebViewDelegate* GetDelegate(); virtual void SetDelegate(WebViewDelegate*); virtual void SetUseEditorDelegate(bool value); |