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. 4 5 #include "ash/wm/system_modal_container_event_filter.h" 6 7 #include "ash/wm/system_modal_container_event_filter_delegate.h" 8 #include "ui/aura/window.h" 9 #include "ui/base/events/event.h" 10 11 namespace ash { 12 namespace internal { 13 14 SystemModalContainerEventFilter::SystemModalContainerEventFilter( 15 SystemModalContainerEventFilterDelegate* delegate) 16 : delegate_(delegate) { 17 } 18 19 SystemModalContainerEventFilter::~SystemModalContainerEventFilter() { 20 } 21 22 void SystemModalContainerEventFilter::OnKeyEvent(ui::KeyEvent* event) { 23 aura::Window* target = static_cast<aura::Window*>(event->target()); 24 if (!delegate_->CanWindowReceiveEvents(target)) 25 event->StopPropagation(); 26 } 27 28 void SystemModalContainerEventFilter::OnMouseEvent( 29 ui::MouseEvent* event) { 30 aura::Window* target = static_cast<aura::Window*>(event->target()); 31 if (!delegate_->CanWindowReceiveEvents(target)) 32 event->StopPropagation(); 33 } 34 35 } // namespace internal 36 } // namespace ash 37