OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ws/display.h" | 5 #include "services/ui/ws/display.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "services/ui/ws/window_server_delegate.h" | 26 #include "services/ui/ws/window_server_delegate.h" |
27 #include "services/ui/ws/window_tree.h" | 27 #include "services/ui/ws/window_tree.h" |
28 #include "services/ui/ws/window_tree_binding.h" | 28 #include "services/ui/ws/window_tree_binding.h" |
29 #include "ui/base/cursor/cursor.h" | 29 #include "ui/base/cursor/cursor.h" |
30 | 30 |
31 namespace ui { | 31 namespace ui { |
32 namespace ws { | 32 namespace ws { |
33 | 33 |
34 Display::Display(WindowServer* window_server, | 34 Display::Display(WindowServer* window_server, |
35 const PlatformDisplayInitParams& platform_display_init_params) | 35 const PlatformDisplayInitParams& platform_display_init_params) |
36 : id_(window_server->display_manager()->GetAndAdvanceNextDisplayId()), | 36 : window_server_(window_server), |
37 window_server_(window_server), | |
38 platform_display_(PlatformDisplay::Create(platform_display_init_params)), | 37 platform_display_(PlatformDisplay::Create(platform_display_init_params)), |
39 last_cursor_(ui::kCursorNone) { | 38 last_cursor_(ui::kCursorNone) { |
40 platform_display_->Init(this); | 39 platform_display_->Init(this); |
41 | 40 |
42 window_server_->window_manager_window_tree_factory_set()->AddObserver(this); | 41 window_server_->window_manager_window_tree_factory_set()->AddObserver(this); |
43 window_server_->user_id_tracker()->AddObserver(this); | 42 window_server_->user_id_tracker()->AddObserver(this); |
44 } | 43 } |
45 | 44 |
46 Display::~Display() { | 45 Display::~Display() { |
47 window_server_->user_id_tracker()->RemoveObserver(this); | 46 window_server_->user_id_tracker()->RemoveObserver(this); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 display_ptr->display = ToDisplay(); | 86 display_ptr->display = ToDisplay(); |
88 | 87 |
89 // TODO(sky): make this real. | 88 // TODO(sky): make this real. |
90 display_ptr->is_primary = true; | 89 display_ptr->is_primary = true; |
91 // TODO(sky): make this real. | 90 // TODO(sky): make this real. |
92 display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New(); | 91 display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New(); |
93 return display_ptr; | 92 return display_ptr; |
94 } | 93 } |
95 | 94 |
96 ::display::Display Display::ToDisplay() const { | 95 ::display::Display Display::ToDisplay() const { |
97 ::display::Display display(id_); | 96 ::display::Display display(id()); |
98 | 97 |
99 // TODO(sky): Display should know its origin. | 98 // TODO(sky): Display should know its origin. |
100 display.set_bounds(gfx::Rect(0, 0, root_->bounds().size().width(), | 99 display.set_bounds(gfx::Rect(0, 0, root_->bounds().size().width(), |
101 root_->bounds().size().height())); | 100 root_->bounds().size().height())); |
102 // TODO(sky): window manager needs an API to set the work area. | 101 // TODO(sky): window manager needs an API to set the work area. |
103 display.set_work_area(display.bounds()); | 102 display.set_work_area(display.bounds()); |
104 display.set_device_scale_factor(platform_display_->GetDeviceScaleFactor()); | 103 display.set_device_scale_factor(platform_display_->GetDeviceScaleFactor()); |
105 display.set_rotation(platform_display_->GetRotation()); | 104 display.set_rotation(platform_display_->GetRotation()); |
106 display.set_touch_support( | 105 display.set_touch_support( |
107 ::display::Display::TouchSupport::TOUCH_SUPPORT_UNKNOWN); | 106 ::display::Display::TouchSupport::TOUCH_SUPPORT_UNKNOWN); |
(...skipping 19 matching lines...) Expand all Loading... |
127 } | 126 } |
128 | 127 |
129 ::display::Display::Rotation Display::GetRotation() const { | 128 ::display::Display::Rotation Display::GetRotation() const { |
130 return platform_display_->GetRotation(); | 129 return platform_display_->GetRotation(); |
131 } | 130 } |
132 | 131 |
133 gfx::Size Display::GetSize() const { | 132 gfx::Size Display::GetSize() const { |
134 return root_->bounds().size(); | 133 return root_->bounds().size(); |
135 } | 134 } |
136 | 135 |
137 int64_t Display::GetPlatformDisplayId() const { | |
138 return platform_display_->GetDisplayId(); | |
139 } | |
140 | |
141 ServerWindow* Display::GetRootWithId(const WindowId& id) { | 136 ServerWindow* Display::GetRootWithId(const WindowId& id) { |
142 if (id == root_->id()) | 137 if (id == root_->id()) |
143 return root_.get(); | 138 return root_.get(); |
144 for (auto& pair : window_manager_display_root_map_) { | 139 for (auto& pair : window_manager_display_root_map_) { |
145 if (pair.second->root()->id() == id) | 140 if (pair.second->root()->id() == id) |
146 return pair.second->root(); | 141 return pair.second->root(); |
147 } | 142 } |
148 return nullptr; | 143 return nullptr; |
149 } | 144 } |
150 | 145 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 419 } |
425 | 420 |
426 void Display::OnWindowManagerWindowTreeFactoryReady( | 421 void Display::OnWindowManagerWindowTreeFactoryReady( |
427 WindowManagerWindowTreeFactory* factory) { | 422 WindowManagerWindowTreeFactory* factory) { |
428 if (!binding_) | 423 if (!binding_) |
429 CreateWindowManagerDisplayRootFromFactory(factory); | 424 CreateWindowManagerDisplayRootFromFactory(factory); |
430 } | 425 } |
431 | 426 |
432 } // namespace ws | 427 } // namespace ws |
433 } // namespace ui | 428 } // namespace ui |
OLD | NEW |