summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 00:46:20 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 00:46:20 +0000
commit1d80250af1a1959e739cc02a13576401b5f113f5 (patch)
treeb3397de1f1175aae3b27b9dc75aa99f92c31502c /chrome/views
parent9ef017bc62963d792e42868576837129d71354f8 (diff)
downloadchromium_src-1d80250af1a1959e739cc02a13576401b5f113f5.zip
chromium_src-1d80250af1a1959e739cc02a13576401b5f113f5.tar.gz
chromium_src-1d80250af1a1959e739cc02a13576401b5f113f5.tar.bz2
HtmlDialogs had focus problems.
They would not be focused when shown and tab traversal was not working. This was caused by several issues: - HWNDView was not focusing its HWND when focused through the View::RequestFocus() method (it would rely on the default view behavior which is to focus the root view HWND), so it would not be focused by default. - DOMView (parent of HtmlDialogView) was not focusable so would not get the focus when pressing tab. - DOMView was not eating tab keys events (by returning false in View::CanProcessTabKeyEvents()), so the render view would not get the tab key press messages (for focus traversal in the render view). Note: most of the file changes in this CL are just the consequence of changing the constness of the WindowDelegate::GetInitiallyFocusedView method. BUG=6859 TEST=Open a web page, from the page menu, select the "Create application shortcut..." menu. In the dialog, press the TAB key, focus should alternate between the different fields Review URL: http://codereview.chromium.org/21439 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/dialog_delegate.cc2
-rw-r--r--chrome/views/dialog_delegate.h2
-rw-r--r--chrome/views/hwnd_view.cc4
-rw-r--r--chrome/views/hwnd_view.h2
-rw-r--r--chrome/views/window_delegate.h2
5 files changed, 9 insertions, 3 deletions
diff --git a/chrome/views/dialog_delegate.cc b/chrome/views/dialog_delegate.cc
index 8c63340..42aaafc 100644
--- a/chrome/views/dialog_delegate.cc
+++ b/chrome/views/dialog_delegate.cc
@@ -18,7 +18,7 @@ int DialogDelegate::GetDefaultDialogButton() const {
return DIALOGBUTTON_NONE;
}
-View* DialogDelegate::GetInitiallyFocusedView() const {
+View* DialogDelegate::GetInitiallyFocusedView() {
// Focus the default button if any.
DialogClientView* dcv = GetDialogClientView();
int default_button = GetDefaultDialogButton();
diff --git a/chrome/views/dialog_delegate.h b/chrome/views/dialog_delegate.h
index a8b72e0f..d077e60 100644
--- a/chrome/views/dialog_delegate.h
+++ b/chrome/views/dialog_delegate.h
@@ -96,7 +96,7 @@ class DialogDelegate : public WindowDelegate {
virtual bool Accept() { return true; }
// Overridden from WindowDelegate:
- virtual View* GetInitiallyFocusedView() const;
+ virtual View* GetInitiallyFocusedView();
// Overridden from WindowDelegate:
virtual ClientView* CreateClientView(Window* window);
diff --git a/chrome/views/hwnd_view.cc b/chrome/views/hwnd_view.cc
index 55786b6..e812a06 100644
--- a/chrome/views/hwnd_view.cc
+++ b/chrome/views/hwnd_view.cc
@@ -171,6 +171,10 @@ void HWNDView::VisibleBoundsInRootChanged() {
UpdateHWNDBounds();
}
+void HWNDView::Focus() {
+ ::SetFocus(hwnd_);
+}
+
void HWNDView::Paint(ChromeCanvas* canvas) {
// The area behind our window is black, so during a fast resize (where our
// content doesn't draw over the full size of our HWND, and the HWND
diff --git a/chrome/views/hwnd_view.h b/chrome/views/hwnd_view.h
index 701d228..ae33d0f 100644
--- a/chrome/views/hwnd_view.h
+++ b/chrome/views/hwnd_view.h
@@ -69,6 +69,8 @@ class HWNDView : public View {
// Notification that our visible bounds relative to the root has changed.
// This updates the bounds of the HWND.
virtual void VisibleBoundsInRootChanged();
+
+ virtual void Focus();
private:
// The hosted window handle.
diff --git a/chrome/views/window_delegate.h b/chrome/views/window_delegate.h
index d10dbf6..4c496bb 100644
--- a/chrome/views/window_delegate.h
+++ b/chrome/views/window_delegate.h
@@ -80,7 +80,7 @@ class WindowDelegate {
// Returns the view that should have the focus when the dialog is opened. If
// NULL no view is focused.
- virtual View* GetInitiallyFocusedView() const { return NULL; }
+ virtual View* GetInitiallyFocusedView() { return NULL; }
// Returns true if the window should show a title in the title bar.
virtual bool ShouldShowWindowTitle() const {