OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/system_modal_container_event_filter.h" | 5 #include "ash/wm/system_modal_container_event_filter.h" |
6 #include "ash/common/wm_shell.h" | |
7 #include "ash/wm/system_modal_container_event_filter_delegate.h" | 6 #include "ash/wm/system_modal_container_event_filter_delegate.h" |
| 7 #include "ash/wm_shell.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 SystemModalContainerEventFilter::SystemModalContainerEventFilter( | 13 SystemModalContainerEventFilter::SystemModalContainerEventFilter( |
14 SystemModalContainerEventFilterDelegate* delegate) | 14 SystemModalContainerEventFilterDelegate* delegate) |
15 : delegate_(delegate) {} | 15 : delegate_(delegate) {} |
16 | 16 |
17 SystemModalContainerEventFilter::~SystemModalContainerEventFilter() {} | 17 SystemModalContainerEventFilter::~SystemModalContainerEventFilter() {} |
18 | 18 |
19 void SystemModalContainerEventFilter::OnEvent(ui::Event* event) { | 19 void SystemModalContainerEventFilter::OnEvent(ui::Event* event) { |
20 // Only filter modal events if a modal window is open. | 20 // Only filter modal events if a modal window is open. |
21 if (!WmShell::Get()->IsSystemModalWindowOpen()) | 21 if (!WmShell::Get()->IsSystemModalWindowOpen()) |
22 return; | 22 return; |
23 aura::Window* target = static_cast<aura::Window*>(event->target()); | 23 aura::Window* target = static_cast<aura::Window*>(event->target()); |
24 if (!delegate_->CanWindowReceiveEvents(target)) | 24 if (!delegate_->CanWindowReceiveEvents(target)) |
25 event->StopPropagation(); | 25 event->StopPropagation(); |
26 } | 26 } |
27 | 27 |
28 } // namespace ash | 28 } // namespace ash |
OLD | NEW |