diff options
author | ojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-12 17:30:55 +0000 |
---|---|---|
committer | ojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-12 17:30:55 +0000 |
commit | 84a6a5b6c8f0379c725493bb695f72367d21887f (patch) | |
tree | 10d0b441ff2520b1c8211500e7e3019564fd9ead /chrome/browser | |
parent | cc09ca130fca5aa724d0f5538f6dd681272e8527 (diff) | |
download | chromium_src-84a6a5b6c8f0379c725493bb695f72367d21887f.zip chromium_src-84a6a5b6c8f0379c725493bb695f72367d21887f.tar.gz chromium_src-84a6a5b6c8f0379c725493bb695f72367d21887f.tar.bz2 |
Add a bit of plumbing just so Browser doesn't need to know about RenderViewHost.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@720 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.cc | 7 | ||||
-rw-r--r-- | chrome/browser/web_contents.cc | 8 | ||||
-rw-r--r-- | chrome/browser/web_contents.h | 11 |
3 files changed, 21 insertions, 5 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index a2b7928..b325d05 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -48,7 +48,6 @@ #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/plugin_service.h" #include "chrome/browser/profile.h" -#include "chrome/browser/render_view_host.h" #include "chrome/browser/save_package.h" #include "chrome/browser/ssl_error_info.h" #include "chrome/browser/site_instance.h" @@ -1080,11 +1079,9 @@ void Browser::ProcessPendingTabs() { // Process beforeunload tabs first. When that queue is empty, process // unload tabs. - // TODO(ojan): Move some of this logic down into TabContents and/or - // WebContents so we don't need to dig into RenderViewHost here. if (!tabs_needing_before_unload_fired_.empty()) { TabContents* tab = tabs_needing_before_unload_fired_.back(); - tab->AsWebContents()->render_view_host()->FirePageBeforeUnload(); + tab->AsWebContents()->FirePageBeforeUnload(); } else if (!tabs_needing_unload_fired_.empty()) { // We've finished firing all beforeunload events and can proceed with unload // events. @@ -1095,7 +1092,7 @@ void Browser::ProcessPendingTabs() { // get a perf benefit from that in the cases where the tab hangs in it's // unload handler or takes a long time to page in. TabContents* tab = tabs_needing_unload_fired_.back(); - tab->AsWebContents()->render_view_host()->FirePageUnload(); + tab->AsWebContents()->FirePageUnload(); } else { NOTREACHED(); } diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index 9108c7d..59ade98 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -314,6 +314,14 @@ void WebContents::SizeContents(const gfx::Size& size) { RepositionSupressedPopupsToFit(size); } +void WebContents::FirePageBeforeUnload() { + render_view_host_->FirePageBeforeUnload(); +} + +void WebContents::FirePageUnload() { + render_view_host_->FirePageUnload(); +} + void WebContents::Destroy() { // Tell the notification service we no longer want notifications. NotificationService::current()-> diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h index 2f3a7bd..25c32a6 100644 --- a/chrome/browser/web_contents.h +++ b/chrome/browser/web_contents.h @@ -84,6 +84,17 @@ class WebContents : public TabContents, virtual void HideContents(); virtual void SizeContents(const gfx::Size& size); + // Causes the renderer to invoke the onbeforeunload event handler. The + // result will be returned via ViewMsg_ShouldClose. + virtual void FirePageBeforeUnload(); + + // Close the page after the page has responded that it can be closed via + // ViewMsg_ShouldClose. This is where the page itself is closed. The + // unload handler is triggered here, which can block with a dialog, but cannot + // cancel the close of the page. + virtual void FirePageUnload(); + + // TabContents virtual WebContents* AsWebContents() { return this; } virtual bool Navigate(const NavigationEntry& entry, bool reload); |