summaryrefslogtreecommitdiffstats
path: root/chrome/browser/repost_form_warning_dialog.cc
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 04:12:18 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 04:12:18 +0000
commit0f2f4b60511540e292e085ba5e1985be6bf93908 (patch)
tree6d6bb042fe78bb23c4eca3cf4a4222a3dab38e74 /chrome/browser/repost_form_warning_dialog.cc
parentaaeb9dc745d49afa66c1b613daa5a3123f309955 (diff)
downloadchromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.zip
chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.tar.gz
chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.tar.bz2
Window Delegate Improvements:
- Windows now must have a Delegate. Just construct the default WindowDelegate if you don't want to have to write one in testing. - Windows now obtain their contents view by asking the delegate via WindowDelegate::GetContentsView. - Contents views no longer need to manually store a pointer to the Window that contains them, WindowDelegate does this automatically via its window() accessor. Reviewer notes: - review window_delegate.h first, then - window.h/cc - custom frame window.h/cc - constrained_window_impl.h/cc - then everything else (just updating all call sites) B=1280060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/repost_form_warning_dialog.cc')
-rw-r--r--chrome/browser/repost_form_warning_dialog.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/repost_form_warning_dialog.cc b/chrome/browser/repost_form_warning_dialog.cc
index 4b19d3b..2d45028 100644
--- a/chrome/browser/repost_form_warning_dialog.cc
+++ b/chrome/browser/repost_form_warning_dialog.cc
@@ -75,18 +75,23 @@ void RepostFormWarningDialog::WindowClosing() {
}
bool RepostFormWarningDialog::Cancel() {
- dialog_ = NULL;
return true;
}
bool RepostFormWarningDialog::Accept() {
- dialog_ = NULL;
if (navigation_controller_)
navigation_controller_->ReloadDontCheckForRepost();
return true;
}
///////////////////////////////////////////////////////////////////////////////
+// RepostFormWarningDialog, ChromeViews::WindowDelegate implementation:
+
+ChromeViews::View* RepostFormWarningDialog::GetContentsView() {
+ return message_box_view_;
+}
+
+///////////////////////////////////////////////////////////////////////////////
// RepostFormWarningDialog, private:
RepostFormWarningDialog::RepostFormWarningDialog(
@@ -100,10 +105,7 @@ RepostFormWarningDialog::RepostFormWarningDialog(
HWND root_hwnd = NULL;
if (BrowserList::GetLastActive())
root_hwnd = BrowserList::GetLastActive()->GetTopLevelHWND();
- ChromeViews::Window* dialog_ =
- ChromeViews::Window::CreateChromeWindow(root_hwnd, gfx::Rect(),
- message_box_view_, this);
- dialog_->Show();
+ ChromeViews::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show();
NotificationService::current()->
AddObserver(this, NOTIFY_LOAD_START, NotificationService::AllSources());
NotificationService::current()->
@@ -116,10 +118,10 @@ void RepostFormWarningDialog::Observe(NotificationType type,
// Close the dialog if we load a page (because reloading might not apply to
// the same page anymore) or if the tab is closed, because then we won't have
// a navigation controller anymore.
- if (dialog_ && navigation_controller_ &&
+ if (window() && navigation_controller_ &&
(type == NOTIFY_LOAD_START || type == NOTIFY_TAB_CLOSING) &&
Source<NavigationController>(source).ptr() == navigation_controller_) {
navigation_controller_ = NULL;
- dialog_->Close();
+ window()->Close();
}
}