summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
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/automation
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/automation')
-rw-r--r--chrome/browser/automation/automation_provider.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 37e7b7e..2d73a9c 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -9,6 +9,7 @@
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/app_modal_dialog.h"
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/automation/url_request_failed_dns_job.h"
#include "chrome/browser/automation/url_request_mock_http_job.h"
@@ -43,7 +44,7 @@
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/views/bookmark_bar_view.h"
#include "chrome/browser/views/location_bar_view.h"
-#include "chrome/views/window/app_modal_dialog_delegate.h"
+#include "chrome/views/window/dialog_delegate.h"
#include "chrome/views/window/window.h"
#endif // defined(OS_WIN)
@@ -1227,8 +1228,7 @@ void AutomationProvider::GetBrowserWindowCount(int* window_count) {
// TODO(port): Enable when dialog delegate is ported.
void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog,
int* dialog_button) {
- views::AppModalDialogDelegate* dialog_delegate =
- AppModalDialogQueue::active_dialog();
+ AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog();
*showing_dialog = (dialog_delegate != NULL);
if (*showing_dialog)
*dialog_button = dialog_delegate->GetDialogButtons();
@@ -1239,21 +1239,18 @@ void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog,
void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) {
*success = false;
- views::AppModalDialogDelegate* dialog_delegate =
- AppModalDialogQueue::active_dialog();
+ AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog();
if (dialog_delegate &&
(dialog_delegate->GetDialogButtons() & button) == button) {
- views::DialogClientView* client_view =
- dialog_delegate->window()->GetClientView()->AsDialogClientView();
if ((button & views::DialogDelegate::DIALOGBUTTON_OK) ==
views::DialogDelegate::DIALOGBUTTON_OK) {
- client_view->AcceptWindow();
+ dialog_delegate->AcceptWindow();
*success = true;
}
if ((button & views::DialogDelegate::DIALOGBUTTON_CANCEL) ==
views::DialogDelegate::DIALOGBUTTON_CANCEL) {
DCHECK(!*success) << "invalid param, OK and CANCEL specified";
- client_view->CancelWindow();
+ dialog_delegate->CancelWindow();
*success = true;
}
}