OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/mus/public/cpp/tests/window_tree_client_impl_private.h" | 5 #include "components/mus/public/cpp/tests/window_tree_client_impl_private.h" |
6 | 6 |
7 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" | 7 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" |
| 8 #include "components/mus/public/cpp/window.h" |
8 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 10 #include "mojo/converters/input_events/input_events_type_converters.h" |
9 | 11 |
10 namespace mus { | 12 namespace mus { |
11 | 13 |
12 WindowTreeClientImplPrivate::WindowTreeClientImplPrivate( | 14 WindowTreeClientImplPrivate::WindowTreeClientImplPrivate( |
13 WindowTreeClientImpl* tree_client_impl) | 15 WindowTreeClientImpl* tree_client_impl) |
14 : tree_client_impl_(tree_client_impl) {} | 16 : tree_client_impl_(tree_client_impl) {} |
15 | 17 |
| 18 WindowTreeClientImplPrivate::WindowTreeClientImplPrivate(Window* window) |
| 19 : WindowTreeClientImplPrivate(window->tree_client()) {} |
| 20 |
16 WindowTreeClientImplPrivate::~WindowTreeClientImplPrivate() {} | 21 WindowTreeClientImplPrivate::~WindowTreeClientImplPrivate() {} |
17 | 22 |
18 uint32_t WindowTreeClientImplPrivate::event_observer_id() { | 23 uint32_t WindowTreeClientImplPrivate::event_observer_id() { |
19 return tree_client_impl_->event_observer_id_; | 24 return tree_client_impl_->event_observer_id_; |
20 } | 25 } |
21 | 26 |
22 void WindowTreeClientImplPrivate::OnEmbed(mojom::WindowTree* window_tree) { | 27 void WindowTreeClientImplPrivate::OnEmbed(mojom::WindowTree* window_tree) { |
23 mojom::WindowDataPtr root_data(mojom::WindowData::New()); | 28 mojom::WindowDataPtr root_data(mojom::WindowData::New()); |
24 root_data->parent_id = 0; | 29 root_data->parent_id = 0; |
25 root_data->window_id = 1; | 30 root_data->window_id = 1; |
26 root_data->bounds = mojo::Rect::From(gfx::Rect()); | 31 root_data->bounds = mojo::Rect::From(gfx::Rect()); |
27 root_data->properties.SetToEmpty(); | 32 root_data->properties.SetToEmpty(); |
28 root_data->visible = true; | 33 root_data->visible = true; |
29 root_data->viewport_metrics = mojom::ViewportMetrics::New(); | 34 root_data->viewport_metrics = mojom::ViewportMetrics::New(); |
30 root_data->viewport_metrics->size_in_pixels = | 35 root_data->viewport_metrics->size_in_pixels = |
31 mojo::Size::From(gfx::Size(1000, 1000)); | 36 mojo::Size::From(gfx::Size(1000, 1000)); |
32 root_data->viewport_metrics->device_pixel_ratio = 1; | 37 root_data->viewport_metrics->device_pixel_ratio = 1; |
33 tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), 0, true); | 38 tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), 0, true); |
34 } | 39 } |
35 | 40 |
| 41 void WindowTreeClientImplPrivate::CallOnWindowInputEvent( |
| 42 Window* window, |
| 43 const ui::Event& event) { |
| 44 const uint32_t event_id = 0u; |
| 45 const uint32_t observer_id = 0u; |
| 46 tree_client_impl_->OnWindowInputEvent(event_id, window->server_id(), |
| 47 mojom::Event::From(event), observer_id); |
| 48 } |
| 49 |
36 } // namespace mus | 50 } // namespace mus |
OLD | NEW |