• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
RepostFormWarningController(content::WebContents * web_contents)12 RepostFormWarningController::RepostFormWarningController(
13     content::WebContents* web_contents)
14     : TabModalConfirmDialogDelegate(web_contents),
15       content::WebContentsObserver(web_contents) {
16 }
17 
~RepostFormWarningController()18 RepostFormWarningController::~RepostFormWarningController() {
19 }
20 
GetTitle()21 base::string16 RepostFormWarningController::GetTitle() {
22   return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE);
23 }
24 
GetDialogMessage()25 base::string16 RepostFormWarningController::GetDialogMessage() {
26   return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING);
27 }
28 
GetAcceptButtonTitle()29 base::string16 RepostFormWarningController::GetAcceptButtonTitle() {
30   return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND);
31 }
32 
OnAccepted()33 void RepostFormWarningController::OnAccepted() {
34   web_contents()->GetController().ContinuePendingReload();
35 }
36 
OnCanceled()37 void RepostFormWarningController::OnCanceled() {
38   web_contents()->GetController().CancelPendingReload();
39 }
40 
OnClosed()41 void RepostFormWarningController::OnClosed() {
42   web_contents()->GetController().CancelPendingReload();
43 }
44 
BeforeFormRepostWarningShow()45 void RepostFormWarningController::BeforeFormRepostWarningShow() {
46   // Close the dialog if we show an additional dialog, to avoid them
47   // stacking up.
48   Cancel();
49 }
50