summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_modal_dialog_win.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 20:18:28 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 20:18:28 +0000
commit0bfa713f7ae0bd154e7a0246413561de64d8c84d (patch)
tree1eb0198e7a91815be2a8cc7007b53b11e241e6fe /chrome/browser/app_modal_dialog_win.cc
parent70771b35915b066928ac79c8a5ba4b950e4d74ec (diff)
downloadchromium_src-0bfa713f7ae0bd154e7a0246413561de64d8c84d.zip
chromium_src-0bfa713f7ae0bd154e7a0246413561de64d8c84d.tar.gz
chromium_src-0bfa713f7ae0bd154e7a0246413561de64d8c84d.tar.bz2
Refactor AppModalDialogQueue and move JS Alert boxes into a MVC.
JavascriptMessageBoxHandler (handles alert, confirm, prompt, and onbeforeunload) was a views class. This change converts it into an MVC so we can port to linux/mac. AppModalDialog is the model+controller, JavascriptMessageBoxDialog is the windows specific view. The onbeforeunload dialog (JavascriptBeforeUnloadHandler) was a subclass of JavascriptMessageBoxHandler that had a different title and button text. I merged this class into JavascriptMessageBoxHandler by passing a bool to handle the custom button text. Review URL: http://codereview.chromium.org/63033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_modal_dialog_win.cc')
-rw-r--r--chrome/browser/app_modal_dialog_win.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/app_modal_dialog_win.cc b/chrome/browser/app_modal_dialog_win.cc
new file mode 100644
index 0000000..ab01474
--- /dev/null
+++ b/chrome/browser/app_modal_dialog_win.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/app_modal_dialog.h"
+
+#include "base/logging.h"
+#include "chrome/browser/views/jsmessage_box_dialog.h"
+#include "chrome/views/window/window.h"
+
+AppModalDialog::~AppModalDialog() {
+}
+
+void AppModalDialog::CreateAndShowDialog() {
+ dialog_ = new JavascriptMessageBoxDialog(this, message_text_,
+ default_prompt_text_, display_suppress_checkbox_);
+ DCHECK(dialog_->IsModal());
+ dialog_->ShowModalDialog();
+}
+
+void AppModalDialog::ActivateModalDialog() {
+ dialog_->ActivateModalDialog();
+}
+
+void AppModalDialog::CloseModalDialog() {
+ dialog_->CloseModalDialog();
+}
+
+int AppModalDialog::GetDialogButtons() {
+ return dialog_->GetDialogButtons();
+}
+
+void AppModalDialog::AcceptWindow() {
+ views::DialogClientView* client_view =
+ dialog_->window()->GetClientView()->AsDialogClientView();
+ client_view->AcceptWindow();
+}
+
+void AppModalDialog::CancelWindow() {
+ views::DialogClientView* client_view =
+ dialog_->window()->GetClientView()->AsDialogClientView();
+ client_view->CancelWindow();
+}