| Index: ui/views/focus/focus_manager.cc
|
| diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
|
| index b482dbe5128b40112ffb0572db11f019d819834f..3a045cb0cd729999245046b63cedb06cf321d4c1 100644
|
| --- a/ui/views/focus/focus_manager.cc
|
| +++ b/ui/views/focus/focus_manager.cc
|
| @@ -301,9 +301,6 @@ void FocusManager::SetFocusedViewWithReason(
|
| View* view, FocusChangeReason reason) {
|
| if (focused_view_ == view)
|
| return;
|
| - // TODO(oshima|achuith): This is to diagnose crbug.com/687232.
|
| - // Change this to DCHECK once it's resolved.
|
| - CHECK(!view || ContainsView(view));
|
|
|
| #if !defined(OS_MACOSX)
|
| // TODO(warx): There are some AccessiblePaneViewTest failed on macosx.
|
| @@ -327,15 +324,26 @@ void FocusManager::SetFocusedViewWithReason(
|
| observer.OnWillChangeFocus(focused_view_, view);
|
|
|
| View* old_focused_view = focused_view_;
|
| - focused_view_ = view;
|
| +
|
| + bool focused_view_on_other_widget = view && !ContainsView(view);
|
| + if (focused_view_on_other_widget) {
|
| + focused_view_ = nullptr;
|
| + } else {
|
| + focused_view_ = view;
|
| + }
|
| if (old_focused_view)
|
| old_focused_view->Blur();
|
| // Also make |focused_view_| the stored focus view. This way the stored focus
|
| // view is remembered if focus changes are requested prior to a show or while
|
| // hidden.
|
| - SetStoredFocusView(focused_view_);
|
| - if (focused_view_)
|
| + if (!focused_view_on_other_widget) {
|
| + SetStoredFocusView(focused_view_);
|
| + }
|
| + if (focused_view_) {
|
| focused_view_->Focus();
|
| + } else if (view) {
|
| + view->RequestFocus();
|
| + }
|
|
|
| for (FocusChangeListener& observer : focus_change_listeners_)
|
| observer.OnDidChangeFocus(old_focused_view, focused_view_);
|
|
|