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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // another one may not be safe/expected. Instead we post a task, that we | 187 // another one may not be safe/expected. Instead we post a task, that we |
188 // may cancel if HoldPointerMoves is called again before it executes. | 188 // may cancel if HoldPointerMoves is called again before it executes. |
189 base::MessageLoop::current()->PostNonNestableTask( | 189 base::MessageLoop::current()->PostNonNestableTask( |
190 FROM_HERE, base::Bind( | 190 FROM_HERE, base::Bind( |
191 base::IgnoreResult(&WindowEventDispatcher::DispatchHeldEvents), | 191 base::IgnoreResult(&WindowEventDispatcher::DispatchHeldEvents), |
192 held_event_factory_.GetWeakPtr())); | 192 held_event_factory_.GetWeakPtr())); |
193 } | 193 } |
194 TRACE_EVENT_ASYNC_END0("ui", "WindowEventDispatcher::HoldPointerMoves", this); | 194 TRACE_EVENT_ASYNC_END0("ui", "WindowEventDispatcher::HoldPointerMoves", this); |
195 } | 195 } |
196 | 196 |
| 197 bool WindowEventDispatcher::HoldingPointerMovesForTest() { |
| 198 return move_hold_count_ > 0; |
| 199 } |
| 200 |
197 gfx::Point WindowEventDispatcher::GetLastMouseLocationInRoot() const { | 201 gfx::Point WindowEventDispatcher::GetLastMouseLocationInRoot() const { |
198 gfx::Point location = Env::GetInstance()->last_mouse_location(); | 202 gfx::Point location = Env::GetInstance()->last_mouse_location(); |
199 client::ScreenPositionClient* client = | 203 client::ScreenPositionClient* client = |
200 client::GetScreenPositionClient(window()); | 204 client::GetScreenPositionClient(window()); |
201 if (client) | 205 if (client) |
202 client->ConvertPointFromScreen(window(), &location); | 206 client->ConvertPointFromScreen(window(), &location); |
203 return location; | 207 return location; |
204 } | 208 } |
205 | 209 |
206 void WindowEventDispatcher::OnHostLostMouseGrab() { | 210 void WindowEventDispatcher::OnHostLostMouseGrab() { |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 break; | 845 break; |
842 | 846 |
843 default: | 847 default: |
844 NOTREACHED(); | 848 NOTREACHED(); |
845 break; | 849 break; |
846 } | 850 } |
847 PreDispatchLocatedEvent(target, event); | 851 PreDispatchLocatedEvent(target, event); |
848 } | 852 } |
849 | 853 |
850 } // namespace aura | 854 } // namespace aura |
OLD | NEW |