summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 21:25:36 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 21:25:36 +0000
commitf6e5d8c70005185a227f0a2fc4bdb6b6d4a63b81 (patch)
tree1326a32e06113cd4b890459e1030018e8dd1b978 /chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
parent16d90004f2f6c1f3d975cc8a56f9c3270139d01e (diff)
downloadchromium_src-f6e5d8c70005185a227f0a2fc4bdb6b6d4a63b81.zip
chromium_src-f6e5d8c70005185a227f0a2fc4bdb6b6d4a63b81.tar.gz
chromium_src-f6e5d8c70005185a227f0a2fc4bdb6b6d4a63b81.tar.bz2
Reland 116165:
Avoid calling OnCanceled when accepting a Re-POST form warning dialog, and add a browser test. TabModalConfirmDialogHtmlDelegate needs to be visible to test code, so we move it into the header file, and merge it with TabModalConfirmDialogUI, as they have the same lifetime. Original review: http://codereview.chromium.org/9016039/ BUG=92795, 108327 TEST=TabModalConfirmDialogTest.* Review URL: http://codereview.chromium.org/9086004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h')
-rw-r--r--chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h42
1 files changed, 31 insertions, 11 deletions
diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
index edcb7b7..66ae8c9 100644
--- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
+++ b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,13 +6,15 @@
#define CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_
#pragma once
-#if !(defined(USE_AURA) || defined(TOOLKIT_VIEWS))
+#if !(defined(USE_AURA) || defined(OS_CHROMEOS))
#error Tab-modal confirm dialog should be shown with native UI.
#endif
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/webui/html_dialog_ui.h"
+class ConstrainedHtmlUIDelegate;
class TabContentsWrapper;
class TabModalConfirmDialogDelegate;
@@ -21,20 +23,38 @@ class TabModalConfirmDialogDelegate;
// To display the dialog, allocate this object on the heap. It will open the
// dialog from its constructor and then delete itself when the user dismisses
// the dialog.
-class TabModalConfirmDialogUI {
+class TabModalConfirmDialogWebUI : public HtmlDialogUIDelegate {
public:
- TabModalConfirmDialogUI(TabModalConfirmDialogDelegate* delegate,
- TabContentsWrapper* wrapper);
- ~TabModalConfirmDialogUI();
-
- // Invoked when the dialog is closed. Notifies the controller of the user's
- // response.
- void OnDialogClosed(bool accept);
+ TabModalConfirmDialogWebUI(
+ TabModalConfirmDialogDelegate* dialog_delegate,
+ TabContentsWrapper* wrapper);
+
+ // HtmlDialogUIDelegate implementation.
+ virtual bool IsDialogModal() const OVERRIDE;
+ virtual string16 GetDialogTitle() const OVERRIDE;
+ virtual GURL GetDialogContentURL() const OVERRIDE;
+ virtual void GetWebUIMessageHandlers(
+ std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
+ virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
+ virtual std::string GetDialogArgs() const OVERRIDE;
+ virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
+ virtual void OnCloseContents(content::WebContents* source,
+ bool* out_close_dialog) OVERRIDE;
+ virtual bool ShouldShowDialogTitle() const OVERRIDE;
+
+ ConstrainedHtmlUIDelegate* constrained_html_ui_delegate() {
+ return constrained_html_ui_delegate_;
+ }
private:
+ virtual ~TabModalConfirmDialogWebUI();
+
scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogUI);
+ // Deletes itself.
+ ConstrainedHtmlUIDelegate* constrained_html_ui_delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogWebUI);
};
#endif // CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_