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.
4
5#include "chrome/browser/repost_form_warning_controller.h"
6
7#include "chrome/grit/generated_resources.h"
8#include "content/public/browser/navigation_controller.h"
9#include "content/public/browser/web_contents.h"
10#include "ui/base/l10n/l10n_util.h"
11
12RepostFormWarningController::RepostFormWarningController(
13    content::WebContents* web_contents)
14    : TabModalConfirmDialogDelegate(web_contents),
15      content::WebContentsObserver(web_contents) {
16}
17
18RepostFormWarningController::~RepostFormWarningController() {
19}
20
21base::string16 RepostFormWarningController::GetTitle() {
22  return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE);
23}
24
25base::string16 RepostFormWarningController::GetDialogMessage() {
26  return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING);
27}
28
29base::string16 RepostFormWarningController::GetAcceptButtonTitle() {
30  return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND);
31}
32
33void RepostFormWarningController::OnAccepted() {
34  web_contents()->GetController().ContinuePendingReload();
35}
36
37void RepostFormWarningController::OnCanceled() {
38  web_contents()->GetController().CancelPendingReload();
39}
40
41void RepostFormWarningController::OnClosed() {
42  web_contents()->GetController().CancelPendingReload();
43}
44
45void RepostFormWarningController::BeforeFormRepostWarningShow() {
46  // Close the dialog if we show an additional dialog, to avoid them
47  // stacking up.
48  Cancel();
49}
50