| Index: components/mus/ws/connection_manager.cc
|
| diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc
|
| index fd7e78211b9c3a210848ba5a6c525d35c6f13243..3cd24d8f5eba2729ec414e028dae8de259f3a53e 100644
|
| --- a/components/mus/ws/connection_manager.cc
|
| +++ b/components/mus/ws/connection_manager.cc
|
| @@ -20,7 +20,6 @@
|
| #include "ui/gfx/geometry/size_conversions.h"
|
|
|
| namespace mus {
|
| -
|
| namespace ws {
|
|
|
| ConnectionManager::ConnectionManager(
|
| @@ -254,6 +253,11 @@ WindowTreeHostImpl* ConnectionManager::GetActiveWindowTreeHost() {
|
| return host_connection_map_.begin()->first;
|
| }
|
|
|
| +void ConnectionManager::AddDisplayManagerBinding(
|
| + mojo::InterfaceRequest<mojom::DisplayManager> request) {
|
| + display_manager_bindings_.AddBinding(this, std::move(request));
|
| +}
|
| +
|
| uint32_t ConnectionManager::GenerateWindowManagerChangeId(
|
| WindowTreeImpl* source,
|
| uint32_t client_change_id) {
|
| @@ -583,6 +587,37 @@ void ConnectionManager::OnTransientWindowRemoved(
|
| }
|
| }
|
|
|
| -} // namespace ws
|
| +void ConnectionManager::AddObserver(mojom::DisplayManagerObserverPtr observer) {
|
| + mojo::Array<mojom::DisplayPtr> displays(host_connection_map_.size());
|
| + {
|
| + size_t i = 0;
|
| + int next_x = 0;
|
| + for (auto& pair : host_connection_map_) {
|
| + const WindowTreeHostImpl* tree_host = pair.first;
|
| + const ServerWindow* root = tree_host->root_window();
|
| + displays[i] = mojom::Display::New();
|
| + displays[i]->id = tree_host->id();
|
| + displays[i]->bounds = mojo::Rect::New();
|
| + displays[i]->bounds->x = next_x;
|
| + displays[i]->bounds->y = 0;
|
| + displays[i]->bounds->width = root->bounds().size().width();
|
| + displays[i]->bounds->height = root->bounds().size().height();
|
| + next_x += displays[i]->bounds->width;
|
| + // TODO(sky): window manager needs an API to set the work area.
|
| + displays[i]->work_area = displays[i]->bounds.Clone();
|
| + displays[i]->device_pixel_ratio =
|
| + tree_host->GetViewportMetrics().device_pixel_ratio;
|
| + displays[i]->rotation = tree_host->GetRotation();
|
| + // TODO(sky): make this real.
|
| + displays[i]->is_primary = i == 0;
|
| + // TODO(sky): make this real.
|
| + displays[i]->touch_support = mojom::TouchSupport::UNKNOWN;
|
| + ++i;
|
| + }
|
| + }
|
| + observer->OnDisplays(std::move(displays));
|
| + display_manager_observers_.AddInterfacePtr(std::move(observer));
|
| +}
|
|
|
| +} // namespace ws
|
| } // namespace mus
|
|
|