15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/repost_form_warning_controller.h" 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)#include "chrome/grit/generated_resources.h" 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/navigation_controller.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/web_contents.h" 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/l10n/l10n_util.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)RepostFormWarningController::RepostFormWarningController( 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) content::WebContents* web_contents) 14fb250657ef40d7500f20882d5c9909c1013367d3Ben Murdoch : TabModalConfirmDialogDelegate(web_contents), 15fb250657ef40d7500f20882d5c9909c1013367d3Ben Murdoch content::WebContentsObserver(web_contents) { 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)RepostFormWarningController::~RepostFormWarningController() { 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)base::string16 RepostFormWarningController::GetTitle() { 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE); 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)base::string16 RepostFormWarningController::GetDialogMessage() { 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING); 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)base::string16 RepostFormWarningController::GetAcceptButtonTitle() { 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND); 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void RepostFormWarningController::OnAccepted() { 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) web_contents()->GetController().ContinuePendingReload(); 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void RepostFormWarningController::OnCanceled() { 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) web_contents()->GetController().CancelPendingReload(); 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 41a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)void RepostFormWarningController::OnClosed() { 42a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) web_contents()->GetController().CancelPendingReload(); 43a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)} 44a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RepostFormWarningController::BeforeFormRepostWarningShow() { 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Close the dialog if we show an additional dialog, to avoid them 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // stacking up. 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) Cancel(); 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 50