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

Unified Diff: ui/aura/env.cc

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.h ('k') | ui/aura/mus/mus_mouse_location_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 5e9411332e3aacd7299bd6c5c1a08fc6c58e8fce..30c9c0e1b5fee88e5b96242de4ea385e6d75ff3e 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -123,6 +123,19 @@ bool Env::IsMouseButtonDown() const {
mouse_button_flags_ != 0;
}
+const gfx::Point& Env::last_mouse_location() const {
+ if (mode_ == Mode::LOCAL || always_use_last_mouse_location_ ||
+ !get_last_mouse_location_from_mus_) {
+ return last_mouse_location_;
+ }
+
+ // Some tests may not install a WindowTreeClient, and we allow multiple
+ // WindowTreeClients for the case of multiple connections.
+ if (window_tree_client_)
+ last_mouse_location_ = window_tree_client_->GetCursorScreenPoint();
+ return last_mouse_location_;
+}
+
void Env::SetWindowTreeClient(WindowTreeClient* window_tree_client) {
// The WindowTreeClient should only be set once. Test code may need to change
// the value after the fact, to do that use EnvTestHelper.
@@ -155,6 +168,7 @@ Env::Env(Mode mode)
: mode_(mode),
mouse_button_flags_(0),
is_touch_down_(false),
+ get_last_mouse_location_from_mus_(mode_ == Mode::MUS),
input_state_lookup_(InputStateLookup::Create()),
context_factory_(nullptr),
context_factory_private_(nullptr) {
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/mus/mus_mouse_location_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698