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