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