summaryrefslogtreecommitdiffstats
path: root/ash/wm/event_client_impl.cc
blob: 58b4385f3de4ba622ef584c23335980deb467179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wm/event_client_impl.h"

#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"

namespace ash {
namespace internal {

EventClientImpl::EventClientImpl(aura::RootWindow* root_window)
    : root_window_(root_window) {
  aura::client::SetEventClient(root_window_, this);
}

EventClientImpl::~EventClientImpl() {
  aura::client::SetEventClient(root_window_, NULL);
}

bool EventClientImpl::CanProcessEventsWithinSubtree(
    const aura::Window* window) const {
  if (Shell::GetInstance()->IsScreenLocked()) {
    aura::Window* lock_screen_containers =
        Shell::GetInstance()->GetContainer(
            kShellWindowId_LockScreenContainersContainer);
    aura::Window* lock_screen_related_containers =
        Shell::GetInstance()->GetContainer(
            kShellWindowId_LockScreenRelatedContainersContainer);
    return lock_screen_containers->Contains(window) ||
        lock_screen_related_containers->Contains(window);
  }
  return true;
}

}  // namespace internal
}  // namespace ash