Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: ui/views/corewm/focus_controller.cc

Issue 14298013: Check focusability in WindowFocusedFromInputEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update FocusController tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/window_manager_unittest.cc ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/corewm/focus_controller.h" 5 #include "ui/views/corewm/focus_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "ui/aura/client/activation_change_observer.h" 8 #include "ui/aura/client/activation_change_observer.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/capture_client.h" 10 #include "ui/aura/client/capture_client.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 SetActiveWindow(next_activatable); 329 SetActiveWindow(next_activatable);
330 if (!(active_window_ && active_window_->Contains(focused_window_))) 330 if (!(active_window_ && active_window_->Contains(focused_window_)))
331 SetFocusedWindow(next_activatable); 331 SetFocusedWindow(next_activatable);
332 } else if (window->Contains(focused_window_)) { 332 } else if (window->Contains(focused_window_)) {
333 // Active window isn't changing, but focused window might be. 333 // Active window isn't changing, but focused window might be.
334 SetFocusedWindow(rules_->GetFocusableWindow(next)); 334 SetFocusedWindow(rules_->GetFocusableWindow(next));
335 } 335 }
336 } 336 }
337 337
338 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { 338 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) {
339 FocusWindow(window); 339 // Only focus |window| if it or any of its parents can be focused. Otherwise
340 // FocusWindow() will focus the topmost window, which may not be the
341 // currently focused one.
342 if (rules_->CanFocusWindow(GetToplevelWindow(window)))
343 FocusWindow(window);
340 } 344 }
341 345
342 } // namespace corewm 346 } // namespace corewm
343 } // namespace views 347 } // namespace views
OLDNEW
« no previous file with comments | « ash/wm/window_manager_unittest.cc ('k') | ui/views/corewm/focus_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698