Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc

Issue 7283022: Make a clean interface for dialog callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc
diff --git a/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc b/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc
index 257def3ab65ab1f41614bdb4c9994671115cca92..9c5465703bdb873e52161c51dfc0db6629bcda29 100644
--- a/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc
+++ b/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc
@@ -6,14 +6,15 @@
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
+#include "content/browser/javascript_dialogs.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_service.h"
#include "content/common/notification_type.h"
-AppModalDialog::AppModalDialog(TabContents* tab_contents,
+AppModalDialog::AppModalDialog(content::DialogDelegate* delegate,
const string16& title)
- : skip_this_dialog_(false),
- tab_contents_(tab_contents),
+ : valid_(true),
+ delegate_(delegate),
native_dialog_(NULL),
title_(title) {
}
@@ -22,8 +23,8 @@ AppModalDialog::~AppModalDialog() {
}
void AppModalDialog::ShowModalDialog() {
- if (tab_contents_)
- tab_contents_->Activate();
+ if (delegate_)
+ delegate_->OnDialogShown();
CreateAndShowDialog();
@@ -39,13 +40,21 @@ void AppModalDialog::CreateAndShowDialog() {
}
bool AppModalDialog::IsValid() {
- return !skip_this_dialog_;
+ return valid_;
+}
+
+void AppModalDialog::Invalidate() {
+ valid_ = false;
}
bool AppModalDialog::IsJavaScriptModalDialog() {
return false;
}
+content::DialogDelegate* AppModalDialog::delegate() const {
+ return delegate_;
+}
+
void AppModalDialog::ActivateModalDialog() {
DCHECK(native_dialog_);
native_dialog_->ActivateAppModalDialog();

Powered by Google App Engine
This is Rietveld 408576698