Index: ui/views/focus/focus_manager.cc |
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc |
index 24baff18ba28ad04ee6b6b64ba5b5298d7f46a0b..149934dfb33ef2ce7e8d3713884075ba2c763e58 100644 |
--- a/ui/views/focus/focus_manager.cc |
+++ b/ui/views/focus/focus_manager.cc |
@@ -249,7 +249,10 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view, |
void FocusManager::SetFocusedViewWithReason( |
View* view, FocusChangeReason reason) { |
- if (focused_view_ == view) |
+ // Force a focus update on kReasonFocusRestore, even if the view is focused. |
+ // This is needed to restore focus to a child HWND when its top-level window |
+ // is restored from the minimized state. See http://crbug.com/125976 |
+ if (focused_view_ == view && reason != kReasonFocusRestore) |
return; |
base::AutoReset<bool> auto_changing_focus(&is_changing_focus_, true); |
@@ -320,22 +323,8 @@ bool FocusManager::RestoreFocusedView() { |
View* view = view_storage->RetrieveView(stored_focused_view_storage_id_); |
if (view) { |
- if (ContainsView(view)) { |
- if (!view->IsFocusable() && view->IsAccessibilityFocusable()) { |
- // RequestFocus would fail, but we want to restore focus to controls |
- // that had focus in accessibility mode. |
- SetFocusedViewWithReason(view, kReasonFocusRestore); |
- } else { |
- // This usually just sets the focus if this view is focusable, but |
- // let the view override RequestFocus if necessary. |
- view->RequestFocus(); |
- |
- // If it succeeded, the reason would be incorrect; set it to |
- // focus restore. |
- if (focused_view_ == view) |
- focus_change_reason_ = kReasonFocusRestore; |
- } |
- } |
+ if (ContainsView(view)) |
+ SetFocusedViewWithReason(view, kReasonFocusRestore); |
return true; |
} |
return false; |