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

Unified Diff: ui/aura/mus/window_tree_client.cc

Issue 2779093004: Update event states in Env when target window has been destroyed. (Closed)
Patch Set: window null Created 3 years, 8 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_input_state_controller.cc ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_tree_client.cc
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
index b69109eb2360aab9f44f2615a3cf70c5837c85c5..81958410a500efd11c7eea5cdc86db3248e3768f 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -29,6 +29,7 @@
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/transient_window_client.h"
#include "ui/aura/env.h"
+#include "ui/aura/env_input_state_controller.h"
#include "ui/aura/mus/capture_synchronizer.h"
#include "ui/aura/mus/drag_drop_controller_mus.h"
#include "ui/aura/mus/focus_synchronizer.h"
@@ -47,6 +48,7 @@
#include "ui/aura/mus/window_tree_host_mus_init_params.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
+#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tracker.h"
#include "ui/base/layout.h"
#include "ui/base/ui_base_types.h"
@@ -1302,8 +1304,20 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
window ? window->GetWindow() : nullptr);
}
- // TODO: use |display_id| to find host and send there.
+ // If the window has already been deleted, use |event| to update event states
+ // kept in aura::Env. Any WindowTreeHost should be okay to get
+ // aura::EnvInputStateController from since these are global states.
sadrul 2017/05/01 17:39:36 Also, it may make sense to have Env own a single i
riajiang 2017/05/02 21:05:31 Done in https://codereview.chromium.org/2854663002
if (!window || !window->GetWindow()->GetHost()) {
+ DCHECK(!roots_.empty());
+ EnvInputStateController* env_controller =
+ GetWindowTreeHostMus(*roots_.begin())->dispatcher()->env_controller();
sky 2017/05/01 17:37:27 How do you know roots_ is not empty here?
riajiang 2017/05/02 21:05:31 Yes sorry didn't consider that case. Changed EnvIn
+ std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
+ if (mapped_event->IsMouseEvent()) {
+ env_controller->UpdateStateForMouseEvent(nullptr,
+ *mapped_event->AsMouseEvent());
+ } else if (mapped_event->IsTouchEvent()) {
+ env_controller->UpdateStateForTouchEvent(*mapped_event->AsTouchEvent());
+ }
tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
return;
}
« no previous file with comments | « ui/aura/env_input_state_controller.cc ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698