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