1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/repost_form_warning_controller.h"
7 #if defined(TOOLKIT_GTK)
11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/web_contents.h"
13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h"
16 RepostFormWarningController::RepostFormWarningController(
17 content::WebContents
* web_contents
)
18 : TabModalConfirmDialogDelegate(web_contents
),
19 content::WebContentsObserver(web_contents
) {
22 RepostFormWarningController::~RepostFormWarningController() {
25 base::string16
RepostFormWarningController::GetTitle() {
26 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE
);
29 base::string16
RepostFormWarningController::GetMessage() {
30 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING
);
33 base::string16
RepostFormWarningController::GetAcceptButtonTitle() {
34 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND
);
37 #if defined(TOOLKIT_GTK)
38 const char* RepostFormWarningController::GetAcceptButtonIcon() {
39 return GTK_STOCK_REFRESH
;
42 const char* RepostFormWarningController::GetCancelButtonIcon() {
43 return GTK_STOCK_CANCEL
;
45 #endif // defined(TOOLKIT_GTK)
47 void RepostFormWarningController::OnAccepted() {
48 web_contents()->GetController().ContinuePendingReload();
51 void RepostFormWarningController::OnCanceled() {
52 web_contents()->GetController().CancelPendingReload();
55 void RepostFormWarningController::OnClosed() {
56 web_contents()->GetController().CancelPendingReload();
59 void RepostFormWarningController::BeforeFormRepostWarningShow() {
60 // Close the dialog if we show an additional dialog, to avoid them