From 160ad3d101988b9d842fef8b18cc49c54c9a1de5 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Tue, 28 Sep 2010 15:40:20 +0000 Subject: Refactor AppModalDialog to more clearly isolate platform specific UI pieces and eliminate the dependency on individual frontends from cross platform code. BUG=none TEST=none Review URL: http://codereview.chromium.org/3398015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60785 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/app_modal_dialog.cc | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'chrome/browser/app_modal_dialog.cc') diff --git a/chrome/browser/app_modal_dialog.cc b/chrome/browser/app_modal_dialog.cc index 09d1f33..506d76f 100644 --- a/chrome/browser/app_modal_dialog.cc +++ b/chrome/browser/app_modal_dialog.cc @@ -5,20 +5,20 @@ #include "chrome/browser/app_modal_dialog.h" #include "chrome/browser/app_modal_dialog_queue.h" +#include "chrome/browser/native_app_modal_dialog.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" AppModalDialog::AppModalDialog(TabContents* tab_contents, const std::wstring& title) -#if defined(OS_WIN) || defined(OS_LINUX) - : dialog_(NULL), -#elif defined(OS_MACOSX) - : -#endif + : skip_this_dialog_(false), tab_contents_(tab_contents), - title_(title), - skip_this_dialog_(false) { + native_dialog_(NULL), + title_(title) { +} + +AppModalDialog::~AppModalDialog() { } void AppModalDialog::ShowModalDialog() { @@ -33,11 +33,19 @@ void AppModalDialog::ShowModalDialog() { NotificationService::NoDetails()); } -void AppModalDialog::Cleanup() { - NotificationService::current()->Notify( - NotificationType::APP_MODAL_DIALOG_CLOSED, - Source(this), - NotificationService::NoDetails()); +void AppModalDialog::CreateAndShowDialog() { + native_dialog_ = CreateNativeDialog(); + native_dialog_->ShowAppModalDialog(); +} + +void AppModalDialog::ActivateModalDialog() { + DCHECK(native_dialog_); + native_dialog_->ActivateAppModalDialog(); +} + +void AppModalDialog::CloseModalDialog() { + DCHECK(native_dialog_); + native_dialog_->CloseAppModalDialog(); } void AppModalDialog::CompleteDialog() { -- cgit v1.1