diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 23:29:39 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 23:29:39 +0000 |
commit | 17e286e33899d6c5bcaa0a599c0a4a4809c3e43a (patch) | |
tree | 3e136a164df7e576d3b5bbff06cb90dba9850edf /chrome/browser/repost_form_warning_controller.cc | |
parent | 0e8e680bfe8327cfb3cf2fbb15ab90e5d59c60be (diff) | |
download | chromium_src-17e286e33899d6c5bcaa0a599c0a4a4809c3e43a.zip chromium_src-17e286e33899d6c5bcaa0a599c0a4a4809c3e43a.tar.gz chromium_src-17e286e33899d6c5bcaa0a599c0a4a4809c3e43a.tar.bz2 |
content: convert form repost warning notification to WebContentsObserver usage
BUG=170921
Review URL: https://codereview.chromium.org/12378021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/repost_form_warning_controller.cc')
-rw-r--r-- | chrome/browser/repost_form_warning_controller.cc | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/chrome/browser/repost_form_warning_controller.cc b/chrome/browser/repost_form_warning_controller.cc index 53eabd5..0d9ac56 100644 --- a/chrome/browser/repost_form_warning_controller.cc +++ b/chrome/browser/repost_form_warning_controller.cc @@ -8,25 +8,15 @@ #include <gtk/gtk.h> #endif -#include "base/bind.h" -#include "base/bind_helpers.h" #include "content/public/browser/navigation_controller.h" -#include "content/public/browser/notification_source.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -using content::NavigationController; -using content::WebContents; - RepostFormWarningController::RepostFormWarningController( - WebContents* web_contents) + content::WebContents* web_contents) : TabModalConfirmDialogDelegate(web_contents), - navigation_controller_(&web_contents->GetController()) { - registrar_.Add(this, content::NOTIFICATION_REPOST_WARNING_SHOWN, - content::Source<NavigationController>( - navigation_controller_)); + content::WebContentsObserver(web_contents) { } RepostFormWarningController::~RepostFormWarningController() { @@ -55,21 +45,15 @@ const char* RepostFormWarningController::GetCancelButtonIcon() { #endif // defined(TOOLKIT_GTK) void RepostFormWarningController::OnAccepted() { - navigation_controller_->ContinuePendingReload(); + web_contents()->GetController().ContinuePendingReload(); } void RepostFormWarningController::OnCanceled() { - navigation_controller_->CancelPendingReload(); + web_contents()->GetController().CancelPendingReload(); } -void RepostFormWarningController::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { +void RepostFormWarningController::BeforeFormRepostWarningShow() { // Close the dialog if we show an additional dialog, to avoid them // stacking up. - if (type == content::NOTIFICATION_REPOST_WARNING_SHOWN) - Cancel(); - else - TabModalConfirmDialogDelegate::Observe(type, source, details); + Cancel(); } |