summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 19:22:03 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 19:22:03 +0000
commitcbea91afd0211e678248c910cb5fc719e8573029 (patch)
tree5e4bda7aa673ac38dd7cbae6b335633e71890892 /chrome/browser
parent18662b90ae6caf7c9798b3b621f7e7ebd01558e8 (diff)
downloadchromium_src-cbea91afd0211e678248c910cb5fc719e8573029.zip
chromium_src-cbea91afd0211e678248c910cb5fc719e8573029.tar.gz
chromium_src-cbea91afd0211e678248c910cb5fc719e8573029.tar.bz2
Initial focus fix on x11/gtk
The initial focus on x11/gtk was not working propertly. It was jsut working by coincident, and chromeos's compact location bar revealed the bug. This CL fixes by setting a focus when the window itself gets focus. BUG=34159 TEST=on chromeos build, omnibox should have a focus on a new window. Review URL: http://codereview.chromium.org/756002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.cc4
-rw-r--r--chrome/browser/views/frame/browser_frame_gtk.h1
-rw-r--r--chrome/browser/views/frame/browser_view.cc10
-rw-r--r--chrome/browser/views/frame/browser_view.h4
4 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/views/frame/browser_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc
index 25303f6..9e1699c 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.cc
+++ b/chrome/browser/views/frame/browser_frame_gtk.cc
@@ -158,6 +158,10 @@ void BrowserFrameGtk::IsActiveChanged() {
views::WidgetGtk::IsActiveChanged();
}
+void BrowserFrameGtk::SetInitialFocus() {
+ browser_view_->RestoreFocus();
+}
+
bool BrowserFrameGtk::GetAccelerator(int cmd_id,
menus::Accelerator* accelerator) {
return browser_view_->GetAccelerator(cmd_id, accelerator);
diff --git a/chrome/browser/views/frame/browser_frame_gtk.h b/chrome/browser/views/frame/browser_frame_gtk.h
index 5ccda8e..93330c1 100644
--- a/chrome/browser/views/frame/browser_frame_gtk.h
+++ b/chrome/browser/views/frame/browser_frame_gtk.h
@@ -42,6 +42,7 @@ class BrowserFrameGtk : public BrowserFrame,
virtual ThemeProvider* GetThemeProvider() const;
virtual ThemeProvider* GetDefaultThemeProvider() const;
virtual void IsActiveChanged();
+ virtual void SetInitialFocus();
protected:
void set_browser_frame_view(BrowserNonClientFrameView* browser_frame_view) {
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 87264f4..232d99f 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -676,9 +676,7 @@ void BrowserView::Show() {
//
// If we do find there are cases where we need to restore the focus on show,
// that should be added and this should be removed.
- TabContents* selected_tab_contents = GetSelectedTabContents();
- if (selected_tab_contents)
- selected_tab_contents->view()->RestoreFocus();
+ RestoreFocus();
// Restore split offset.
int split_offset = g_browser_process->local_state()->GetInteger(
@@ -842,6 +840,12 @@ void BrowserView::FullScreenStateChanged() {
ProcessFullscreen(IsFullscreen());
}
+void BrowserView::RestoreFocus() {
+ TabContents* selected_tab_contents = GetSelectedTabContents();
+ if (selected_tab_contents)
+ selected_tab_contents->view()->RestoreFocus();
+}
+
LocationBar* BrowserView::GetLocationBar() const {
return toolbar_->location_bar();
}
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 1cdca86a..e811334 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -234,6 +234,10 @@ class BrowserView : public BrowserBubbleHost,
// used on Linux.
void FullScreenStateChanged();
+ // Restores the focused view. This is also used to set the initial focus
+ // when a new browser window is created.
+ void RestoreFocus();
+
// Called when the activation of the frame changes.
virtual void ActivationChanged(bool activated);