diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 16:19:40 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 16:19:40 +0000 |
commit | b535bf1e563f43dbc5d60307a425a6766b98d00b (patch) | |
tree | 3c47e8a423c687ab598d5569fd993e4527992c44 /chrome/browser/repost_form_warning_controller.h | |
parent | 42ed07c83974dad37006484c4a9fc466572b4a60 (diff) | |
download | chromium_src-b535bf1e563f43dbc5d60307a425a6766b98d00b.zip chromium_src-b535bf1e563f43dbc5d60307a425a6766b98d00b.tar.gz chromium_src-b535bf1e563f43dbc5d60307a425a6766b98d00b.tar.bz2 |
Ensure proper teardown of repost form warning objects.
Make sure a repost form warning is closed properly even when the constrained window is closed from underneath us.
To do this, its controller now calls |Cancel| in its destructor.
We now have a potential cycle of methods calling each other:
* |RepostFormWarningController::CloseDialog| closes the |ConstrainedWindow|.
* This eventually calls |RepostFormWarningWin::DeleteDelegate|, which destroys |RepostFormWarningWin| and |RepostFormWarningController|.
* In its destructor, |RepostFormWarningController| calls |Cancel|, which calls |CloseDialog|.
Therefore, there are some checks in place to make sure we do everything during the teardown exactly once:
* After calling |NavigationController::CancelPendingReload|, we set |tab_contents| to null to make sure we don't call it again.
* During destruction, we set |window_| to null to make sure we don't call |CloseConstrainedWindow| again.
BUG=41367
TEST=RepostFormWarningTest.*
Review URL: http://codereview.chromium.org/1530032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/repost_form_warning_controller.h')
-rw-r--r-- | chrome/browser/repost_form_warning_controller.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/chrome/browser/repost_form_warning_controller.h b/chrome/browser/repost_form_warning_controller.h index 2b2c0a8..ce22d7b 100644 --- a/chrome/browser/repost_form_warning_controller.h +++ b/chrome/browser/repost_form_warning_controller.h @@ -13,11 +13,11 @@ class TabContents; // This class is used to continue or cancel a pending reload when the // repost form warning is shown. It is owned by the platform-dependent -// |RepostFormWarning{Gtk,Mac,View}| classes and deletes itself after closing -// the dialog. +// |RepostFormWarning{Gtk,Mac,View}| classes. class RepostFormWarningController : public NotificationObserver { public: explicit RepostFormWarningController(TabContents* tab_contents); + virtual ~RepostFormWarningController(); // Show the warning dialog. void Show(ConstrainedWindowDelegate* window_delegate); @@ -29,8 +29,6 @@ class RepostFormWarningController : public NotificationObserver { void Continue(); private: - virtual ~RepostFormWarningController(); - // NotificationObserver implementation. // Watch for a new load or a closed tab and dismiss the dialog if they occur. void Observe(NotificationType type, |