Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(656)

Unified Diff: ui/aura/mus/mus_mouse_location_updater.h

Issue 2657283003: mash: make Env::last_mouse_location() accurate for Mus (Closed)
Patch Set: merge Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/env.cc ('k') | ui/aura/mus/mus_mouse_location_updater.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/mus_mouse_location_updater.h
diff --git a/ui/aura/mus/mus_mouse_location_updater.h b/ui/aura/mus/mus_mouse_location_updater.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8200496ab879976203415a7b68ac49c05f1605f
--- /dev/null
+++ b/ui/aura/mus/mus_mouse_location_updater.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_MUS_MUS_MOUSE_LOCATION_UPDATER_H_
+#define UI_AURA_MUS_MUS_MOUSE_LOCATION_UPDATER_H_
+
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+
+namespace ui {
+class Event;
+}
+
+namespace aura {
+
+// MusMouseLocationUpdater is responsible for updating
+// Env::last_mouse_location(), as well as determining when
+// Env::last_mouse_location() should use
+// WindowTreeClient::GetCursorScreenPoint(). While processing an event
+// Env uses the value from the current event, otherwise Env uses
+// WindowTreeClient::GetCursorScreenPoint(). If a nested message loop is
+// started while processing an event Env uses GetCursorScreenPoint().
+class MusMouseLocationUpdater : public base::MessageLoop::NestingObserver {
+ public:
+ MusMouseLocationUpdater();
+ ~MusMouseLocationUpdater() override;
+
+ // Called from WindowEventDispatcher on starting/stopping processing of
+ // events.
+ void OnEventProcessingStarted(const ui::Event& event);
+ void OnEventProcessingFinished();
+
+ private:
+ // Called to switch from using last event location to current cursor screen
+ // location.
+ void UseCursorScreenPoint();
+
+ // base::MessageLoop::NestingObserver:
+ void OnBeginNestedMessageLoop() override;
+
+ // Set to true while processing a valid mouse event.
+ bool is_processing_trigger_event_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(MusMouseLocationUpdater);
+};
+
+} // namespace aura
+
+#endif // UI_AURA_MUS_MUS_MOUSE_LOCATION_UPDATER_H_
« no previous file with comments | « ui/aura/env.cc ('k') | ui/aura/mus/mus_mouse_location_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698