| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/repost_form_warning_controller.h" | 5 #include "chrome/browser/repost_form_warning_controller.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | |
| 8 #include <gtk/gtk.h> | |
| 9 #endif | |
| 10 | |
| 11 #include "content/public/browser/navigation_controller.h" | 7 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 13 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 15 | 11 |
| 16 RepostFormWarningController::RepostFormWarningController( | 12 RepostFormWarningController::RepostFormWarningController( |
| 17 content::WebContents* web_contents) | 13 content::WebContents* web_contents) |
| 18 : TabModalConfirmDialogDelegate(web_contents), | 14 : TabModalConfirmDialogDelegate(web_contents), |
| 19 content::WebContentsObserver(web_contents) { | 15 content::WebContentsObserver(web_contents) { |
| 20 } | 16 } |
| 21 | 17 |
| 22 RepostFormWarningController::~RepostFormWarningController() { | 18 RepostFormWarningController::~RepostFormWarningController() { |
| 23 } | 19 } |
| 24 | 20 |
| 25 base::string16 RepostFormWarningController::GetTitle() { | 21 base::string16 RepostFormWarningController::GetTitle() { |
| 26 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE); | 22 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE); |
| 27 } | 23 } |
| 28 | 24 |
| 29 base::string16 RepostFormWarningController::GetDialogMessage() { | 25 base::string16 RepostFormWarningController::GetDialogMessage() { |
| 30 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING); | 26 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING); |
| 31 } | 27 } |
| 32 | 28 |
| 33 base::string16 RepostFormWarningController::GetAcceptButtonTitle() { | 29 base::string16 RepostFormWarningController::GetAcceptButtonTitle() { |
| 34 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND); | 30 return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND); |
| 35 } | 31 } |
| 36 | 32 |
| 37 #if defined(TOOLKIT_GTK) | |
| 38 const char* RepostFormWarningController::GetAcceptButtonIcon() { | |
| 39 return GTK_STOCK_REFRESH; | |
| 40 } | |
| 41 | |
| 42 const char* RepostFormWarningController::GetCancelButtonIcon() { | |
| 43 return GTK_STOCK_CANCEL; | |
| 44 } | |
| 45 #endif // defined(TOOLKIT_GTK) | |
| 46 | |
| 47 void RepostFormWarningController::OnAccepted() { | 33 void RepostFormWarningController::OnAccepted() { |
| 48 web_contents()->GetController().ContinuePendingReload(); | 34 web_contents()->GetController().ContinuePendingReload(); |
| 49 } | 35 } |
| 50 | 36 |
| 51 void RepostFormWarningController::OnCanceled() { | 37 void RepostFormWarningController::OnCanceled() { |
| 52 web_contents()->GetController().CancelPendingReload(); | 38 web_contents()->GetController().CancelPendingReload(); |
| 53 } | 39 } |
| 54 | 40 |
| 55 void RepostFormWarningController::OnClosed() { | 41 void RepostFormWarningController::OnClosed() { |
| 56 web_contents()->GetController().CancelPendingReload(); | 42 web_contents()->GetController().CancelPendingReload(); |
| 57 } | 43 } |
| 58 | 44 |
| 59 void RepostFormWarningController::BeforeFormRepostWarningShow() { | 45 void RepostFormWarningController::BeforeFormRepostWarningShow() { |
| 60 // Close the dialog if we show an additional dialog, to avoid them | 46 // Close the dialog if we show an additional dialog, to avoid them |
| 61 // stacking up. | 47 // stacking up. |
| 62 Cancel(); | 48 Cancel(); |
| 63 } | 49 } |
| OLD | NEW |