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

Side by Side Diff: ui/aura/test/event_generator_delegate_aura.cc

Issue 2752903002: Make ui::test::EventGenerator work with PointerEvents in mash (Closed)
Patch Set: review comments Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ui/aura/test/event_generator_delegate_aura.h" 5 #include "ui/aura/test/event_generator_delegate_aura.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ui/aura/client/screen_position_client.h" 9 #include "ui/aura/client/screen_position_client.h"
10 #include "ui/aura/env.h"
11 #include "ui/aura/test/env_test_helper.h"
12 #include "ui/aura/test/mus/window_tree_client_private.h"
10 #include "ui/aura/window_event_dispatcher.h" 13 #include "ui/aura/window_event_dispatcher.h"
11 #include "ui/aura/window_tree_host.h" 14 #include "ui/aura/window_tree_host.h"
12 #include "ui/base/ime/input_method.h" 15 #include "ui/base/ime/input_method.h"
13 16
14 namespace aura { 17 namespace aura {
15 namespace test { 18 namespace test {
16 namespace { 19 namespace {
17 20
18 class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura { 21 class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura {
19 public: 22 public:
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 const Window* window = WindowFromTarget(hosted_target); 132 const Window* window = WindowFromTarget(hosted_target);
130 window->GetHost()->ConvertPixelsToDIP(point); 133 window->GetHost()->ConvertPixelsToDIP(point);
131 } 134 }
132 135
133 void EventGeneratorDelegateAura::DispatchKeyEventToIME(ui::EventTarget* target, 136 void EventGeneratorDelegateAura::DispatchKeyEventToIME(ui::EventTarget* target,
134 ui::KeyEvent* event) { 137 ui::KeyEvent* event) {
135 Window* window = static_cast<Window*>(target); 138 Window* window = static_cast<Window*>(target);
136 window->GetHost()->GetInputMethod()->DispatchKeyEvent(event); 139 window->GetHost()->GetInputMethod()->DispatchKeyEvent(event);
137 } 140 }
138 141
142 void EventGeneratorDelegateAura::DispatchEventToPointerWatchers(
143 ui::EventTarget* target,
144 const ui::PointerEvent& event) {
145 // In non-mus aura PointerWatchers are handled by system-wide EventHandlers,
146 // for example ash::Shell and ash::PointerWatcherAdapter.
147 if (!Env::GetInstance()->HasWindowTreeClient())
148 return;
149
150 // Route the event through WindowTreeClient as in production mus. Does nothing
151 // if there are no PointerWatchers installed.
152 Window* window = static_cast<Window*>(target);
153 WindowTreeClient* window_tree_client = EnvTestHelper().GetWindowTreeClient();
154 WindowTreeClientPrivate(window_tree_client)
155 .CallOnPointerEventObserved(window, ui::Event::Clone(event));
156 }
157
139 } // namespace test 158 } // namespace test
140 } // namespace aura 159 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/event_generator_delegate_aura.h ('k') | ui/aura/test/mus/window_tree_client_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698