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