Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 } | 95 } |
| 96 | 96 |
| 97 WindowEventDispatcher::~WindowEventDispatcher() { | 97 WindowEventDispatcher::~WindowEventDispatcher() { |
| 98 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); | 98 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); |
| 99 Env::GetInstance()->RemoveObserver(this); | 99 Env::GetInstance()->RemoveObserver(this); |
| 100 ui::GestureRecognizer::Get()->RemoveGestureEventHelper(this); | 100 ui::GestureRecognizer::Get()->RemoveGestureEventHelper(this); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void WindowEventDispatcher::RepostEvent(const ui::LocatedEvent& event) { | 103 void WindowEventDispatcher::RepostEvent(const ui::LocatedEvent& event) { |
| 104 DCHECK(event.type() == ui::ET_MOUSE_PRESSED || | 104 DCHECK(event.type() == ui::ET_MOUSE_PRESSED || |
| 105 event.type() == ui::ET_GESTURE_TAP_DOWN); | 105 event.type() == ui::ET_GESTURE_TAP_DOWN || |
| 106 event.type() == ui::ET_TOUCH_PRESSED); | |
|
sky
2016/01/12 21:16:42
You'll want to update the description in the .h fo
ananta
2016/01/13 01:21:24
Done.
| |
| 106 // We allow for only one outstanding repostable event. This is used | 107 // We allow for only one outstanding repostable event. This is used |
| 107 // in exiting context menus. A dropped repost request is allowed. | 108 // in exiting context menus. A dropped repost request is allowed. |
| 108 if (event.type() == ui::ET_MOUSE_PRESSED) { | 109 if (event.type() == ui::ET_MOUSE_PRESSED) { |
| 109 held_repostable_event_.reset( | 110 held_repostable_event_.reset( |
| 110 new ui::MouseEvent( | 111 new ui::MouseEvent( |
| 111 static_cast<const ui::MouseEvent&>(event), | 112 static_cast<const ui::MouseEvent&>(event), |
| 112 static_cast<aura::Window*>(event.target()), | 113 static_cast<aura::Window*>(event.target()), |
| 113 window())); | 114 window())); |
| 114 base::MessageLoop::current()->PostNonNestableTask( | 115 base::MessageLoop::current()->PostNonNestableTask( |
| 115 FROM_HERE, base::Bind( | 116 FROM_HERE, base::Bind( |
| 116 base::IgnoreResult(&WindowEventDispatcher::DispatchHeldEvents), | 117 base::IgnoreResult(&WindowEventDispatcher::DispatchHeldEvents), |
| 117 repost_event_factory_.GetWeakPtr())); | 118 repost_event_factory_.GetWeakPtr())); |
| 119 } else if (event.type() == ui::ET_TOUCH_PRESSED) { | |
| 120 DispatchDetails details = OnEventFromSource( | |
|
sky
2016/01/12 21:16:42
Doesn't this process immediatley right here? Don't
ananta
2016/01/13 01:21:24
Done.
| |
| 121 const_cast<ui::LocatedEvent*>(&event)); | |
| 122 if (details.dispatcher_destroyed) | |
| 123 return; | |
| 118 } else { | 124 } else { |
| 119 DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN); | 125 DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN); |
| 120 held_repostable_event_.reset(); | 126 held_repostable_event_.reset(); |
| 121 // TODO(rbyers): Reposing of gestures is tricky to get | 127 // TODO(rbyers): Reposing of gestures is tricky to get |
| 122 // right, so it's not yet supported. crbug.com/170987. | 128 // right, so it's not yet supported. crbug.com/170987. |
| 123 } | 129 } |
| 124 } | 130 } |
| 125 | 131 |
| 126 void WindowEventDispatcher::OnMouseEventsEnableStateChanged(bool enabled) { | 132 void WindowEventDispatcher::OnMouseEventsEnableStateChanged(bool enabled) { |
| 127 // Send entered / exited so that visual state can be updated to match | 133 // Send entered / exited so that visual state can be updated to match |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 } | 920 } |
| 915 | 921 |
| 916 // This flag is set depending on the gestures recognized in the call above, | 922 // This flag is set depending on the gestures recognized in the call above, |
| 917 // and needs to propagate with the forwarded event. | 923 // and needs to propagate with the forwarded event. |
| 918 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 924 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
| 919 | 925 |
| 920 return PreDispatchLocatedEvent(target, event); | 926 return PreDispatchLocatedEvent(target, event); |
| 921 } | 927 } |
| 922 | 928 |
| 923 } // namespace aura | 929 } // namespace aura |
| OLD | NEW |