| Index: components/mus/ws/window_server.cc
|
| diff --git a/components/mus/ws/window_server.cc b/components/mus/ws/window_server.cc
|
| index 14e2c9af87eedefd77ecc5e1c31456d03acc98e7..c5195aa31345c48b6578dc98c9f71ab4830d35c9 100644
|
| --- a/components/mus/ws/window_server.cc
|
| +++ b/components/mus/ws/window_server.cc
|
| @@ -237,7 +237,7 @@ void WindowServer::OnFirstWindowManagerFactorySet() {
|
| delegate_->CreateDefaultDisplays();
|
| }
|
|
|
| -void WindowServer::SetFocusedWindow(ServerWindow* window) {
|
| +bool WindowServer::SetFocusedWindow(ServerWindow* window) {
|
| // TODO(sky): this should fail if there is modal dialog active and |window|
|
| // is outside that.
|
| ServerWindow* currently_focused = GetFocusedWindow();
|
| @@ -245,21 +245,21 @@ void WindowServer::SetFocusedWindow(ServerWindow* window) {
|
| currently_focused
|
| ? display_manager_->GetDisplayContaining(currently_focused)
|
| : nullptr;
|
| - if (!window) {
|
| - if (focused_display)
|
| - focused_display->SetFocusedWindow(nullptr);
|
| - return;
|
| - }
|
| + if (!window)
|
| + return focused_display ? focused_display->SetFocusedWindow(nullptr) : true;
|
| +
|
| Display* display = display_manager_->GetDisplayContaining(window);
|
| DCHECK(display); // It's assumed callers do validation before calling this.
|
| - display->SetFocusedWindow(window);
|
| + const bool result = display->SetFocusedWindow(window);
|
| // If the focus actually changed, and focus was in another display, then we
|
| // need to notify the previously focused display so that it cleans up state
|
| // and notifies appropriately.
|
| - if (window && display->GetFocusedWindow() && display != focused_display &&
|
| + if (result && display->GetFocusedWindow() && display != focused_display &&
|
| focused_display) {
|
| - focused_display->SetFocusedWindow(nullptr);
|
| + const bool cleared_focus = focused_display->SetFocusedWindow(nullptr);
|
| + DCHECK(cleared_focus);
|
| }
|
| + return result;
|
| }
|
|
|
| ServerWindow* WindowServer::GetFocusedWindow() {
|
|
|