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.
5 #include "ash/wm/event_client_impl.h"
7 #include "ash/session/session_state_delegate.h"
9 #include "ash/shell_window_ids.h"
10 #include "ui/aura/window.h"
11 #include "ui/keyboard/keyboard_util.h"
15 EventClientImpl::EventClientImpl() {
18 EventClientImpl::~EventClientImpl() {
21 bool EventClientImpl::CanProcessEventsWithinSubtree(
22 const aura::Window
* window
) const {
23 const aura::Window
* root_window
= window
? window
->GetRootWindow() : NULL
;
25 !Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) {
29 const aura::Window
* lock_screen_containers
= Shell::GetContainer(
31 kShellWindowId_LockScreenContainersContainer
);
32 const aura::Window
* lock_background_containers
= Shell::GetContainer(
34 kShellWindowId_LockScreenBackgroundContainer
);
35 const aura::Window
* lock_screen_related_containers
= Shell::GetContainer(
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(
47 kShellWindowId_VirtualKeyboardContainer
);
48 can_process_events
|= (window
->Contains(virtual_keyboard_container
) ||
49 virtual_keyboard_container
->Contains(window
));
51 return can_process_events
;
54 ui::EventTarget
* EventClientImpl::GetToplevelEventTarget() {
55 return Shell::GetInstance();