| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/aura/window_targeter.h" | 5 #include "ui/aura/window_targeter.h" |
| 6 | 6 |
| 7 #include "ui/aura/client/capture_client.h" | 7 #include "ui/aura/client/capture_client.h" |
| 8 #include "ui/aura/client/event_client.h" | 8 #include "ui/aura/client/event_client.h" |
| 9 #include "ui/aura/client/focus_client.h" | 9 #include "ui/aura/client/focus_client.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/aura/window_delegate.h" | 11 #include "ui/aura/window_delegate.h" |
| 12 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
| 13 #include "ui/aura/window_tree_host.h" |
| 13 #include "ui/events/event_target.h" | 14 #include "ui/events/event_target.h" |
| 14 | 15 |
| 15 namespace aura { | 16 namespace aura { |
| 16 | 17 |
| 17 WindowTargeter::WindowTargeter() {} | 18 WindowTargeter::WindowTargeter() {} |
| 18 WindowTargeter::~WindowTargeter() {} | 19 WindowTargeter::~WindowTargeter() {} |
| 19 | 20 |
| 20 bool WindowTargeter::WindowCanAcceptEvent(aura::Window* window, | 21 bool WindowTargeter::WindowCanAcceptEvent(aura::Window* window, |
| 21 const ui::LocatedEvent& event) const { | 22 const ui::LocatedEvent& event) const { |
| 22 if (!window->IsVisible()) | 23 if (!window->IsVisible()) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 Window* target = event->IsKeyEvent() ? | 50 Window* target = event->IsKeyEvent() ? |
| 50 FindTargetForKeyEvent(window, *static_cast<ui::KeyEvent*>(event)) : | 51 FindTargetForKeyEvent(window, *static_cast<ui::KeyEvent*>(event)) : |
| 51 static_cast<Window*>(EventTargeter::FindTargetForEvent(root, event)); | 52 static_cast<Window*>(EventTargeter::FindTargetForEvent(root, event)); |
| 52 if (target && !window->parent()) { | 53 if (target && !window->parent()) { |
| 53 // |window| is the root window. | 54 // |window| is the root window. |
| 54 if (!window->Contains(target)) { | 55 if (!window->Contains(target)) { |
| 55 // |target| is not a descendent of |window|. So do not allow dispatching | 56 // |target| is not a descendent of |window|. So do not allow dispatching |
| 56 // from here. Instead, dispatch the event through the | 57 // from here. Instead, dispatch the event through the |
| 57 // WindowEventDispatcher that owns |target|. | 58 // WindowEventDispatcher that owns |target|. |
| 58 ui::EventDispatchDetails details ALLOW_UNUSED = | 59 ui::EventDispatchDetails details ALLOW_UNUSED = |
| 59 target->GetHost()->dispatcher()->OnEventFromSource(event); | 60 target->GetHost()->event_processor()->OnEventFromSource(event); |
| 60 target = NULL; | 61 target = NULL; |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 return target; | 64 return target; |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool WindowTargeter::SubtreeShouldBeExploredForEvent( | 67 bool WindowTargeter::SubtreeShouldBeExploredForEvent( |
| 67 ui::EventTarget* root, | 68 ui::EventTarget* root, |
| 68 const ui::LocatedEvent& event) { | 69 const ui::LocatedEvent& event) { |
| 69 Window* window = static_cast<Window*>(root); | 70 Window* window = static_cast<Window*>(root); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 139 |
| 139 // If the initial touch is outside the root window, target the root. | 140 // If the initial touch is outside the root window, target the root. |
| 140 if (!root_window->bounds().Contains(event.location())) | 141 if (!root_window->bounds().Contains(event.location())) |
| 141 return root_window; | 142 return root_window; |
| 142 } | 143 } |
| 143 | 144 |
| 144 return NULL; | 145 return NULL; |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace aura | 148 } // namespace aura |
| OLD | NEW |