blob: c8400cfb663fc7c3047d298a415e758f40a58c74 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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/system_modal_container_event_filter.h"
6
7#include "ash/wm/system_modal_container_event_filter_delegate.h"
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +00008#include "ui/aura/window.h"
Torne (Richard Coles)d0247b12013-09-19 22:36:51 +01009#include "ui/events/event.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000010
11namespace ash {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000012
13SystemModalContainerEventFilter::SystemModalContainerEventFilter(
14 SystemModalContainerEventFilterDelegate* delegate)
15 : delegate_(delegate) {
16}
17
18SystemModalContainerEventFilter::~SystemModalContainerEventFilter() {
19}
20
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000021void SystemModalContainerEventFilter::OnKeyEvent(ui::KeyEvent* event) {
22 aura::Window* target = static_cast<aura::Window*>(event->target());
23 if (!delegate_->CanWindowReceiveEvents(target))
24 event->StopPropagation();
Torne (Richard Coles)58218062012-11-14 11:43:16 +000025}
26
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000027void SystemModalContainerEventFilter::OnMouseEvent(
Torne (Richard Coles)58218062012-11-14 11:43:16 +000028 ui::MouseEvent* event) {
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000029 aura::Window* target = static_cast<aura::Window*>(event->target());
30 if (!delegate_->CanWindowReceiveEvents(target))
31 event->StopPropagation();
Torne (Richard Coles)58218062012-11-14 11:43:16 +000032}
33
Torne (Richard Coles)58218062012-11-14 11:43:16 +000034} // namespace ash