summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-17 02:54:43 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-17 02:54:43 +0000
commitcb928b74a8f2a612d746a06321d14c34cffedb50 (patch)
tree65420c15864fc903263eb3084c21038fa6c6d99b /chrome
parent196fd8a8240ffa5750867f4253475a1f440ca2a6 (diff)
downloadchromium_src-cb928b74a8f2a612d746a06321d14c34cffedb50.zip
chromium_src-cb928b74a8f2a612d746a06321d14c34cffedb50.tar.gz
chromium_src-cb928b74a8f2a612d746a06321d14c34cffedb50.tar.bz2
Revert 114898 - Add TabModalConfirmDialogDelegate to show simple tab-modal confirmation dialogs.
This CL carves a TabModalConfirmDialogDelegate class (modeled after ConfirmInfobarDelegate) out of RepostFormWarningController and makes it a subclass thereof. It also removes the ShowRepostFormWarning method from BrowserWindow and its subclasses, in favor of a method in browser_dialogs.h. BUG=92795 TEST=none Review URL: http://codereview.chromium.org/8658005 TBR=bauerb@chromium.org Review URL: http://codereview.chromium.org/8962012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_resources.grd2
-rw-r--r--chrome/browser/external_tab_container_win.cc6
-rw-r--r--chrome/browser/repost_form_warning_controller.cc90
-rw-r--r--chrome/browser/repost_form_warning_controller.h37
-rw-r--r--chrome/browser/resources/repost_form_warning.html (renamed from chrome/browser/resources/tab_modal_confirm_dialog.html)8
-rw-r--r--chrome/browser/ui/browser.cc5
-rw-r--r--chrome/browser/ui/browser_dialogs.h6
-rw-r--r--chrome/browser/ui/browser_window.h3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.h1
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm6
-rw-r--r--chrome/browser/ui/cocoa/repost_form_warning_mac.h43
-rw-r--r--chrome/browser/ui/cocoa/repost_form_warning_mac.mm88
-rw-r--r--chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h40
-rw-r--r--chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm96
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc5
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.h1
-rw-r--r--chrome/browser/ui/gtk/repost_form_warning_gtk.cc85
-rw-r--r--chrome/browser/ui/gtk/repost_form_warning_gtk.h49
-rw-r--r--chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc109
-rw-r--r--chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h51
-rw-r--r--chrome/browser/ui/panels/panel.cc4
-rw-r--r--chrome/browser/ui/panels/panel.h1
-rw-r--r--chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc93
-rw-r--r--chrome/browser/ui/tab_modal_confirm_dialog_delegate.h79
-rw-r--r--chrome/browser/ui/views/browser_dialogs.h5
-rw-r--r--chrome/browser/ui/views/dialog_stubs_gtk.cc6
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc4
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h1
-rw-r--r--chrome/browser/ui/views/repost_form_warning_view.cc (renamed from chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc)70
-rw-r--r--chrome/browser/ui/views/repost_form_warning_view.h (renamed from chrome/browser/ui/views/tab_modal_confirm_dialog_views.h)28
-rw-r--r--chrome/browser/ui/webui/chrome_url_data_manager_backend.cc2
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_factory.cc2
-rw-r--r--chrome/browser/ui/webui/repost_form_warning_ui.cc166
-rw-r--r--chrome/browser/ui/webui/repost_form_warning_ui.h47
-rw-r--r--chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc143
-rw-r--r--chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h40
-rw-r--r--chrome/chrome_browser.gypi38
-rw-r--r--chrome/common/url_constants.cc5
-rw-r--r--chrome/common/url_constants.h4
-rw-r--r--chrome/test/base/test_browser_window.h2
40 files changed, 661 insertions, 810 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 4ade6d7..575ff3c 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -168,7 +168,7 @@
<if expr="(is_linux and pp_ifdef('toolkit_views')) or pp_ifdef('use_aura')">
<include name="IDR_COLLECTED_COOKIES_HTML" file="resources\collected_cookies.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_HTTP_AUTH_HTML" file="resources\http_auth.html" flattenhtml="true" type="BINDATA" />
- <include name="IDR_TAB_MODAL_CONFIRM_DIALOG_HTML" file="resources\tab_modal_confirm_dialog.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_REPOST_FORM_WARNING_HTML" file="resources\repost_form_warning.html" flattenhtml="true" type="BINDATA" />
</if>
<if expr="pp_ifdef('use_aura')">
<include name="IDR_APP_LIST_HTML" file="resources\aura\app_list\app_list.html" flattenhtml="true" type="BINDATA" />
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 056076d..459936d 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -23,11 +23,9 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/repost_form_warning_controller.h"
#include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
@@ -698,9 +696,7 @@ void ExternalTabContainer::BeforeUnloadFired(TabContents* tab,
void ExternalTabContainer::ShowRepostFormWarningDialog(
TabContents* tab_contents) {
- browser::ShowTabModalConfirmDialog(
- new RepostFormWarningController(tab_contents),
- GetNativeView(), tab_contents);
+ browser::ShowRepostFormWarningDialog(GetNativeView(), tab_contents);
}
void ExternalTabContainer::RunFileChooser(
diff --git a/chrome/browser/repost_form_warning_controller.cc b/chrome/browser/repost_form_warning_controller.cc
index a53e95e..987b7d6 100644
--- a/chrome/browser/repost_form_warning_controller.cc
+++ b/chrome/browser/repost_form_warning_controller.cc
@@ -4,68 +4,66 @@
#include "chrome/browser/repost_form_warning_controller.h"
-#if defined(TOOLKIT_USES_GTK)
-#include <gtk/gtk.h>
-#endif
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "content/browser/tab_contents/navigation_controller.h"
+#include "chrome/browser/ui/constrained_window.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
RepostFormWarningController::RepostFormWarningController(
TabContents* tab_contents)
- : TabModalConfirmDialogDelegate(tab_contents),
- navigation_controller_(&tab_contents->controller()) {
+ : tab_contents_(tab_contents),
+ window_(NULL) {
+ NavigationController* controller = &tab_contents->controller();
+ registrar_.Add(this, content::NOTIFICATION_LOAD_START,
+ content::Source<NavigationController>(controller));
+ registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING,
+ content::Source<NavigationController>(controller));
registrar_.Add(this, content::NOTIFICATION_REPOST_WARNING_SHOWN,
- content::Source<NavigationController>(navigation_controller_));
+ content::Source<NavigationController>(controller));
}
RepostFormWarningController::~RepostFormWarningController() {
+ // If we end up here, the constrained window has been closed, so make sure we
+ // don't close it again.
+ window_ = NULL;
+ // Make sure everything is cleaned up.
+ Cancel();
}
-string16 RepostFormWarningController::GetTitle() {
- return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE);
-}
-
-string16 RepostFormWarningController::GetMessage() {
- return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING);
+void RepostFormWarningController::Cancel() {
+ if (tab_contents_) {
+ tab_contents_->controller().CancelPendingReload();
+ CloseDialog();
+ }
}
-string16 RepostFormWarningController::GetAcceptButtonTitle() {
- return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND);
+void RepostFormWarningController::Continue() {
+ if (tab_contents_) {
+ tab_contents_->controller().ContinuePendingReload();
+ // If we reload the page, the dialog will be closed anyway.
+ }
}
-#if defined(TOOLKIT_USES_GTK)
-const char* RepostFormWarningController::GetAcceptButtonIcon() {
- return GTK_STOCK_REFRESH;
-}
-
-const char* RepostFormWarningController::GetCancelButtonIcon() {
- return GTK_STOCK_CANCEL;
-}
-#endif // defined(TOOLKIT_USES_GTK)
-
-void RepostFormWarningController::OnAccepted() {
- navigation_controller_->ContinuePendingReload();
-}
-
-void RepostFormWarningController::OnCanceled() {
- navigation_controller_->CancelPendingReload();
+void RepostFormWarningController::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ // 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 (tab_contents_ &&
+ (type == content::NOTIFICATION_LOAD_START ||
+ type == content::NOTIFICATION_TAB_CLOSING ||
+ type == content::NOTIFICATION_REPOST_WARNING_SHOWN)) {
+ DCHECK_EQ(content::Source<NavigationController>(source).ptr(),
+ &tab_contents_->controller());
+ Cancel();
+ }
}
-void RepostFormWarningController::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- // Close the dialog if we show an additional dialog, to avoid them
- // stacking up.
- if (type == content::NOTIFICATION_REPOST_WARNING_SHOWN)
- Cancel();
- else
- TabModalConfirmDialogDelegate::Observe(type, source, details);
+void RepostFormWarningController::CloseDialog() {
+ // Make sure we won't do anything when |Cancel()| is called again.
+ tab_contents_ = NULL;
+ if (window_) {
+ window_->CloseConstrainedWindow();
+ }
}
diff --git a/chrome/browser/repost_form_warning_controller.h b/chrome/browser/repost_form_warning_controller.h
index 808c9d3..7b8114a 100644
--- a/chrome/browser/repost_form_warning_controller.h
+++ b/chrome/browser/repost_form_warning_controller.h
@@ -7,37 +7,44 @@
#pragma once
#include "base/compiler_specific.h"
-#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
-class NavigationController;
+class ConstrainedWindow;
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.
-class RepostFormWarningController : public TabModalConfirmDialogDelegate {
+class RepostFormWarningController : public content::NotificationObserver {
public:
explicit RepostFormWarningController(TabContents* tab_contents);
virtual ~RepostFormWarningController();
- // TabModalConfirmDialogDelegate methods:
- virtual string16 GetTitle() OVERRIDE;
- virtual string16 GetMessage() OVERRIDE;
- virtual string16 GetAcceptButtonTitle() OVERRIDE;
-#if defined(TOOLKIT_USES_GTK)
- virtual const char* GetAcceptButtonIcon() OVERRIDE;
- virtual const char* GetCancelButtonIcon() OVERRIDE;
-#endif // defined(TOOLKIT_USES_GTK)
- virtual void OnAccepted() OVERRIDE;
- virtual void OnCanceled() OVERRIDE;
+ // Cancel the reload.
+ void Cancel();
+
+ // Continue the reload.
+ void Continue();
+
+ void set_window(ConstrainedWindow* window) { window_ = window; }
private:
+ // content::NotificationObserver implementation.
+ // Watch for a new load or a closed tab and dismiss the dialog if they occur.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // Weak pointer; this dialog is cancelled when the TabContents is closed.
- NavigationController* navigation_controller_;
+ // Close the warning dialog.
+ void CloseDialog();
+
+ content::NotificationRegistrar registrar_;
+
+ // Tab contents, used to continue the reload.
+ TabContents* tab_contents_;
+
+ ConstrainedWindow* window_;
DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController);
};
diff --git a/chrome/browser/resources/tab_modal_confirm_dialog.html b/chrome/browser/resources/repost_form_warning.html
index 8637543..a2d8834 100644
--- a/chrome/browser/resources/tab_modal_confirm_dialog.html
+++ b/chrome/browser/resources/repost_form_warning.html
@@ -22,7 +22,6 @@
}
</style>
- <script src="chrome://resources/js/i18n_template.js"></script>
<script>
function $(o) {
return document.getElementById(o);
@@ -30,7 +29,7 @@
function disableControls() {
$('cancel').disabled = true;
- $('accept').disabled = true;
+ $('resend').disabled = true;
}
function cancel() {
@@ -52,7 +51,6 @@
}
function load() {
- i18nTemplate.process(document, JSON.parse(chrome.dialogArguments));
document.addEventListener('keydown', handleKeyDown);
$('form').onsubmit = handleSubmit;
$('cancel').onclick = cancel;
@@ -63,11 +61,11 @@
</script>
</head>
<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
- <div id="explanation" i18n-content="message"></div>
+ <div id="explanation" i18n-content="explanation"></div>
<form id="form">
<div id="buttons">
<input id="cancel" type="reset" i18n-values="value:cancel" autofocus>
- <input id="accept" type="submit" i18n-values="value:accept">
+ <input id="resend" type="submit" i18n-values="value:resend">
</div>
</form>
</body>
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index ab62271..d862822 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -77,7 +77,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
-#include "chrome/browser/repost_form_warning_controller.h"
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
@@ -3796,9 +3795,7 @@ void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
}
void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) {
- browser::ShowTabModalConfirmDialog(
- new RepostFormWarningController(tab_contents),
- window()->GetNativeHandle(), tab_contents);
+ window()->ShowRepostFormWarningDialog(tab_contents);
}
void Browser::ShowContentSettingsPage(ContentSettingsType content_type) {
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h
index 3a715be..ca42868 100644
--- a/chrome/browser/ui/browser_dialogs.h
+++ b/chrome/browser/ui/browser_dialogs.h
@@ -16,7 +16,6 @@ class HtmlDialogUIDelegate;
class Profile;
class SkBitmap;
class TabContents;
-class TabModalConfirmDialogDelegate;
class TemplateURL;
namespace browser {
@@ -63,11 +62,6 @@ void HideNativeHungRendererDialog(TabContents* contents);
void ConfirmAddSearchProvider(const TemplateURL* template_url,
Profile* profile);
-// Shows a tab-modal dialog box.
-void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate,
- gfx::NativeWindow parent_window,
- TabContents* tab_contents);
-
} // namespace browser
#endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index 598b9ff..41b321d 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -239,6 +239,9 @@ class BrowserWindow {
// Returns the DownloadShelf.
virtual DownloadShelf* GetDownloadShelf() = 0;
+ // Shows the repost form confirmation dialog box.
+ virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) = 0;
+
// Shows the collected cookies dialog box.
virtual void ShowCollectedCookiesDialog(TabContentsWrapper* tab_contents) = 0;
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h
index fdf714f..425e55e 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h
@@ -91,6 +91,7 @@ class BrowserWindowCocoa : public BrowserWindow,
bool already_bookmarked) OVERRIDE;
virtual bool IsDownloadShelfVisible() const OVERRIDE;
virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
+ virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE;
virtual void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) OVERRIDE;
virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE;
virtual void UserChangedTheme() OVERRIDE;
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 9db4de1..46b289d 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -31,6 +31,7 @@
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#import "chrome/browser/ui/cocoa/nsmenuitem_additions.h"
+#include "chrome/browser/ui/cocoa/repost_form_warning_mac.h"
#include "chrome/browser/ui/cocoa/restart_browser.h"
#include "chrome/browser/ui/cocoa/status_bubble_mac.h"
#include "chrome/browser/ui/cocoa/task_manager_mac.h"
@@ -432,6 +433,11 @@ DownloadShelf* BrowserWindowCocoa::GetDownloadShelf() {
return [shelfController bridge];
}
+void BrowserWindowCocoa::ShowRepostFormWarningDialog(
+ TabContents* tab_contents) {
+ RepostFormWarningMac::Create(GetNativeHandle(), tab_contents);
+}
+
void BrowserWindowCocoa::ShowCollectedCookiesDialog(
TabContentsWrapper* wrapper) {
// Deletes itself on close.
diff --git a/chrome/browser/ui/cocoa/repost_form_warning_mac.h b/chrome/browser/ui/cocoa/repost_form_warning_mac.h
new file mode 100644
index 0000000..700cfd9
--- /dev/null
+++ b/chrome/browser/ui/cocoa/repost_form_warning_mac.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_UI_COCOA_REPOST_FORM_WARNING_MAC_H_
+#define CHROME_BROWSER_UI_COCOA_REPOST_FORM_WARNING_MAC_H_
+#pragma once
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
+
+class RepostFormWarningController;
+class TabContents;
+
+// Displays a dialog that warns the user that they are about to resubmit
+// a form. To show the dialog, call the |Create| method. It will open the
+// dialog and then delete itself when the user dismisses the dialog.
+class RepostFormWarningMac : public ConstrainedWindowMacDelegateSystemSheet {
+ public:
+ // Convenience method that creates a new |RepostFormWarningController| and
+ // then a new |RepostFormWarningMac| from that.
+ static RepostFormWarningMac* Create(NSWindow* parent,
+ TabContents* tab_contents);
+
+ RepostFormWarningMac(NSWindow* parent,
+ RepostFormWarningController* controller,
+ TabContents* tab_contents);
+
+ // ConstrainedWindowDelegateMacSystemSheet methods:
+ virtual void DeleteDelegate() OVERRIDE;
+
+ private:
+ virtual ~RepostFormWarningMac();
+
+ scoped_ptr<RepostFormWarningController> controller_;
+ TabContents* tab_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningMac);
+};
+
+#endif // CHROME_BROWSER_UI_COCOA_REPOST_FORM_WARNING_MAC_H_
diff --git a/chrome/browser/ui/cocoa/repost_form_warning_mac.mm b/chrome/browser/ui/cocoa/repost_form_warning_mac.mm
new file mode 100644
index 0000000..4300ac1
--- /dev/null
+++ b/chrome/browser/ui/cocoa/repost_form_warning_mac.mm
@@ -0,0 +1,88 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/ui/cocoa/repost_form_warning_mac.h"
+
+#include "base/memory/scoped_nsobject.h"
+#include "chrome/browser/repost_form_warning_controller.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util_mac.h"
+
+// The delegate of the NSAlert used to display the dialog. Forwards the alert's
+// completion event to the C++ class |RepostFormWarningController|.
+@interface RepostDelegate : NSObject {
+ RepostFormWarningController* warning_; // weak
+}
+- (id)initWithWarning:(RepostFormWarningController*)warning;
+- (void)alertDidEnd:(NSAlert*)alert
+ returnCode:(int)returnCode
+ contextInfo:(void*)contextInfo;
+@end
+
+@implementation RepostDelegate
+- (id)initWithWarning:(RepostFormWarningController*)warning {
+ if ((self = [super init])) {
+ warning_ = warning;
+ }
+ return self;
+}
+
+- (void)alertDidEnd:(NSAlert*)alert
+ returnCode:(int)returnCode
+ contextInfo:(void*)contextInfo {
+ if (returnCode == NSAlertFirstButtonReturn) {
+ warning_->Continue();
+ } else {
+ warning_->Cancel();
+ }
+}
+@end
+
+RepostFormWarningMac* RepostFormWarningMac::Create(NSWindow* parent,
+ TabContents* tab_contents) {
+ return new RepostFormWarningMac(
+ parent,
+ new RepostFormWarningController(tab_contents),
+ tab_contents);
+}
+
+RepostFormWarningMac::RepostFormWarningMac(
+ NSWindow* parent,
+ RepostFormWarningController* controller,
+ TabContents* tab_contents)
+ : ConstrainedWindowMacDelegateSystemSheet(
+ [[[RepostDelegate alloc] initWithWarning:controller]
+ autorelease],
+ @selector(alertDidEnd:returnCode:contextInfo:)),
+ controller_(controller),
+ tab_contents_(tab_contents) {
+ scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]);
+ [alert setMessageText:
+ l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING_TITLE)];
+ [alert setInformativeText:
+ l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING)];
+ [alert addButtonWithTitle:
+ l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING_RESEND)];
+ [alert addButtonWithTitle:
+ l10n_util::GetNSStringWithFixup(IDS_CANCEL)];
+
+ set_sheet(alert);
+
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
+ controller->set_window(new ConstrainedWindowMac(wrapper, this));
+}
+
+RepostFormWarningMac::~RepostFormWarningMac() {
+ NSWindow* window = [(NSAlert*)sheet() window];
+ if (window && is_sheet_open()) {
+ [NSApp endSheet:window
+ returnCode:NSAlertSecondButtonReturn];
+ }
+}
+
+void RepostFormWarningMac::DeleteDelegate() {
+ delete this;
+}
diff --git a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h
deleted file mode 100644
index 26398e4..0000000
--- a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_
-#define CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_
-#pragma once
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
-
-class TabModalConfirmDialogDelegate;
-class TabContents;
-
-// Displays a tab-modal dialog, i.e. a dialog that will block the current page
-// but still allow the user to switch to a different page.
-// 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 TabModalConfirmDialogMac
- : public ConstrainedWindowMacDelegateSystemSheet {
- public:
- TabModalConfirmDialogMac(NSWindow* parent,
- TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents);
-
- // ConstrainedWindowDelegateMacSystemSheet methods:
- virtual void DeleteDelegate() OVERRIDE;
-
- private:
- virtual ~TabModalConfirmDialogMac();
-
- scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogMac);
-};
-
-#endif // CHROME_BROWSER_UI_COCOA_TAB_MODAL_CONFIRM_DIALOG_MAC_H_
diff --git a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm
deleted file mode 100644
index 564b5dc..0000000
--- a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h"
-
-#include "base/memory/scoped_nsobject.h"
-#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "ui/base/l10n/l10n_util_mac.h"
-#include "ui/gfx/image/image.h"
-
-// The delegate of the NSAlert used to display the dialog. Forwards the alert's
-// completion event to the C++ class |TabModalConfirmDialogDelegate|.
-@interface TabModalConfirmDialogMacBridge : NSObject {
- TabModalConfirmDialogDelegate* delegate_; // weak
-}
-- (id)initWithDelegate:(TabModalConfirmDialogDelegate*)delegate;
-- (void)alertDidEnd:(NSAlert*)alert
- returnCode:(int)returnCode
- contextInfo:(void*)contextInfo;
-@end
-
-@implementation TabModalConfirmDialogMacBridge
-- (id)initWithDelegate:(TabModalConfirmDialogDelegate*)delegate {
- if ((self = [super init])) {
- delegate_ = delegate;
- }
- return self;
-}
-
-- (void)alertDidEnd:(NSAlert*)alert
- returnCode:(int)returnCode
- contextInfo:(void*)contextInfo {
- if (returnCode == NSAlertFirstButtonReturn) {
- delegate_->Accept();
- } else {
- delegate_->Cancel();
- }
-}
-@end
-
-namespace browser {
-
-// Declared in browser_dialogs.h so others don't have to depend on our header.
-void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate,
- gfx::NativeWindow parent_window,
- TabContents* tab_contents) {
- // Deletes itself when closed.
- new TabModalConfirmDialogMac(parent_window, delegate, tab_contents);
-}
-
-}
-
-TabModalConfirmDialogMac::TabModalConfirmDialogMac(
- NSWindow* parent,
- TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents)
- : ConstrainedWindowMacDelegateSystemSheet(
- [[[TabModalConfirmDialogMacBridge alloc] initWithDelegate:delegate]
- autorelease],
- @selector(alertDidEnd:returnCode:contextInfo:)),
- delegate_(delegate) {
- scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]);
- [alert setMessageText:
- l10n_util::FixUpWindowsStyleLabel(delegate->GetTitle())];
- [alert setInformativeText:
- l10n_util::FixUpWindowsStyleLabel(delegate->GetMessage())];
- [alert addButtonWithTitle:
- l10n_util::FixUpWindowsStyleLabel(delegate->GetAcceptButtonTitle())];
- [alert addButtonWithTitle:
- l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle())];
- gfx::Image* icon = delegate->GetIcon();
- if (icon)
- [alert setIcon:icon->ToNSImage()];
-
- set_sheet(alert);
-
- TabContentsWrapper* wrapper =
- TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
- delegate->set_window(new ConstrainedWindowMac(wrapper, this));
-}
-
-TabModalConfirmDialogMac::~TabModalConfirmDialogMac() {
- NSWindow* window = [(NSAlert*)sheet() window];
- if (window && is_sheet_open()) {
- [NSApp endSheet:window
- returnCode:NSAlertSecondButtonReturn];
- }
-}
-
-// "DeleteDelegate" refers to this class being a ConstrainedWindow delegate
-// and deleting itself, not to deleting the member variable |delegate_|.
-void TabModalConfirmDialogMac::DeleteDelegate() {
- delete this;
-}
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 879b2f0..9e37e02 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -62,6 +62,7 @@
#include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
#include "chrome/browser/ui/gtk/nine_box.h"
#include "chrome/browser/ui/gtk/reload_button_gtk.h"
+#include "chrome/browser/ui/gtk/repost_form_warning_gtk.h"
#include "chrome/browser/ui/gtk/status_bubble_gtk.h"
#include "chrome/browser/ui/gtk/tab_contents_container_gtk.h"
#include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h"
@@ -1045,6 +1046,10 @@ DownloadShelf* BrowserWindowGtk::GetDownloadShelf() {
return download_shelf_.get();
}
+void BrowserWindowGtk::ShowRepostFormWarningDialog(TabContents* tab_contents) {
+ new RepostFormWarningGtk(GetNativeHandle(), tab_contents);
+}
+
void BrowserWindowGtk::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) {
// Deletes itself on close.
new CollectedCookiesGtk(GetNativeHandle(), wrapper);
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h
index 4e95d87..201aba2 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.h
+++ b/chrome/browser/ui/gtk/browser_window_gtk.h
@@ -128,6 +128,7 @@ class BrowserWindowGtk : public BrowserWindow,
bool already_bookmarked) OVERRIDE;
virtual bool IsDownloadShelfVisible() const OVERRIDE;
virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
+ virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE;
virtual void ShowCollectedCookiesDialog(
TabContentsWrapper* tab_contents) OVERRIDE;
virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE;
diff --git a/chrome/browser/ui/gtk/repost_form_warning_gtk.cc b/chrome/browser/ui/gtk/repost_form_warning_gtk.cc
new file mode 100644
index 0000000..db4e838
--- /dev/null
+++ b/chrome/browser/ui/gtk/repost_form_warning_gtk.cc
@@ -0,0 +1,85 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/ui/gtk/repost_form_warning_gtk.h"
+
+#include "base/message_loop.h"
+#include "chrome/browser/repost_form_warning_controller.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "content/browser/tab_contents/navigation_controller.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_types.h"
+#include "grit/generated_resources.h"
+#include "ui/base/gtk/gtk_hig_constants.h"
+#include "ui/base/l10n/l10n_util.h"
+
+RepostFormWarningGtk::RepostFormWarningGtk(GtkWindow* parent,
+ TabContents* tab_contents)
+ : controller_(new RepostFormWarningController(tab_contents)) {
+ dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaBorder);
+ gtk_box_set_spacing(GTK_BOX(dialog_), ui::kContentAreaSpacing);
+ GtkWidget* label = gtk_label_new(
+ l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING).c_str());
+ GtkWidget* image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION,
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0);
+
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+
+ GtkWidget *hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
+
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+
+ gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0);
+
+ GtkWidget* buttonBox = gtk_hbutton_box_new();
+ gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
+ gtk_box_set_spacing(GTK_BOX(buttonBox), ui::kControlSpacing);
+ gtk_box_pack_end(GTK_BOX(dialog_), buttonBox, FALSE, TRUE, 0);
+
+ cancel_ = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+ gtk_button_set_label(GTK_BUTTON(cancel_),
+ l10n_util::GetStringUTF8(IDS_CANCEL).c_str());
+ g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this);
+ gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0);
+
+ ok_ = gtk_button_new_from_stock(GTK_STOCK_REFRESH);
+ gtk_button_set_label(
+ GTK_BUTTON(ok_),
+ l10n_util::GetStringUTF8(IDS_HTTP_POST_WARNING_RESEND).c_str());
+ g_signal_connect(ok_, "clicked", G_CALLBACK(OnRefreshThunk), this);
+ gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0);
+
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
+ controller_->set_window(new ConstrainedWindowGtk(wrapper, this));
+}
+
+GtkWidget* RepostFormWarningGtk::GetWidgetRoot() {
+ return dialog_;
+}
+
+GtkWidget* RepostFormWarningGtk::GetFocusWidget() {
+ return cancel_;
+}
+
+void RepostFormWarningGtk::DeleteDelegate() {
+ delete this;
+}
+
+RepostFormWarningGtk::~RepostFormWarningGtk() {
+ gtk_widget_destroy(dialog_);
+}
+
+void RepostFormWarningGtk::OnRefresh(GtkWidget* widget) {
+ controller_->Continue();
+}
+
+void RepostFormWarningGtk::OnCancel(GtkWidget* widget) {
+ controller_->Cancel();
+}
diff --git a/chrome/browser/ui/gtk/repost_form_warning_gtk.h b/chrome/browser/ui/gtk/repost_form_warning_gtk.h
new file mode 100644
index 0000000..f14d335
--- /dev/null
+++ b/chrome/browser/ui/gtk/repost_form_warning_gtk.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_UI_GTK_REPOST_FORM_WARNING_GTK_H_
+#define CHROME_BROWSER_UI_GTK_REPOST_FORM_WARNING_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/gtk/constrained_window_gtk.h"
+#include "ui/base/gtk/gtk_signal.h"
+
+class RepostFormWarningController;
+class TabContents;
+
+// Displays a dialog that warns the user that they are about to resubmit
+// a form.
+// 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 RepostFormWarningGtk : public ConstrainedWindowGtkDelegate {
+ public:
+ RepostFormWarningGtk(GtkWindow* parent, TabContents* tab_contents);
+
+ // ConstrainedWindowGtkDelegate methods
+ virtual GtkWidget* GetWidgetRoot() OVERRIDE;
+ virtual GtkWidget* GetFocusWidget() OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+
+ private:
+ virtual ~RepostFormWarningGtk();
+
+ // Callbacks
+ CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnRefresh);
+ CHROMEGTK_CALLBACK_0(RepostFormWarningGtk, void, OnCancel);
+
+ scoped_ptr<RepostFormWarningController> controller_;
+
+ GtkWidget* dialog_;
+ GtkWidget* ok_;
+ GtkWidget* cancel_;
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_REPOST_FORM_WARNING_GTK_H_
diff --git a/chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc b/chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc
deleted file mode 100644
index 8cdafdb..0000000
--- a/chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h"
-
-#include "base/message_loop.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
-#include "content/browser/tab_contents/navigation_controller.h"
-#include "content/browser/tab_contents/tab_contents.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_types.h"
-#include "grit/generated_resources.h"
-#include "ui/base/gtk/gtk_hig_constants.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/image/image.h"
-
-namespace browser {
-
-// Declared in browser_dialogs.h so others don't have to depend on our header.
-void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate,
- gfx::NativeWindow parent_window,
- TabContents* tab_contents) {
- new TabModalConfirmDialogGtk(parent_window, delegate, tab_contents);
-}
-
-}
-
-TabModalConfirmDialogGtk::TabModalConfirmDialogGtk(
- GtkWindow* parent,
- TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents)
- : delegate_(delegate) {
- dialog_ = gtk_vbox_new(FALSE, ui::kContentAreaBorder);
- gtk_box_set_spacing(GTK_BOX(dialog_), ui::kContentAreaSpacing);
- GtkWidget* label = gtk_label_new(
- UTF16ToUTF8(delegate->GetMessage()).c_str());
- gfx::Image* icon = delegate->GetIcon();
- GtkWidget* image = icon ? gtk_image_new_from_pixbuf(icon->ToGdkPixbuf())
- : gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION,
- GTK_ICON_SIZE_DIALOG);
- gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.0);
-
- gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
- gtk_label_set_selectable(GTK_LABEL(label), TRUE);
-
- GtkWidget *hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
-
- gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
-
- gtk_box_pack_start(GTK_BOX(dialog_), hbox, FALSE, FALSE, 0);
-
- GtkWidget* buttonBox = gtk_hbutton_box_new();
- gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
- gtk_box_set_spacing(GTK_BOX(buttonBox), ui::kControlSpacing);
- gtk_box_pack_end(GTK_BOX(dialog_), buttonBox, FALSE, TRUE, 0);
-
- cancel_ = gtk_button_new_with_label(
- UTF16ToUTF8(delegate->GetCancelButtonTitle()).c_str());
- const char* cancel_button_icon_id = delegate->GetCancelButtonIcon();
- if (cancel_button_icon_id) {
- gtk_button_set_image(GTK_BUTTON(cancel_), gtk_image_new_from_stock(
- cancel_button_icon_id, GTK_ICON_SIZE_BUTTON));
- }
- g_signal_connect(cancel_, "clicked", G_CALLBACK(OnCancelThunk), this);
- gtk_box_pack_end(GTK_BOX(buttonBox), cancel_, FALSE, TRUE, 0);
-
- ok_ = gtk_button_new_with_label(
- UTF16ToUTF8(delegate->GetAcceptButtonTitle()).c_str());
- const char* accept_button_icon_id = delegate->GetAcceptButtonIcon();
- if (accept_button_icon_id) {
- gtk_button_set_image(GTK_BUTTON(ok_), gtk_image_new_from_stock(
- accept_button_icon_id, GTK_ICON_SIZE_BUTTON));
- }
- g_signal_connect(ok_, "clicked", G_CALLBACK(OnRefreshThunk), this);
- gtk_box_pack_end(GTK_BOX(buttonBox), ok_, FALSE, TRUE, 0);
-
- TabContentsWrapper* wrapper =
- TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
- delegate->set_window(new ConstrainedWindowGtk(wrapper, this));
-}
-
-GtkWidget* TabModalConfirmDialogGtk::GetWidgetRoot() {
- return dialog_;
-}
-
-GtkWidget* TabModalConfirmDialogGtk::GetFocusWidget() {
- return cancel_;
-}
-
-void TabModalConfirmDialogGtk::DeleteDelegate() {
- delete this;
-}
-
-TabModalConfirmDialogGtk::~TabModalConfirmDialogGtk() {
- gtk_widget_destroy(dialog_);
-}
-
-void TabModalConfirmDialogGtk::OnRefresh(GtkWidget* widget) {
- delegate_->Accept();
-}
-
-void TabModalConfirmDialogGtk::OnCancel(GtkWidget* widget) {
- delegate_->Cancel();
-}
diff --git a/chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h b/chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h
deleted file mode 100644
index 3cfbfed..0000000
--- a/chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_
-#define CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_
-#pragma once
-
-#include <gtk/gtk.h>
-
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/gtk/constrained_window_gtk.h"
-#include "ui/base/gtk/gtk_signal.h"
-
-class TabContents;
-class TabModalConfirmDialogDelegate;
-
-// Displays a tab-modal dialog, i.e. a dialog that will block the current page
-// but still allow the user to switch to a different page.
-// 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 TabModalConfirmDialogGtk : public ConstrainedWindowGtkDelegate {
- public:
- TabModalConfirmDialogGtk(GtkWindow* parent,
- TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents);
-
- // ConstrainedWindowGtkDelegate methods
- virtual GtkWidget* GetWidgetRoot() OVERRIDE;
- virtual GtkWidget* GetFocusWidget() OVERRIDE;
- virtual void DeleteDelegate() OVERRIDE;
-
- private:
- virtual ~TabModalConfirmDialogGtk();
-
- // Callbacks
- CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnRefresh);
- CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnCancel);
-
- scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
-
- GtkWidget* dialog_;
- GtkWidget* ok_;
- GtkWidget* cancel_;
-
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogGtk);
-};
-
-#endif // CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_
diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc
index 1e4d991..d09e373 100644
--- a/chrome/browser/ui/panels/panel.cc
+++ b/chrome/browser/ui/panels/panel.cc
@@ -427,6 +427,10 @@ DownloadShelf* Panel::GetDownloadShelf() {
return tabbed_browser->window()->GetDownloadShelf();
}
+void Panel::ShowRepostFormWarningDialog(TabContents* tab_contents) {
+ NOTIMPLEMENTED();
+}
+
void Panel::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) {
NOTIMPLEMENTED();
}
diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h
index 547ccff..d3e6b49 100644
--- a/chrome/browser/ui/panels/panel.h
+++ b/chrome/browser/ui/panels/panel.h
@@ -140,6 +140,7 @@ class Panel : public BrowserWindow,
const GURL& url, bool already_bookmarked) OVERRIDE;
virtual bool IsDownloadShelfVisible() const OVERRIDE;
virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
+ virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE;
virtual void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) OVERRIDE;
virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE;
virtual void UserChangedTheme() OVERRIDE;
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
deleted file mode 100644
index f2b3590..0000000
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
-
-#include "chrome/browser/ui/constrained_window.h"
-#include "content/browser/tab_contents/tab_contents.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate(
- TabContents* tab_contents)
- : window_(NULL),
- closing_(false) {
- NavigationController* controller = &tab_contents->controller();
- registrar_.Add(this, content::NOTIFICATION_LOAD_START,
- content::Source<NavigationController>(controller));
- registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING,
- content::Source<NavigationController>(controller));
-}
-
-TabModalConfirmDialogDelegate::~TabModalConfirmDialogDelegate() {
- // If we end up here, the constrained window has been closed, so make sure we
- // don't close it again.
- window_ = NULL;
- // Make sure everything is cleaned up.
- Cancel();
-}
-
-void TabModalConfirmDialogDelegate::Cancel() {
- if (closing_)
- return;
- OnCanceled();
- CloseDialog();
-}
-
-void TabModalConfirmDialogDelegate::Accept() {
- if (closing_)
- return;
- OnAccepted();
- CloseDialog();
-}
-
-
-void TabModalConfirmDialogDelegate::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- // Close the dialog if we load a page (because the action might not apply to
- // the same page anymore) or if the tab is closed.
- if (type == content::NOTIFICATION_LOAD_START ||
- type == content::NOTIFICATION_TAB_CLOSING) {
- Cancel();
- } else {
- NOTREACHED();
- }
-}
-
-gfx::Image* TabModalConfirmDialogDelegate::GetIcon() {
- return NULL;
-}
-
-string16 TabModalConfirmDialogDelegate::GetAcceptButtonTitle() {
- return l10n_util::GetStringUTF16(IDS_OK);
-}
-
-string16 TabModalConfirmDialogDelegate::GetCancelButtonTitle() {
- return l10n_util::GetStringUTF16(IDS_CANCEL);
-}
-
-const char* TabModalConfirmDialogDelegate::GetAcceptButtonIcon() {
- return NULL;
-}
-
-const char* TabModalConfirmDialogDelegate::GetCancelButtonIcon() {
- return NULL;
-}
-
-void TabModalConfirmDialogDelegate::OnAccepted() {
-}
-
-void TabModalConfirmDialogDelegate::OnCanceled() {
-}
-
-void TabModalConfirmDialogDelegate::CloseDialog() {
- // Make sure we won't do anything when |Cancel()| is called again.
- closing_ = true;
- if (window_)
- window_->CloseConstrainedWindow();
-}
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
deleted file mode 100644
index 7055a6f..0000000
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_
-#define CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_
-#pragma once
-
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "base/string16.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-
-namespace gfx {
-class Image;
-}
-class ConstrainedWindow;
-class TabContents;
-
-// This class acts as the delegate for a simple tab-modal dialog confirming
-// whether the user wants to execute a certain action.
-class TabModalConfirmDialogDelegate : public content::NotificationObserver {
- public:
- explicit TabModalConfirmDialogDelegate(TabContents* tab_contents);
- virtual ~TabModalConfirmDialogDelegate();
-
- void set_window(ConstrainedWindow* window) { window_ = window; }
-
- void Accept();
- void Cancel();
-
- // The title of the dialog. Note that the title is not shown on all platforms.
- virtual string16 GetTitle() = 0;
- virtual string16 GetMessage() = 0;
-
- // Icon to show for the dialog. If this method is not overridden, a default
- // icon (like the application icon) is shown.
- virtual gfx::Image* GetIcon();
-
- // Title for the accept and the cancel buttons.
- // The default implementation uses IDS_OK and IDS_CANCEL.
- virtual string16 GetAcceptButtonTitle();
- virtual string16 GetCancelButtonTitle();
-
- // GTK stock icon names for the accept and cancel buttons, respectively.
- // The icons are only used on GTK. If these methods are not overriden,
- // the buttons have no stock icons.
- virtual const char* GetAcceptButtonIcon();
- virtual const char* GetCancelButtonIcon();
-
- protected:
- ConstrainedWindow* window() { return window_; }
-
- // content::NotificationObserver implementation.
- // Watch for a new load or a closed tab and dismiss the dialog if they occur.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- content::NotificationRegistrar registrar_;
-
- private:
- // Called when the user accepts or cancels the dialog, respectively.
- virtual void OnAccepted();
- virtual void OnCanceled();
-
- // Close the dialog.
- void CloseDialog();
-
- ConstrainedWindow* window_;
- // True iff we are in the process of closing, to avoid running callbacks
- // multiple times.
- bool closing_;
-
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogDelegate);
-};
-
-#endif // CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_DELEGATE_H_
diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h
index 4afb960..af21b2c 100644
--- a/chrome/browser/ui/views/browser_dialogs.h
+++ b/chrome/browser/ui/views/browser_dialogs.h
@@ -82,10 +82,15 @@ void EditSearchEngine(gfx::NativeWindow parent,
EditSearchEngineControllerDelegate* delegate,
Profile* profile);
+// Shows the repost form confirmation dialog box.
+void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
// Shows the collected cookies dialog box.
void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window,
TabContentsWrapper* tab_contents);
+
// Shows the create web app shortcut dialog box.
void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window,
TabContentsWrapper* tab_contents);
diff --git a/chrome/browser/ui/views/dialog_stubs_gtk.cc b/chrome/browser/ui/views/dialog_stubs_gtk.cc
index e255bd5..5306594 100644
--- a/chrome/browser/ui/views/dialog_stubs_gtk.cc
+++ b/chrome/browser/ui/views/dialog_stubs_gtk.cc
@@ -10,12 +10,18 @@
#include "base/logging.h"
#include "chrome/browser/ui/gtk/edit_search_engine_dialog.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
+#include "chrome/browser/ui/webui/collected_cookies_ui_delegate.h"
#include "ui/gfx/native_widget_types.h"
#if !defined(WEBUI_TASK_MANAGER)
#include "chrome/browser/ui/gtk/task_manager_gtk.h"
#endif
+#if !defined(OS_CHROMEOS)
+#include "chrome/browser/ui/gtk/collected_cookies_gtk.h"
+#include "chrome/browser/ui/gtk/repost_form_warning_gtk.h"
+#endif
+
namespace browser {
#if !defined(WEBUI_TASK_MANAGER)
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index f8f7b6e..d6b30c7 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1146,6 +1146,10 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
#endif
}
+void BrowserView::ShowRepostFormWarningDialog(TabContents* tab_contents) {
+ browser::ShowRepostFormWarningDialog(GetNativeHandle(), tab_contents);
+}
+
void BrowserView::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) {
browser::ShowCollectedCookiesDialog(GetNativeHandle(), wrapper);
}
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index ba32747..24c010e 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -307,6 +307,7 @@ class BrowserView : public BrowserWindow,
void SetDownloadShelfVisible(bool visible);
virtual bool IsDownloadShelfVisible() const OVERRIDE;
virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
+ virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE;
virtual void ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) OVERRIDE;
virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE;
virtual void UserChangedTheme() OVERRIDE;
diff --git a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc b/chrome/browser/ui/views/repost_form_warning_view.cc
index 761a7a1..36d9290 100644
--- a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc
+++ b/chrome/browser/ui/views/repost_form_warning_view.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/views/tab_modal_confirm_dialog_views.h"
+#include "chrome/browser/ui/views/repost_form_warning_view.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/repost_form_warning_controller.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -19,76 +19,74 @@
namespace browser {
// Declared in browser_dialogs.h so others don't have to depend on our header.
-void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate,
- gfx::NativeWindow parent_window,
- TabContents* tab_contents) {
- new TabModalConfirmDialogViews(delegate, parent_window, tab_contents);
+void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents) {
+ new RepostFormWarningView(parent_window, tab_contents);
}
} // namespace browser
//////////////////////////////////////////////////////////////////////////////
-// TabModalConfirmDialogViews, constructor & destructor:
+// RepostFormWarningView, constructor & destructor:
-TabModalConfirmDialogViews::TabModalConfirmDialogViews(
- TabModalConfirmDialogDelegate* delegate,
+RepostFormWarningView::RepostFormWarningView(
gfx::NativeWindow parent_window,
TabContents* tab_contents)
- : delegate_(delegate),
- message_box_view_(NULL) {
+ : controller_(new RepostFormWarningController(tab_contents)),
+ message_box_view_(NULL) {
message_box_view_ = new views::MessageBoxView(
views::MessageBoxView::NO_OPTIONS,
- delegate->GetMessage(),
+ l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING),
string16());
TabContentsWrapper* wrapper =
TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
- delegate_->set_window(new ConstrainedWindowViews(wrapper, this));
+ controller_->set_window(new ConstrainedWindowViews(wrapper, this));
}
-TabModalConfirmDialogViews::~TabModalConfirmDialogViews() {
+RepostFormWarningView::~RepostFormWarningView() {
}
//////////////////////////////////////////////////////////////////////////////
-// TabModalConfirmDialogViews, views::DialogDelegate implementation:
+// RepostFormWarningView, views::DialogDelegate implementation:
-string16 TabModalConfirmDialogViews::GetWindowTitle() const {
- return delegate_->GetTitle();
+string16 RepostFormWarningView::GetWindowTitle() const {
+ return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE);
}
-string16 TabModalConfirmDialogViews::GetDialogButtonLabel(
+string16 RepostFormWarningView::GetDialogButtonLabel(
ui::DialogButton button) const {
if (button == ui::DIALOG_BUTTON_OK)
- return delegate_->GetAcceptButtonTitle();
+ return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND);
if (button == ui::DIALOG_BUTTON_CANCEL)
- return delegate_->GetCancelButtonTitle();
+ return l10n_util::GetStringUTF16(IDS_CANCEL);
return string16();
}
-bool TabModalConfirmDialogViews::Cancel() {
- delegate_->Cancel();
- return true;
+views::View* RepostFormWarningView::GetContentsView() {
+ return message_box_view_;
}
-bool TabModalConfirmDialogViews::Accept() {
- delegate_->Accept();
- return true;
+views::Widget* RepostFormWarningView::GetWidget() {
+ return message_box_view_->GetWidget();
}
-///////////////////////////////////////////////////////////////////////////////
-// TabModalConfirmDialogViews, views::WidgetDelegate implementation:
-
-views::View* TabModalConfirmDialogViews::GetContentsView() {
- return message_box_view_;
+const views::Widget* RepostFormWarningView::GetWidget() const {
+ return message_box_view_->GetWidget();
}
-views::Widget* TabModalConfirmDialogViews::GetWidget() {
- return message_box_view_->GetWidget();
+bool RepostFormWarningView::Cancel() {
+ controller_->Cancel();
+ return true;
}
-const views::Widget* TabModalConfirmDialogViews::GetWidget() const {
- return message_box_view_->GetWidget();
+bool RepostFormWarningView::Accept() {
+ controller_->Continue();
+ return true;
}
-void TabModalConfirmDialogViews::DeleteDelegate() {
+///////////////////////////////////////////////////////////////////////////////
+// RepostFormWarningView, RepostFormWarning implementation:
+
+void RepostFormWarningView::DeleteDelegate() {
delete this;
}
diff --git a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.h b/chrome/browser/ui/views/repost_form_warning_view.h
index 86c106c..d12301f 100644
--- a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.h
+++ b/chrome/browser/ui/views/repost_form_warning_view.h
@@ -2,34 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
#pragma once
#include "ui/gfx/native_widget_types.h"
#include "ui/views/window/dialog_delegate.h"
-class TabModalConfirmDialogDelegate;
+class RepostFormWarningController;
class TabContents;
namespace views {
class MessageBoxView;
}
-// Displays a tab-modal dialog, i.e. a dialog that will block the current page
-// but still allow the user to switch to a different page.
+// Displays a dialog that warns the user that they are about to resubmit
+// a form.
// 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 TabModalConfirmDialogViews : public views::DialogDelegate {
+class RepostFormWarningView : public views::DialogDelegate {
public:
- TabModalConfirmDialogViews(TabModalConfirmDialogDelegate* delegate,
- gfx::NativeWindow parent_window,
- TabContents* tab_contents);
+ // Use BrowserWindow::ShowRepostFormWarningDialog to use.
+ RepostFormWarningView(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
// views::DialogDelegate:
virtual string16 GetWindowTitle() const OVERRIDE;
virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
virtual bool Cancel() OVERRIDE;
virtual bool Accept() OVERRIDE;
@@ -37,17 +38,16 @@ class TabModalConfirmDialogViews : public views::DialogDelegate {
virtual views::View* GetContentsView() OVERRIDE;
virtual views::Widget* GetWidget() OVERRIDE;
virtual const views::Widget* GetWidget() const OVERRIDE;
- virtual void DeleteDelegate() OVERRIDE;
private:
- virtual ~TabModalConfirmDialogViews();
+ virtual ~RepostFormWarningView();
- scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
+ scoped_ptr<RepostFormWarningController> controller_;
// The message box view whose commands we handle.
views::MessageBoxView* message_box_view_;
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogViews);
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningView);
};
-#endif // CHROME_BROWSER_UI_VIEWS_TAB_MODAL_CONFIRM_DIALOG_VIEWS_H_
+#endif // CHROME_BROWSER_UI_VIEWS_REPOST_FORM_WARNING_VIEW_H_
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
index c3bc631..5c3295a 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
@@ -78,7 +78,7 @@ class ChromeURLContentSecurityPolicyExceptionSet
#if defined(OS_CHROMEOS) || defined(USE_AURA)
insert(chrome::kChromeUICollectedCookiesHost);
insert(chrome::kChromeUIHttpAuthHost);
- insert(chrome::kChromeUITabModalConfirmDialogHost);
+ insert(chrome::kChromeUIRepostFormWarningHost);
#endif
#if defined(USE_AURA)
insert(chrome::kChromeUIAppListHost);
diff --git a/chrome/browser/ui/webui/chrome_web_ui_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_factory.cc
index 39f88e5..fab6328 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_factory.cc
@@ -261,7 +261,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(TabContents* tab_contents,
#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
if (url.host() == chrome::kChromeUICollectedCookiesHost ||
url.host() == chrome::kChromeUIHttpAuthHost ||
- url.host() == chrome::kChromeUITabModalConfirmDialogHost) {
+ url.host() == chrome::kChromeUIRepostFormWarningHost) {
return &NewWebUI<ConstrainedHtmlUI>;
}
#endif
diff --git a/chrome/browser/ui/webui/repost_form_warning_ui.cc b/chrome/browser/ui/webui/repost_form_warning_ui.cc
new file mode 100644
index 0000000..652fdcb
--- /dev/null
+++ b/chrome/browser/ui/webui/repost_form_warning_ui.cc
@@ -0,0 +1,166 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/ui/webui/repost_form_warning_ui.h"
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/json/json_reader.h"
+#include "base/message_loop.h"
+#include "base/string_piece.h"
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/repost_form_warning_controller.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
+#include "chrome/browser/ui/webui/constrained_html_ui.h"
+#include "chrome/browser/ui/webui/html_dialog_ui.h"
+#include "chrome/common/jstemplate_builder.h"
+#include "chrome/common/url_constants.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "grit/browser_resources.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/size.h"
+
+using std::string;
+
+namespace browser {
+
+// Declared in browser_dialogs.h so others don't have to depend on our header.
+void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents) {
+ new RepostFormWarningUI(parent_window, tab_contents);
+}
+
+} // namespace browser
+
+class RepostFormWarningSource : public ChromeURLDataManager::DataSource {
+ public:
+ RepostFormWarningSource()
+ : DataSource(chrome::kChromeUIRepostFormWarningHost,
+ MessageLoop::current()) {
+ }
+
+ virtual void StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id) OVERRIDE {
+ DictionaryValue dict;
+ dict.SetString("explanation",
+ l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING));
+ dict.SetString("resend",
+ l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND));
+ dict.SetString("cancel", l10n_util::GetStringUTF16(IDS_CANCEL));
+
+ SetFontAndTextDirection(&dict);
+ base::StringPiece html =
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_REPOST_FORM_WARNING_HTML);
+ string response = jstemplate_builder::GetI18nTemplateHtml(html, &dict);
+ SendResponse(request_id, base::RefCountedString::TakeString(&response));
+ }
+
+ virtual string GetMimeType(const std::string& path) const OVERRIDE {
+ return "text/html";
+ }
+
+ static void RegisterDataSource(Profile* profile) {
+ ChromeURLDataManager* url_manager = profile->GetChromeURLDataManager();
+ url_manager->AddDataSource(new RepostFormWarningSource());
+ }
+
+ private:
+ virtual ~RepostFormWarningSource() {}
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningSource);
+};
+
+class RepostFormWarningHtmlDelegate : public HtmlDialogUIDelegate {
+ public:
+ explicit RepostFormWarningHtmlDelegate(RepostFormWarningUI* ui) : ui_(ui) {}
+
+ virtual ~RepostFormWarningHtmlDelegate() {}
+
+ // HtmlDialogUIDelegate implementation.
+ virtual bool IsDialogModal() const OVERRIDE {
+ return true;
+ }
+
+ virtual string16 GetDialogTitle() const OVERRIDE {
+ return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE);
+ }
+
+ virtual GURL GetDialogContentURL() const OVERRIDE {
+ return GURL(chrome::kChromeUIRepostFormWarningURL);
+ }
+
+ virtual void GetWebUIMessageHandlers(
+ std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE {}
+
+ virtual void GetDialogSize(gfx::Size* size) const OVERRIDE {
+ size->SetSize(kDialogWidth, kDialogHeight);
+ }
+
+ virtual std::string GetDialogArgs() const OVERRIDE {
+ return string();
+ }
+
+ virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE {
+ bool repost = false;
+ if (!json_retval.empty()) {
+ base::JSONReader reader;
+ scoped_ptr<Value> value(reader.JsonToValue(json_retval, false, false));
+ if (!value.get() || !value->GetAsBoolean(&repost))
+ NOTREACHED() << "Missing or unreadable response from dialog";
+ }
+
+ ui_->OnDialogClosed(repost);
+ ui_ = NULL;
+ delete this;
+ }
+
+ virtual void OnCloseContents(TabContents* source,
+ bool* out_close_dialog) OVERRIDE {}
+
+ virtual bool ShouldShowDialogTitle() const OVERRIDE {
+ return true;
+ }
+
+ private:
+ static const int kDialogWidth = 400;
+ static const int kDialogHeight = 108;
+
+ RepostFormWarningUI* ui_; // not owned
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningHtmlDelegate);
+};
+
+RepostFormWarningUI::RepostFormWarningUI(gfx::NativeWindow parent_window,
+ TabContents* tab_contents)
+ : controller_(new RepostFormWarningController(tab_contents)) {
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
+ Profile* profile = wrapper->profile();
+ RepostFormWarningSource::RegisterDataSource(profile);
+ RepostFormWarningHtmlDelegate* html_delegate =
+ new RepostFormWarningHtmlDelegate(this);
+ ConstrainedHtmlUIDelegate* dialog_delegate =
+ ConstrainedHtmlUI::CreateConstrainedHtmlDialog(
+ profile, html_delegate, wrapper);
+ controller_->set_window(dialog_delegate->window());
+}
+
+RepostFormWarningUI::~RepostFormWarningUI() {}
+
+void RepostFormWarningUI::OnDialogClosed(bool repost) {
+ controller_->set_window(NULL);
+ if (repost)
+ controller_->Continue();
+ else
+ controller_->Cancel();
+ delete this;
+}
diff --git a/chrome/browser/ui/webui/repost_form_warning_ui.h b/chrome/browser/ui/webui/repost_form_warning_ui.h
new file mode 100644
index 0000000..a8a3e72
--- /dev/null
+++ b/chrome/browser/ui/webui/repost_form_warning_ui.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_REPOST_FORM_WARNING_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_REPOST_FORM_WARNING_UI_H_
+#pragma once
+
+#include "base/memory/scoped_ptr.h"
+#include "ui/gfx/native_widget_types.h"
+
+class BrowserWindow;
+class RepostFormWarningController;
+class TabContents;
+
+namespace browser {
+void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+}
+
+// Displays a dialog that warns the user that they are about to resubmit
+// a form.
+// 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 RepostFormWarningUI {
+ public:
+ // Invoked when the dialog is closed. Notifies the controller of the user's
+ // response and deletes this object.
+ void OnDialogClosed(bool repost);
+
+ private:
+ friend void browser::ShowRepostFormWarningDialog(
+ gfx::NativeWindow parent_window, TabContents* tab_contents);
+
+ // Call BrowserWindow::ShowRepostFormWarningDialog() to use.
+ RepostFormWarningUI(gfx::NativeWindow parent_window,
+ TabContents* tab_contents);
+
+ virtual ~RepostFormWarningUI();
+
+ scoped_ptr<RepostFormWarningController> controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningUI);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_REPOST_FORM_WARNING_UI_H_
diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc
deleted file mode 100644
index ece1b11..0000000
--- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h"
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/json/json_reader.h"
-#include "base/json/json_writer.h"
-#include "base/string_piece.h"
-#include "base/utf_string_conversions.h"
-#include "base/values.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/constrained_window.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
-#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
-#include "chrome/browser/ui/webui/constrained_html_ui.h"
-#include "chrome/browser/ui/webui/html_dialog_ui.h"
-#include "chrome/common/jstemplate_builder.h"
-#include "chrome/common/url_constants.h"
-#include "content/browser/tab_contents/tab_contents.h"
-#include "grit/browser_resources.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/size.h"
-
-using std::string;
-
-namespace browser {
-
-// Declared in browser_dialogs.h so others don't have to depend on our header.
-void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents) {
- new TabModalConfirmDialogUI(delegate, tab_contents);
-}
-
-} // namespace browser
-
-class TabModalConfirmDialogHtmlDelegate : public HtmlDialogUIDelegate {
- public:
- TabModalConfirmDialogHtmlDelegate(
- TabModalConfirmDialogUI* ui,
- TabModalConfirmDialogDelegate* dialog_delegate)
- : ui_(ui),
- dialog_delegate_(dialog_delegate) {}
-
- virtual ~TabModalConfirmDialogHtmlDelegate() {}
-
- // HtmlDialogUIDelegate implementation.
- virtual bool IsDialogModal() const OVERRIDE {
- return true;
- }
-
- virtual string16 GetDialogTitle() const OVERRIDE {
- return dialog_delegate_->GetTitle();
- }
-
- virtual GURL GetDialogContentURL() const OVERRIDE {
- return GURL(chrome::kChromeUITabModalConfirmDialogURL);
- }
-
- virtual void GetWebUIMessageHandlers(
- std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE {}
-
- virtual void GetDialogSize(gfx::Size* size) const OVERRIDE {
- size->SetSize(kDialogWidth, kDialogHeight);
- }
-
- virtual std::string GetDialogArgs() const OVERRIDE {
- DictionaryValue dict;
- dict.SetString("message", dialog_delegate_->GetMessage());
- dict.SetString("accept", dialog_delegate_->GetAcceptButtonTitle());
- dict.SetString("cancel", dialog_delegate_->GetCancelButtonTitle());
- ChromeWebUIDataSource::SetFontAndTextDirection(&dict);
- std::string json;
- base::JSONWriter::Write(&dict, false, &json);
- return json;
- }
-
- virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE {
- bool accepted = false;
- if (!json_retval.empty()) {
- base::JSONReader reader;
- scoped_ptr<Value> value(reader.JsonToValue(json_retval, false, false));
- DCHECK(value.get() && value->GetAsBoolean(&accepted))
- << "Missing or unreadable response from dialog";
- }
-
- ui_->OnDialogClosed(accepted);
- delete this;
- }
-
- virtual void OnCloseContents(TabContents* source,
- bool* out_close_dialog) OVERRIDE {}
-
- virtual bool ShouldShowDialogTitle() const OVERRIDE {
- return true;
- }
-
- private:
- static const int kDialogWidth = 400;
- static const int kDialogHeight = 120;
-
- scoped_ptr<TabModalConfirmDialogUI> ui_;
- // Owned by TabModalConfirmDialogUI, which we own.
- TabModalConfirmDialogDelegate* dialog_delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogHtmlDelegate);
-};
-
-TabModalConfirmDialogUI::TabModalConfirmDialogUI(
- TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents)
- : delegate_(delegate) {
- TabContentsWrapper* wrapper =
- TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
- Profile* profile = wrapper->profile();
- ChromeWebUIDataSource* data_source =
- new ChromeWebUIDataSource(chrome::kChromeUITabModalConfirmDialogHost);
- data_source->set_default_resource(IDR_TAB_MODAL_CONFIRM_DIALOG_HTML);
- profile->GetChromeURLDataManager()->AddDataSource(data_source);
-
- TabModalConfirmDialogHtmlDelegate* html_delegate =
- new TabModalConfirmDialogHtmlDelegate(this, delegate);
- ConstrainedHtmlUIDelegate* dialog_delegate =
- ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile, html_delegate,
- wrapper);
- delegate_->set_window(dialog_delegate->window());
-}
-
-TabModalConfirmDialogUI::~TabModalConfirmDialogUI() {}
-
-void TabModalConfirmDialogUI::OnDialogClosed(bool accepted) {
- delegate_->set_window(NULL);
- if (accepted)
- delegate_->Accept();
- else
- delegate_->Cancel();
-}
diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
deleted file mode 100644
index 93dc7a6..0000000
--- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_
-#define CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_
-#pragma once
-
-#if !(defined(USE_AURA) || defined(TOOLKIT_VIEWS))
-#error Tab-modal confirm dialog should be shown with native UI.
-#endif
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-
-class TabContents;
-class TabModalConfirmDialogDelegate;
-
-// Displays a tab-modal dialog, i.e. a dialog that will block the current page
-// but still allow the user to switch to a different page.
-// 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 {
- public:
- TabModalConfirmDialogUI(TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents);
- ~TabModalConfirmDialogUI();
-
- // Invoked when the dialog is closed. Notifies the controller of the user's
- // response.
- void OnDialogClosed(bool accept);
-
- private:
- scoped_ptr<TabModalConfirmDialogDelegate> delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogUI);
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 6c39ffb..7e46c902 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2837,6 +2837,8 @@
'browser/ui/cocoa/presentation_mode_prefs.mm',
'browser/ui/cocoa/profile_menu_controller.h',
'browser/ui/cocoa/profile_menu_controller.mm',
+ 'browser/ui/cocoa/repost_form_warning_mac.h',
+ 'browser/ui/cocoa/repost_form_warning_mac.mm',
'browser/ui/cocoa/restart_browser.h',
'browser/ui/cocoa/restart_browser.mm',
'browser/ui/cocoa/search_engine_dialog_controller.h',
@@ -2868,8 +2870,6 @@
'browser/ui/cocoa/tab_contents/sad_tab_view.mm',
'browser/ui/cocoa/tab_contents/tab_contents_controller.h',
'browser/ui/cocoa/tab_contents/tab_contents_controller.mm',
- 'browser/ui/cocoa/tab_modal_confirm_dialog_mac.h',
- 'browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm',
'browser/ui/cocoa/tab_view_picker_table.h',
'browser/ui/cocoa/tab_view_picker_table.mm',
'browser/ui/cocoa/table_row_nsimage_cache.h',
@@ -3141,6 +3141,8 @@
'browser/ui/gtk/process_singleton_dialog.h',
'browser/ui/gtk/reload_button_gtk.cc',
'browser/ui/gtk/reload_button_gtk.h',
+ 'browser/ui/gtk/repost_form_warning_gtk.cc',
+ 'browser/ui/gtk/repost_form_warning_gtk.h',
'browser/ui/gtk/rounded_window.cc',
'browser/ui/gtk/rounded_window.h',
'browser/ui/gtk/sad_tab_gtk.cc',
@@ -3161,8 +3163,6 @@
'browser/ui/gtk/status_icons/status_tray_gtk.h',
'browser/ui/gtk/tab_contents_container_gtk.cc',
'browser/ui/gtk/tab_contents_container_gtk.h',
- 'browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc',
- 'browser/ui/gtk/tab_modal_confirm_dialog_gtk.h',
'browser/ui/gtk/tabs/drag_data.cc',
'browser/ui/gtk/tabs/drag_data.h',
'browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc',
@@ -3292,8 +3292,6 @@
'browser/ui/tab_contents/core_tab_helper_delegate.h',
'browser/ui/tab_contents/tab_contents_wrapper.cc',
'browser/ui/tab_contents/tab_contents_wrapper.h',
- 'browser/ui/tab_modal_confirm_dialog_delegate.cc',
- 'browser/ui/tab_modal_confirm_dialog_delegate.h',
'browser/ui/tabs/dock_info.cc',
'browser/ui/tabs/dock_info.h',
'browser/ui/tabs/dock_info_aura.cc',
@@ -3581,6 +3579,8 @@
'browser/ui/views/page_info_bubble_view.h',
'browser/ui/views/reload_button.cc',
'browser/ui/views/reload_button.h',
+ 'browser/ui/views/repost_form_warning_view.cc',
+ 'browser/ui/views/repost_form_warning_view.h',
'browser/ui/views/restart_message_box.cc',
'browser/ui/views/restart_message_box.h',
'browser/ui/views/sad_tab_view.cc',
@@ -3631,8 +3631,6 @@
'browser/ui/views/tab_contents/tab_contents_view_views.h',
'browser/ui/views/tab_icon_view.cc',
'browser/ui/views/tab_icon_view.h',
- 'browser/ui/views/tab_modal_confirm_dialog_views.cc',
- 'browser/ui/views/tab_modal_confirm_dialog_views.h',
'browser/ui/views/tabs/abstract_tab_strip_view.h',
'browser/ui/views/tabs/base_tab.cc',
'browser/ui/views/tabs/base_tab.h',
@@ -4042,6 +4040,8 @@
'browser/ui/webui/quota_internals_types.h',
'browser/ui/webui/quota_internals_ui.cc',
'browser/ui/webui/quota_internals_ui.h',
+ 'browser/ui/webui/repost_form_warning_ui.cc',
+ 'browser/ui/webui/repost_form_warning_ui.h',
'browser/ui/webui/screenshot_source.cc',
'browser/ui/webui/screenshot_source.h',
'browser/ui/webui/sessions_ui.cc',
@@ -4062,8 +4062,6 @@
'browser/ui/webui/sync_setup_handler2.h',
'browser/ui/webui/sync_setup_handler.cc',
'browser/ui/webui/sync_setup_handler.h',
- 'browser/ui/webui/tab_modal_confirm_dialog_webui.cc',
- 'browser/ui/webui/tab_modal_confirm_dialog_webui.h',
'browser/ui/webui/task_manager_dialog.cc',
'browser/ui/webui/task_manager_dialog.h',
'browser/ui/webui/task_manager_handler.cc',
@@ -4263,8 +4261,8 @@
'browser/platform_util_linux.cc',
'browser/printing/print_dialog_gtk.cc',
'browser/printing/print_dialog_gtk.h',
- 'browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc',
- 'browser/ui/gtk/tab_modal_confirm_dialog_gtk.h',
+ 'browser/ui/gtk/repost_form_warning_gtk.cc',
+ 'browser/ui/gtk/repost_form_warning_gtk.h',
'browser/upgrade_detector_impl.cc',
'browser/upgrade_detector_impl.h',
],
@@ -4707,8 +4705,8 @@
'browser/ui/webui/collected_cookies_ui_delegate.h',
'browser/ui/webui/cookies_tree_model_adapter.cc',
'browser/ui/webui/cookies_tree_model_adapter.h',
- 'browser/ui/webui/tab_modal_confirm_dialog_webui.cc',
- 'browser/ui/webui/tab_modal_confirm_dialog_webui.h',
+ 'browser/ui/webui/repost_form_warning_ui.cc',
+ 'browser/ui/webui/repost_form_warning_ui.h',
],
'conditions': [
['win_use_allocator_shim==1', {
@@ -4811,9 +4809,9 @@
['include', '^browser/ui/gtk/nine_box.h'],
['include', '^browser/ui/gtk/omnibox/omnibox_view_gtk.cc'],
['include', '^browser/ui/gtk/omnibox/omnibox_view_gtk.h'],
+ ['include', '^browser/ui/gtk/repost_form_warning_gtk.cc'],
+ ['include', '^browser/ui/gtk/repost_form_warning_gtk.h'],
['include', '^browser/ui/gtk/ssl_client_certificate_selector.cc'],
- ['include', '^browser/ui/gtk/tab_modal_confirm_dialog_gtk.cc'],
- ['include', '^browser/ui/gtk/tab_modal_confirm_dialog_gtk.h'],
['include', '^browser/ui/gtk/task_manager_gtk.cc'],
['include', '^browser/ui/gtk/task_manager_gtk.h'],
['include', '^browser/ui/gtk/view_id_util.cc'],
@@ -5038,12 +5036,12 @@
['include', '^browser/ui/views/window.h'],
['include', '^browser/ui/views/wrench_menu.cc'],
['include', '^browser/ui/views/wrench_menu.h'],
+ ['include', '^browser/ui/webui/repost_form_warning_ui.cc'],
+ ['include', '^browser/ui/webui/repost_form_warning_ui.h'],
['include', '^browser/ui/webui/collected_cookies_ui_delegate.cc'],
['include', '^browser/ui/webui/collected_cookies_ui_delegate.h'],
['include', '^browser/ui/webui/cookies_tree_model_adapter.cc'],
['include', '^browser/ui/webui/cookies_tree_model_adapter.h'],
- ['include', '^browser/ui/webui/tab_modal_confirm_dialog_webui.cc'],
- ['include', '^browser/ui/webui/tab_modal_confirm_dialog_webui.h'],
['include', '^browser/ui/window_sizer.cc'],
['include', '^browser/ui/window_sizer.h'],
@@ -5073,8 +5071,8 @@
['exclude', '^browser/ui/webui/collected_cookies_ui_delegate.h'],
['exclude', '^browser/ui/webui/cookies_tree_model_adapter.cc'],
['exclude', '^browser/ui/webui/cookies_tree_model_adapter.h'],
- ['exclude', '^browser/ui/webui/tab_modal_confirm_dialog_webui.cc'],
- ['exclude', '^browser/ui/webui/tab_modal_confirm_dialog_webui.h'],
+ ['exclude', '^browser/ui/webui/repost_form_warning_ui.cc'],
+ ['exclude', '^browser/ui/webui/repost_form_warning_ui.h'],
]
}],
# Exclude these toolkit_views specific files again.
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index be45ba8..8ef0d66 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -106,8 +106,7 @@ const char kChromeUIFileManagerURL[] = "chrome://files/";
#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
const char kChromeUICollectedCookiesURL[] = "chrome://collected-cookies/";
const char kChromeUIHttpAuthURL[] = "chrome://http-auth/";
-const char kChromeUITabModalConfirmDialogURL[] =
- "chrome://tab-modal-confirm-dialog/";
+const char kChromeUIRepostFormWarningURL[] = "chrome://repost-form-warning/";
#endif
#if defined(USE_AURA)
@@ -238,7 +237,7 @@ const char kChromeUIFileManagerHost[] = "files";
#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
const char kChromeUICollectedCookiesHost[] = "collected-cookies";
const char kChromeUIHttpAuthHost[] = "http-auth";
-const char kChromeUITabModalConfirmDialogHost[] = "tab-modal-confirm-dialog";
+const char kChromeUIRepostFormWarningHost[] = "repost-form-warning";
#endif
#if defined(USE_AURA)
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index cdc4d87..9b710c2 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -98,7 +98,7 @@ extern const char kChromeUIFileManagerURL[];
#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
extern const char kChromeUICollectedCookiesURL[];
extern const char kChromeUIHttpAuthURL[];
-extern const char kChromeUITabModalConfirmDialogURL[];
+extern const char kChromeUIRepostFormWarningURL[];
#endif
#if defined(USE_AURA)
@@ -227,7 +227,7 @@ extern const char kChromeUIFileManagerHost[];
#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
extern const char kChromeUICollectedCookiesHost[];
extern const char kChromeUIHttpAuthHost[];
-extern const char kChromeUITabModalConfirmDialogHost[];
+extern const char kChromeUIRepostFormWarningHost[];
#endif
#if defined(USE_AURA)
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index da5b01d..2708ff9 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -90,6 +90,8 @@ class TestBrowserWindow : public BrowserWindow {
bool already_bookmarked) OVERRIDE {}
virtual bool IsDownloadShelfVisible() const OVERRIDE;
virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
+ virtual void ShowRepostFormWarningDialog(
+ TabContents* tab_contents) OVERRIDE {}
virtual void ShowCollectedCookiesDialog(
TabContentsWrapper* wrapper) OVERRIDE {}
virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE {}