diff options
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 11 | ||||
-rw-r--r-- | chrome/views/base_button.cc | 3 | ||||
-rw-r--r-- | chrome/views/menu_button.cc | 3 | ||||
-rw-r--r-- | chrome/views/native_button.cc | 3 | ||||
-rw-r--r-- | chrome/views/view.cc | 3 |
5 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 7a9124f..c928031 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -391,12 +391,15 @@ void TabContents::RestoreFocus() { // If you hit this DCHECK, please report it to Jay (jcampan). DCHECK(focus_manager != NULL) << "No focus manager when restoring focus."; - if (focus_manager && focus_manager->ContainsView(last_focused_view)) { + if (last_focused_view->IsFocusable() && focus_manager && + focus_manager->ContainsView(last_focused_view)) { last_focused_view->RequestFocus(); } else { - // The focused view may not belong to the same window hierarchy (for - // example if the location bar was focused and the tab is dragged out). - // In that case we default to the default focus. + // The focused view may not belong to the same window hierarchy (e.g. + // if the location bar was focused and the tab is dragged out), or it may + // no longer be focusable (e.g. if the location bar was focused and then + // we switched to fullscreen mode). In that case we default to the + // default focus. SetInitialFocus(); } view_storage->RemoveView(last_focused_view_storage_id_); diff --git a/chrome/views/base_button.cc b/chrome/views/base_button.cc index bd4987b..bea0c2f 100644 --- a/chrome/views/base_button.cc +++ b/chrome/views/base_button.cc @@ -147,8 +147,7 @@ bool BaseButton::OnMousePressed(const MouseEvent& e) { if (IsTriggerableEvent(e) && HitTest(e.location())) { SetState(BS_PUSHED); } - if (IsFocusable()) - RequestFocus(); + RequestFocus(); } return true; } diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc index 0b696ff..ff0400a 100644 --- a/chrome/views/menu_button.cc +++ b/chrome/views/menu_button.cc @@ -180,8 +180,7 @@ bool MenuButton::Activate() { } bool MenuButton::OnMousePressed(const MouseEvent& e) { - if (IsFocusable()) - RequestFocus(); + RequestFocus(); if (GetState() != BS_DISABLED) { // If we're draggable (GetDragOperations returns a non-zero value), then // don't pop on press, instead wait for release. diff --git a/chrome/views/native_button.cc b/chrome/views/native_button.cc index 00aea52..d6db326 100644 --- a/chrome/views/native_button.cc +++ b/chrome/views/native_button.cc @@ -191,8 +191,7 @@ void NativeButton::Init(const std::wstring& label, bool is_default) { void NativeButton::Clicked() { DCHECK(enabled_); // Give the focus to the button. - if (IsFocusable()) - RequestFocus(); + RequestFocus(); if (listener_) listener_->ButtonPressed(this); diff --git a/chrome/views/view.cc b/chrome/views/view.cc index 3a06c3b..59e5b73 100644 --- a/chrome/views/view.cc +++ b/chrome/views/view.cc @@ -1372,9 +1372,8 @@ bool View::IsVisibleInRootView() const { void View::RequestFocus() { RootView* rv = GetRootView(); - if (rv) { + if (rv && IsFocusable()) rv->FocusView(this); - } } void View::WillGainFocus() { |