summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-18 01:24:40 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-18 01:24:40 +0000
commitc9c15fb67097226b7ffbc754da2e8ff11423916c (patch)
tree25252d17042802e0b37b77474bbc366fec31f987 /chrome/browser
parent1e536c4dbc375cef63597bdaa79bd70d38feb766 (diff)
downloadchromium_src-c9c15fb67097226b7ffbc754da2e8ff11423916c.zip
chromium_src-c9c15fb67097226b7ffbc754da2e8ff11423916c.tar.gz
chromium_src-c9c15fb67097226b7ffbc754da2e8ff11423916c.tar.bz2
Make sure the text field is focused when doing a JavaScript prompt (which shows an alert box with a text field in it).
BUG=5333 TEST=Load a page that does a prompt("Hello", "World"). It should open an alert box with a text field with the contents 'World'. The text should be selected and the text field should have focus. Make sure alert() and confirm() still have the OK button focused when used. Review URL: http://codereview.chromium.org/15023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/jsmessage_box_handler.cc6
-rw-r--r--chrome/browser/jsmessage_box_handler.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index e161d14..b86920b 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -152,6 +152,12 @@ views::View* JavascriptMessageBoxHandler::GetContentsView() {
return message_box_view_;
}
+views::View* JavascriptMessageBoxHandler::GetInitiallyFocusedView() const {
+ if (message_box_view_->text_box())
+ return message_box_view_->text_box();
+ return views::AppModalDialogDelegate::GetInitiallyFocusedView();
+}
+
///////////////////////////////////////////////////////////////////////////////
// JavascriptMessageBoxHandler, private:
diff --git a/chrome/browser/jsmessage_box_handler.h b/chrome/browser/jsmessage_box_handler.h
index 0c66c89..6873605 100644
--- a/chrome/browser/jsmessage_box_handler.h
+++ b/chrome/browser/jsmessage_box_handler.h
@@ -47,6 +47,7 @@ class JavascriptMessageBoxHandler
// views::WindowDelegate Methods:
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView();
+ virtual views::View* GetInitiallyFocusedView() const;
protected:
// Use RunJavaScriptMessageBox to use.