diff options
Diffstat (limited to 'chromium/ash/wm/system_modal_container_event_filter.cc')
-rw-r--r-- | chromium/ash/wm/system_modal_container_event_filter.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chromium/ash/wm/system_modal_container_event_filter.cc b/chromium/ash/wm/system_modal_container_event_filter.cc new file mode 100644 index 00000000000..532bb44acd6 --- /dev/null +++ b/chromium/ash/wm/system_modal_container_event_filter.cc @@ -0,0 +1,36 @@ +// 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/system_modal_container_event_filter.h" + +#include "ash/wm/system_modal_container_event_filter_delegate.h" +#include "ui/aura/window.h" +#include "ui/base/events/event.h" + +namespace ash { +namespace internal { + +SystemModalContainerEventFilter::SystemModalContainerEventFilter( + SystemModalContainerEventFilterDelegate* delegate) + : delegate_(delegate) { +} + +SystemModalContainerEventFilter::~SystemModalContainerEventFilter() { +} + +void SystemModalContainerEventFilter::OnKeyEvent(ui::KeyEvent* event) { + aura::Window* target = static_cast<aura::Window*>(event->target()); + if (!delegate_->CanWindowReceiveEvents(target)) + event->StopPropagation(); +} + +void SystemModalContainerEventFilter::OnMouseEvent( + ui::MouseEvent* event) { + aura::Window* target = static_cast<aura::Window*>(event->target()); + if (!delegate_->CanWindowReceiveEvents(target)) + event->StopPropagation(); +} + +} // namespace internal +} // namespace ash |