| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 #ifndef UI_AURA_MUS_MUS_MOUSE_LOCATION_UPDATER_H_ |
| 6 #define UI_AURA_MUS_MUS_MOUSE_LOCATION_UPDATER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" |
| 10 |
| 11 namespace ui { |
| 12 class Event; |
| 13 } |
| 14 |
| 15 namespace aura { |
| 16 |
| 17 // MusMouseLocationUpdater is responsible for updating |
| 18 // Env::last_mouse_location(), as well as determining when |
| 19 // Env::last_mouse_location() should use |
| 20 // WindowTreeClient::GetCursorScreenPoint(). While processing an event |
| 21 // Env uses the value from the current event, otherwise Env uses |
| 22 // WindowTreeClient::GetCursorScreenPoint(). If a nested message loop is |
| 23 // started while processing an event Env uses GetCursorScreenPoint(). |
| 24 class MusMouseLocationUpdater : public base::MessageLoop::NestingObserver { |
| 25 public: |
| 26 MusMouseLocationUpdater(); |
| 27 ~MusMouseLocationUpdater() override; |
| 28 |
| 29 // Called from WindowEventDispatcher on starting/stopping processing of |
| 30 // events. |
| 31 void OnEventProcessingStarted(const ui::Event& event); |
| 32 void OnEventProcessingFinished(); |
| 33 |
| 34 private: |
| 35 void StopObserving(); |
| 36 |
| 37 // base::MessageLoop::NestingObserver: |
| 38 void OnBeginNestedMessageLoop() override; |
| 39 |
| 40 // Set to true once a valid mouse event is encountered. |
| 41 bool observing_message_loop_ = false; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(MusMouseLocationUpdater); |
| 44 }; |
| 45 |
| 46 } // namespace aura |
| 47 |
| 48 #endif // UI_AURA_MUS_MUS_MOUSE_LOCATION_UPDATER_H_ |
| OLD | NEW |