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