| 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_private.h" | 5 #include "components/mus/public/cpp/tests/window_tree_client_private.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/window.h" | 7 #include "components/mus/public/cpp/window.h" |
| 8 #include "components/mus/public/cpp/window_tree_client.h" | 8 #include "components/mus/public/cpp/window_tree_client.h" |
| 9 #include "ui/display/display.h" |
| 9 | 10 |
| 10 namespace mus { | 11 namespace mus { |
| 11 | 12 |
| 12 WindowTreeClientPrivate::WindowTreeClientPrivate( | 13 WindowTreeClientPrivate::WindowTreeClientPrivate( |
| 13 WindowTreeClient* tree_client_impl) | 14 WindowTreeClient* tree_client_impl) |
| 14 : tree_client_impl_(tree_client_impl) {} | 15 : tree_client_impl_(tree_client_impl) {} |
| 15 | 16 |
| 16 WindowTreeClientPrivate::WindowTreeClientPrivate(Window* window) | 17 WindowTreeClientPrivate::WindowTreeClientPrivate(Window* window) |
| 17 : WindowTreeClientPrivate(window->window_tree()) {} | 18 : WindowTreeClientPrivate(window->window_tree()) {} |
| 18 | 19 |
| 19 WindowTreeClientPrivate::~WindowTreeClientPrivate() {} | 20 WindowTreeClientPrivate::~WindowTreeClientPrivate() {} |
| 20 | 21 |
| 21 uint32_t WindowTreeClientPrivate::event_observer_id() { | 22 uint32_t WindowTreeClientPrivate::event_observer_id() { |
| 22 return tree_client_impl_->event_observer_id_; | 23 return tree_client_impl_->event_observer_id_; |
| 23 } | 24 } |
| 24 | 25 |
| 25 void WindowTreeClientPrivate::OnEmbed(mojom::WindowTree* window_tree) { | 26 void WindowTreeClientPrivate::OnEmbed(mojom::WindowTree* window_tree) { |
| 26 mojom::WindowDataPtr root_data(mojom::WindowData::New()); | 27 mojom::WindowDataPtr root_data(mojom::WindowData::New()); |
| 27 root_data->parent_id = 0; | 28 root_data->parent_id = 0; |
| 28 root_data->window_id = 1; | 29 root_data->window_id = 1; |
| 29 root_data->properties.SetToEmpty(); | 30 root_data->properties.SetToEmpty(); |
| 30 root_data->visible = true; | 31 root_data->visible = true; |
| 31 const int64_t display_id = 1; | 32 const int64_t display_id = 1; |
| 32 const Id focused_window_id = 0; | 33 const Id focused_window_id = 0; |
| 33 tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), | 34 tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), |
| 34 display_id, focused_window_id, true); | 35 display_id, focused_window_id, true); |
| 35 } | 36 } |
| 36 | 37 |
| 38 void WindowTreeClientPrivate::CallWmNewDisplayAdded( |
| 39 const display::Display& display) { |
| 40 mojom::WindowDataPtr root_data(mojom::WindowData::New()); |
| 41 root_data->parent_id = 0; |
| 42 root_data->window_id = 1; |
| 43 root_data->properties.SetToEmpty(); |
| 44 root_data->visible = true; |
| 45 root_data->bounds = gfx::Rect(display.bounds().size()); |
| 46 const bool parent_drawn = true; |
| 47 tree_client_impl_->WmNewDisplayAddedImpl(display, std::move(root_data), |
| 48 parent_drawn); |
| 49 } |
| 50 |
| 37 void WindowTreeClientPrivate::CallOnWindowInputEvent( | 51 void WindowTreeClientPrivate::CallOnWindowInputEvent( |
| 38 Window* window, | 52 Window* window, |
| 39 std::unique_ptr<ui::Event> event) { | 53 std::unique_ptr<ui::Event> event) { |
| 40 const uint32_t event_id = 0u; | 54 const uint32_t event_id = 0u; |
| 41 const uint32_t observer_id = 0u; | 55 const uint32_t observer_id = 0u; |
| 42 tree_client_impl_->OnWindowInputEvent(event_id, window->server_id(), | 56 tree_client_impl_->OnWindowInputEvent(event_id, window->server_id(), |
| 43 std::move(event), observer_id); | 57 std::move(event), observer_id); |
| 44 } | 58 } |
| 45 | 59 |
| 60 void WindowTreeClientPrivate::SetTreeAndClientId(mojom::WindowTree* window_tree, |
| 61 ClientSpecificId client_id) { |
| 62 tree_client_impl_->tree_ = window_tree; |
| 63 tree_client_impl_->client_id_ = client_id; |
| 64 } |
| 65 |
| 46 } // namespace mus | 66 } // namespace mus |
| OLD | NEW |