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