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