OLD | NEW |
---|---|
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 "ash/wm/event_client_impl.h" | 5 #include "ash/wm/event_client_impl.h" |
6 | 6 |
7 #include "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 #include "ui/keyboard/keyboard_util.h" | |
11 | 12 |
12 namespace ash { | 13 namespace ash { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 EventClientImpl::EventClientImpl() { | 16 EventClientImpl::EventClientImpl() { |
16 } | 17 } |
17 | 18 |
18 EventClientImpl::~EventClientImpl() { | 19 EventClientImpl::~EventClientImpl() { |
19 } | 20 } |
20 | 21 |
21 bool EventClientImpl::CanProcessEventsWithinSubtree( | 22 bool EventClientImpl::CanProcessEventsWithinSubtree( |
22 const aura::Window* window) const { | 23 const aura::Window* window) const { |
23 const aura::RootWindow* root_window = window ? window->GetRootWindow() : NULL; | 24 const aura::RootWindow* root_window = window ? window->GetRootWindow() : NULL; |
24 if (!root_window) | 25 if (!root_window) |
25 return true; | 26 return true; |
26 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) { | 27 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) { |
James Cook
2013/08/08 17:29:44
nit: this function might be clearer with an early
bshe
2013/08/08 19:39:24
Merged !root_window and !IsUserSessionBlocked to e
| |
27 const aura::Window* lock_screen_containers = Shell::GetContainer( | 28 const aura::Window* lock_screen_containers = Shell::GetContainer( |
28 root_window, | 29 root_window, |
29 kShellWindowId_LockScreenContainersContainer); | 30 kShellWindowId_LockScreenContainersContainer); |
30 const aura::Window* lock_background_containers = Shell::GetContainer( | 31 const aura::Window* lock_background_containers = Shell::GetContainer( |
31 root_window, | 32 root_window, |
32 kShellWindowId_LockScreenBackgroundContainer); | 33 kShellWindowId_LockScreenBackgroundContainer); |
33 const aura::Window* lock_screen_related_containers = Shell::GetContainer( | 34 const aura::Window* lock_screen_related_containers = Shell::GetContainer( |
34 root_window, | 35 root_window, |
35 kShellWindowId_LockScreenRelatedContainersContainer); | 36 kShellWindowId_LockScreenRelatedContainersContainer); |
36 return (window->Contains(lock_screen_containers) && | 37 bool can_process_events = (window->Contains(lock_screen_containers) && |
37 window->Contains(lock_background_containers) && | 38 window->Contains(lock_background_containers) && |
38 window->Contains(lock_screen_related_containers)) || | 39 window->Contains(lock_screen_related_containers)) || |
39 lock_screen_containers->Contains(window) || | 40 lock_screen_containers->Contains(window) || |
40 lock_background_containers->Contains(window) || | 41 lock_background_containers->Contains(window) || |
41 lock_screen_related_containers->Contains(window); | 42 lock_screen_related_containers->Contains(window); |
43 if (keyboard::IsKeyboardEnabled()) { | |
44 const aura::Window* virtual_keyboard_container = Shell::GetContainer( | |
45 root_window, | |
46 kShellWindowId_VirtualKeyboardContainer); | |
47 can_process_events |= (window->Contains(virtual_keyboard_container) || | |
48 virtual_keyboard_container->Contains(window)); | |
49 } | |
50 return can_process_events; | |
42 } | 51 } |
43 return true; | 52 return true; |
44 } | 53 } |
45 | 54 |
46 ui::EventTarget* EventClientImpl::GetToplevelEventTarget() { | 55 ui::EventTarget* EventClientImpl::GetToplevelEventTarget() { |
47 return Shell::GetInstance(); | 56 return Shell::GetInstance(); |
48 } | 57 } |
49 | 58 |
50 } // namespace internal | 59 } // namespace internal |
51 } // namespace ash | 60 } // namespace ash |
OLD | NEW |