blob: 0d9ac565533a37cc9d38d5e935b187cad60e4990 [file] [log] [blame]
[email protected]ebbbb9f2011-03-09 13:16:141// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]965bb092010-04-09 11:59:022// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/repost_form_warning_controller.h"
6
[email protected]a13283cc2012-04-05 00:21:227#if defined(TOOLKIT_GTK)
[email protected]67baffc82011-12-19 18:03:078#include <gtk/gtk.h>
9#endif
10
[email protected]cdcb1dee2012-01-04 00:46:2011#include "content/public/browser/navigation_controller.h"
[email protected]2a6bc3e2011-12-28 23:51:3312#include "content/public/browser/web_contents.h"
[email protected]67baffc82011-12-19 18:03:0713#include "grit/generated_resources.h"
14#include "ui/base/l10n/l10n_util.h"
[email protected]965bb092010-04-09 11:59:0215
[email protected]965bb092010-04-09 11:59:0216RepostFormWarningController::RepostFormWarningController(
[email protected]17e286e2013-03-01 23:29:3917 content::WebContents* web_contents)
[email protected]2a6bc3e2011-12-28 23:51:3318 : TabModalConfirmDialogDelegate(web_contents),
[email protected]17e286e2013-03-01 23:29:3919 content::WebContentsObserver(web_contents) {
[email protected]965bb092010-04-09 11:59:0220}
21
22RepostFormWarningController::~RepostFormWarningController() {
23}
24
[email protected]67baffc82011-12-19 18:03:0725string16 RepostFormWarningController::GetTitle() {
26 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE);
[email protected]965bb092010-04-09 11:59:0227}
28
[email protected]67baffc82011-12-19 18:03:0729string16 RepostFormWarningController::GetMessage() {
30 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING);
[email protected]965bb092010-04-09 11:59:0231}
32
[email protected]67baffc82011-12-19 18:03:0733string16 RepostFormWarningController::GetAcceptButtonTitle() {
34 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND);
35}
36
[email protected]a13283cc2012-04-05 00:21:2237#if defined(TOOLKIT_GTK)
[email protected]67baffc82011-12-19 18:03:0738const char* RepostFormWarningController::GetAcceptButtonIcon() {
39 return GTK_STOCK_REFRESH;
40}
41
42const char* RepostFormWarningController::GetCancelButtonIcon() {
43 return GTK_STOCK_CANCEL;
44}
[email protected]a13283cc2012-04-05 00:21:2245#endif // defined(TOOLKIT_GTK)
[email protected]67baffc82011-12-19 18:03:0746
47void RepostFormWarningController::OnAccepted() {
[email protected]17e286e2013-03-01 23:29:3948 web_contents()->GetController().ContinuePendingReload();
[email protected]67baffc82011-12-19 18:03:0749}
50
51void RepostFormWarningController::OnCanceled() {
[email protected]17e286e2013-03-01 23:29:3952 web_contents()->GetController().CancelPendingReload();
[email protected]67baffc82011-12-19 18:03:0753}
54
[email protected]17e286e2013-03-01 23:29:3955void RepostFormWarningController::BeforeFormRepostWarningShow() {
[email protected]67baffc82011-12-19 18:03:0756 // Close the dialog if we show an additional dialog, to avoid them
57 // stacking up.
[email protected]17e286e2013-03-01 23:29:3958 Cancel();
[email protected]965bb092010-04-09 11:59:0259}