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