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_state_delegate.h"
9 #include "ash/shell_window_ids.h"
10 #include "ui/aura/window.h"
11 #include "ui/keyboard/keyboard_util.h"
16 EventClientImpl::EventClientImpl() {
19 EventClientImpl::~EventClientImpl() {
22 bool EventClientImpl::CanProcessEventsWithinSubtree(
23 const aura::Window
* window
) const {
24 const aura::RootWindow
* root_window
= window
? window
->GetRootWindow() : NULL
;
26 !Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) {
30 const aura::Window
* lock_screen_containers
= Shell::GetContainer(
32 kShellWindowId_LockScreenContainersContainer
);
33 const aura::Window
* lock_background_containers
= Shell::GetContainer(
35 kShellWindowId_LockScreenBackgroundContainer
);
36 const aura::Window
* lock_screen_related_containers
= Shell::GetContainer(
38 kShellWindowId_LockScreenRelatedContainersContainer
);
39 bool can_process_events
= (window
->Contains(lock_screen_containers
) &&
40 window
->Contains(lock_background_containers
) &&
41 window
->Contains(lock_screen_related_containers
)) ||
42 lock_screen_containers
->Contains(window
) ||
43 lock_background_containers
->Contains(window
) ||
44 lock_screen_related_containers
->Contains(window
);
45 if (keyboard::IsKeyboardEnabled()) {
46 const aura::Window
* virtual_keyboard_container
= Shell::GetContainer(
48 kShellWindowId_VirtualKeyboardContainer
);
49 can_process_events
|= (window
->Contains(virtual_keyboard_container
) ||
50 virtual_keyboard_container
->Contains(window
));
52 return can_process_events
;
55 ui::EventTarget
* EventClientImpl::GetToplevelEventTarget() {
56 return Shell::GetInstance();
59 } // namespace internal