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

Side by Side Diff: ui/aura/event_filter.cc

Issue 8194004: change the way windows are parented when their parent is set to NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « ui/aura/desktop_delegate.h ('k') | ui/aura/test_desktop_delegate.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/aura/event_filter.h" 5 #include "ui/aura/event_filter.h"
6 6
7 #include "ui/aura/desktop.h" 7 #include "ui/aura/desktop.h"
8 #include "ui/aura/event.h" 8 #include "ui/aura/event.h"
9 #include "ui/aura/focus_manager.h" 9 #include "ui/aura/focus_manager.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 24 matching lines...) Expand all
35 void EventFilter::ActivateIfNecessary( 35 void EventFilter::ActivateIfNecessary(
36 Window* window, 36 Window* window,
37 MouseEvent* event) { 37 MouseEvent* event) {
38 // TODO(beng): some windows (e.g. disabled ones, tooltips, etc) may not be 38 // TODO(beng): some windows (e.g. disabled ones, tooltips, etc) may not be
39 // focusable. 39 // focusable.
40 40
41 Window* active_window = Desktop::GetInstance()->active_window(); 41 Window* active_window = Desktop::GetInstance()->active_window();
42 Window* toplevel_window = window; 42 Window* toplevel_window = window;
43 while (toplevel_window && toplevel_window != active_window && 43 while (toplevel_window && toplevel_window != active_window &&
44 toplevel_window->parent() && 44 toplevel_window->parent() &&
45 !toplevel_window->parent()->IsToplevelWindowContainer()) { 45 !toplevel_window->parent()->AsToplevelWindowContainer()) {
46 toplevel_window = toplevel_window->parent(); 46 toplevel_window = toplevel_window->parent();
47 } 47 }
48 if (toplevel_window == active_window) { 48 if (toplevel_window == active_window) {
49 // |window| is a descendant of the active window, no need to activate. 49 // |window| is a descendant of the active window, no need to activate.
50 window->GetFocusManager()->SetFocusedWindow(window); 50 window->GetFocusManager()->SetFocusedWindow(window);
51 return; 51 return;
52 } 52 }
53 if (!toplevel_window) { 53 if (!toplevel_window) {
54 // |window| is not in a top level window. 54 // |window| is not in a top level window.
55 return; 55 return;
56 } 56 }
57 if (!toplevel_window->delegate() || 57 if (!toplevel_window->delegate() ||
58 !toplevel_window->delegate()->ShouldActivate(event)) 58 !toplevel_window->delegate()->ShouldActivate(event))
59 return; 59 return;
60 60
61 Desktop::GetInstance()->SetActiveWindow(toplevel_window, window); 61 Desktop::GetInstance()->SetActiveWindow(toplevel_window, window);
62 } 62 }
63 63
64 } // namespace aura 64 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/desktop_delegate.h ('k') | ui/aura/test_desktop_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698