Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 8 | #include "ui/aura/window.h" |
Torne (Richard Coles) | d0247b1 | 2013-09-19 22:36:51 +0100 | [diff] [blame] | 9 | #include "ui/events/event.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 10 | |
| 11 | namespace ash { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 12 | |
| 13 | SystemModalContainerEventFilter::SystemModalContainerEventFilter( |
| 14 | SystemModalContainerEventFilterDelegate* delegate) |
| 15 | : delegate_(delegate) { |
| 16 | } |
| 17 | |
| 18 | SystemModalContainerEventFilter::~SystemModalContainerEventFilter() { |
| 19 | } |
| 20 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 21 | void 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) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 25 | } |
| 26 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 27 | void SystemModalContainerEventFilter::OnMouseEvent( |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 28 | ui::MouseEvent* event) { |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 29 | aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 30 | if (!delegate_->CanWindowReceiveEvents(target)) |
| 31 | event->StopPropagation(); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 32 | } |
| 33 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 34 | } // namespace ash |