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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2806553002: Gets events dispatching working in mushrome (Closed)
Patch Set: fix and merge 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 unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 client_id_ = 101; 271 client_id_ = 101;
272 272
273 ui::mojom::WindowTreeFactoryPtr factory; 273 ui::mojom::WindowTreeFactoryPtr factory;
274 connector_->BindInterface(ui::mojom::kServiceName, &factory); 274 connector_->BindInterface(ui::mojom::kServiceName, &factory);
275 ui::mojom::WindowTreePtr window_tree; 275 ui::mojom::WindowTreePtr window_tree;
276 factory->CreateWindowTree(MakeRequest(&window_tree), 276 factory->CreateWindowTree(MakeRequest(&window_tree),
277 binding_.CreateInterfacePtrAndBind()); 277 binding_.CreateInterfacePtrAndBind());
278 SetWindowTree(std::move(window_tree)); 278 SetWindowTree(std::move(window_tree));
279 } 279 }
280 280
281 void WindowTreeClient::ConnectAsWindowManager() { 281 void WindowTreeClient::ConnectAsWindowManager(bool dispatch_from_host) {
282 DCHECK(window_manager_delegate_); 282 DCHECK(window_manager_delegate_);
283 dispatch_from_host_ = dispatch_from_host;
283 284
284 ui::mojom::WindowManagerWindowTreeFactoryPtr factory; 285 ui::mojom::WindowManagerWindowTreeFactoryPtr factory;
285 connector_->BindInterface(ui::mojom::kServiceName, &factory); 286 connector_->BindInterface(ui::mojom::kServiceName, &factory);
286 ui::mojom::WindowTreePtr window_tree; 287 ui::mojom::WindowTreePtr window_tree;
287 factory->CreateWindowTree(MakeRequest(&window_tree), 288 factory->CreateWindowTree(MakeRequest(&window_tree),
288 binding_.CreateInterfacePtrAndBind()); 289 binding_.CreateInterfacePtrAndBind());
289 SetWindowTree(std::move(window_tree)); 290 SetWindowTree(std::move(window_tree));
290 } 291 }
291 292
292 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) { 293 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) {
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 // TODO: use |display_id| to find host and send there. 1246 // TODO: use |display_id| to find host and send there.
1246 if (!window || !window->GetWindow()->GetHost()) { 1247 if (!window || !window->GetWindow()->GetHost()) {
1247 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); 1248 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1248 return; 1249 return;
1249 } 1250 }
1250 1251
1251 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); 1252 EventAckHandler ack_handler(CreateEventResultCallback(event_id));
1252 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or 1253 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
1253 // ui::TouchEvent once we have proper support for pointer events. 1254 // ui::TouchEvent once we have proper support for pointer events.
1254 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); 1255 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
1255 DispatchEventToTarget(mapped_event.get(), window); 1256 if (dispatch_from_host_ && mapped_event->IsLocatedEvent()) {
1257 gfx::Point host_location = mapped_event->AsLocatedEvent()->location();
1258 aura::Window::ConvertPointToTarget(window->GetWindow(),
1259 window->GetWindow()->GetHost()->window(),
1260 &host_location);
1261 mapped_event->AsLocatedEvent()->set_location(host_location);
1262 GetWindowTreeHostMus(window)->SendEventToSink(mapped_event.get());
1263 } else {
1264 DispatchEventToTarget(mapped_event.get(), window);
1265 }
1256 ack_handler.set_handled(mapped_event->handled()); 1266 ack_handler.set_handled(mapped_event->handled());
1257 } 1267 }
1258 1268
1259 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event, 1269 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event,
1260 uint32_t window_id, 1270 uint32_t window_id,
1261 int64_t display_id) { 1271 int64_t display_id) {
1262 DCHECK(event); 1272 DCHECK(event);
1263 DCHECK(event->IsPointerEvent()); 1273 DCHECK(event->IsPointerEvent());
1264 if (!has_pointer_watcher_) 1274 if (!has_pointer_watcher_)
1265 return; 1275 return;
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1970 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1961 this, capture_synchronizer_.get(), window)); 1971 this, capture_synchronizer_.get(), window));
1962 } 1972 }
1963 1973
1964 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1974 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1965 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1975 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1966 this, focus_synchronizer_.get(), window)); 1976 this, focus_synchronizer_.get(), window));
1967 } 1977 }
1968 1978
1969 } // namespace aura 1979 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698