summaryrefslogtreecommitdiffstats
path: root/chrome/browser/jsmessage_box_handler_win.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-25 01:54:03 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-25 01:54:03 +0000
commit67a54912d23c2a0c87065e9a876971fda54edf70 (patch)
tree0cb01248777f61bba238c52dc30152a0245174c1 /chrome/browser/jsmessage_box_handler_win.cc
parent8c414fb2b7a662540fb8f7f67802fec788347ac4 (diff)
downloadchromium_src-67a54912d23c2a0c87065e9a876971fda54edf70.zip
chromium_src-67a54912d23c2a0c87065e9a876971fda54edf70.tar.gz
chromium_src-67a54912d23c2a0c87065e9a876971fda54edf70.tar.bz2
AppModalDialogQueue shouldn't depend on views.
Add a simple test, too. Review URL: http://codereview.chromium.org/27080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jsmessage_box_handler_win.cc')
-rw-r--r--chrome/browser/jsmessage_box_handler_win.cc68
1 files changed, 40 insertions, 28 deletions
diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc
index 5026e8e..5add577 100644
--- a/chrome/browser/jsmessage_box_handler_win.cc
+++ b/chrome/browser/jsmessage_box_handler_win.cc
@@ -66,6 +66,45 @@ JavascriptMessageBoxHandler::~JavascriptMessageBoxHandler() {
}
//////////////////////////////////////////////////////////////////////////////
+// JavascriptMessageBoxHandler, views::AppModalDialogDelegate
+// implementation:
+
+void JavascriptMessageBoxHandler::ShowModalDialog() {
+ // If the WebContents that created this dialog navigated away before this
+ // dialog became visible, simply show the next dialog if any.
+ if (!web_contents_) {
+ AppModalDialogQueue::ShowNextDialog();
+ delete this;
+ return;
+ }
+
+ web_contents_->Activate();
+ HWND root_hwnd = GetAncestor(web_contents_->GetNativeView(), GA_ROOT);
+ dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this);
+ dialog_->Show();
+}
+
+void JavascriptMessageBoxHandler::ActivateModalDialog() {
+ // Ensure that the dialog is visible and at the top of the z-order. These
+ // conditions may not be true if the dialog was opened on a different virtual
+ // desktop to the one the browser window is on.
+ dialog_->Show();
+ dialog_->Activate();
+}
+
+AppModalDialogDelegateTesting*
+JavascriptMessageBoxHandler::GetTestingInterface() {
+ return this;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// JavascriptMessageBoxHandler, AppModalDialogDelegateTesting implementation:
+
+views::DialogDelegate* JavascriptMessageBoxHandler::GetDialogDelegate() {
+ return this;
+}
+
+//////////////////////////////////////////////////////////////////////////////
// JavascriptMessageBoxHandler, views::DialogDelegate implementation:
int JavascriptMessageBoxHandler::GetDialogButtons() const {
@@ -141,33 +180,6 @@ bool JavascriptMessageBoxHandler::Accept() {
return true;
}
-//////////////////////////////////////////////////////////////////////////////
-// JavascriptMessageBoxHandler, views::AppModalDialogDelegate
-// implementation:
-
-void JavascriptMessageBoxHandler::ShowModalDialog() {
- // If the WebContents that created this dialog navigated away before this
- // dialog became visible, simply show the next dialog if any.
- if (!web_contents_) {
- AppModalDialogQueue::ShowNextDialog();
- delete this;
- return;
- }
-
- web_contents_->Activate();
- HWND root_hwnd = GetAncestor(web_contents_->GetNativeView(), GA_ROOT);
- dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this);
- dialog_->Show();
-}
-
-void JavascriptMessageBoxHandler::ActivateModalDialog() {
- // Ensure that the dialog is visible and at the top of the z-order. These
- // conditions may not be true if the dialog was opened on a different virtual
- // desktop to the one the browser window is on.
- dialog_->Show();
- dialog_->Activate();
-}
-
///////////////////////////////////////////////////////////////////////////////
// JavascriptMessageBoxHandler, views::WindowDelegate implementation:
@@ -178,7 +190,7 @@ views::View* JavascriptMessageBoxHandler::GetContentsView() {
views::View* JavascriptMessageBoxHandler::GetInitiallyFocusedView() {
if (message_box_view_->text_box())
return message_box_view_->text_box();
- return views::AppModalDialogDelegate::GetInitiallyFocusedView();
+ return views::DialogDelegate::GetInitiallyFocusedView();
}
///////////////////////////////////////////////////////////////////////////////