Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: components/mus/ws/connection_manager.cc

Issue 1618963005: Revert of Start of display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/ws/connection_manager.h ('k') | components/mus/ws/display_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ws/connection_manager.h" 5 #include "components/mus/ws/connection_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "components/mus/ws/client_connection.h" 9 #include "components/mus/ws/client_connection.h"
10 #include "components/mus/ws/connection_manager_delegate.h" 10 #include "components/mus/ws/connection_manager_delegate.h"
11 #include "components/mus/ws/operation.h" 11 #include "components/mus/ws/operation.h"
12 #include "components/mus/ws/server_window.h" 12 #include "components/mus/ws/server_window.h"
13 #include "components/mus/ws/window_coordinate_conversions.h" 13 #include "components/mus/ws/window_coordinate_conversions.h"
14 #include "components/mus/ws/window_tree_host_connection.h" 14 #include "components/mus/ws/window_tree_host_connection.h"
15 #include "components/mus/ws/window_tree_impl.h" 15 #include "components/mus/ws/window_tree_impl.h"
16 #include "mojo/converters/geometry/geometry_type_converters.h" 16 #include "mojo/converters/geometry/geometry_type_converters.h"
17 #include "mojo/converters/input_events/input_events_type_converters.h" 17 #include "mojo/converters/input_events/input_events_type_converters.h"
18 #include "mojo/converters/surfaces/surfaces_type_converters.h" 18 #include "mojo/converters/surfaces/surfaces_type_converters.h"
19 #include "mojo/shell/public/cpp/application_connection.h" 19 #include "mojo/shell/public/cpp/application_connection.h"
20 #include "ui/gfx/geometry/size_conversions.h" 20 #include "ui/gfx/geometry/size_conversions.h"
21 21
22 namespace mus { 22 namespace mus {
23
23 namespace ws { 24 namespace ws {
24 25
25 ConnectionManager::ConnectionManager( 26 ConnectionManager::ConnectionManager(
26 ConnectionManagerDelegate* delegate, 27 ConnectionManagerDelegate* delegate,
27 const scoped_refptr<mus::SurfacesState>& surfaces_state) 28 const scoped_refptr<mus::SurfacesState>& surfaces_state)
28 : delegate_(delegate), 29 : delegate_(delegate),
29 surfaces_state_(surfaces_state), 30 surfaces_state_(surfaces_state),
30 next_connection_id_(1), 31 next_connection_id_(1),
31 next_host_id_(0), 32 next_host_id_(0),
32 current_operation_(nullptr), 33 current_operation_(nullptr),
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (window == pair.first->root_window()) 247 if (window == pair.first->root_window())
247 return pair.first; 248 return pair.first;
248 } 249 }
249 return nullptr; 250 return nullptr;
250 } 251 }
251 252
252 WindowTreeHostImpl* ConnectionManager::GetActiveWindowTreeHost() { 253 WindowTreeHostImpl* ConnectionManager::GetActiveWindowTreeHost() {
253 return host_connection_map_.begin()->first; 254 return host_connection_map_.begin()->first;
254 } 255 }
255 256
256 void ConnectionManager::AddDisplayManagerBinding(
257 mojo::InterfaceRequest<mojom::DisplayManager> request) {
258 display_manager_bindings_.AddBinding(this, std::move(request));
259 }
260
261 uint32_t ConnectionManager::GenerateWindowManagerChangeId( 257 uint32_t ConnectionManager::GenerateWindowManagerChangeId(
262 WindowTreeImpl* source, 258 WindowTreeImpl* source,
263 uint32_t client_change_id) { 259 uint32_t client_change_id) {
264 const uint32_t wm_change_id = next_wm_change_id_++; 260 const uint32_t wm_change_id = next_wm_change_id_++;
265 in_flight_wm_change_map_[wm_change_id] = {source->id(), client_change_id}; 261 in_flight_wm_change_map_[wm_change_id] = {source->id(), client_change_id};
266 return wm_change_id; 262 return wm_change_id;
267 } 263 }
268 264
269 void ConnectionManager::WindowManagerChangeCompleted( 265 void ConnectionManager::WindowManagerChangeCompleted(
270 uint32_t window_manager_change_id, 266 uint32_t window_manager_change_id,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 ServerWindow* transient_child) { 576 ServerWindow* transient_child) {
581 // If we're deleting a window, then this is a superfluous message. 577 // If we're deleting a window, then this is a superfluous message.
582 if (current_operation_type() == OperationType::DELETE_WINDOW) 578 if (current_operation_type() == OperationType::DELETE_WINDOW)
583 return; 579 return;
584 for (auto& pair : connection_map_) { 580 for (auto& pair : connection_map_) {
585 pair.second->service()->ProcessTransientWindowRemoved( 581 pair.second->service()->ProcessTransientWindowRemoved(
586 window, transient_child, IsOperationSource(pair.first)); 582 window, transient_child, IsOperationSource(pair.first));
587 } 583 }
588 } 584 }
589 585
590 void ConnectionManager::AddObserver(mojom::DisplayManagerObserverPtr observer) { 586 } // namespace ws
591 mojo::Array<mojom::DisplayPtr> displays(host_connection_map_.size());
592 {
593 size_t i = 0;
594 int next_x = 0;
595 for (auto& pair : host_connection_map_) {
596 const WindowTreeHostImpl* tree_host = pair.first;
597 const ServerWindow* root = tree_host->root_window();
598 displays[i]->id = tree_host->id();
599 displays[i]->bounds = mojo::Rect::New();
600 displays[i]->bounds->x = next_x;
601 displays[i]->bounds->y = 0;
602 displays[i]->bounds->width = root->bounds().size().width();
603 displays[i]->bounds->height = root->bounds().size().height();
604 next_x += displays[i]->bounds->width;
605 // TODO(sky): window manager needs an API to set the work area.
606 displays[i]->work_area = displays[1]->bounds.Clone();
607 displays[i]->device_pixel_ratio =
608 tree_host->GetViewportMetrics().device_pixel_ratio;
609 displays[i]->rotation = tree_host->GetRotation();
610 // TODO(sky): make this real.
611 displays[i]->is_primary = i == 0;
612 // TODO(sky): make this real.
613 displays[i]->touch_support = mojom::TouchSupport::UNKNOWN;
614 ++i;
615 }
616 }
617 observer->OnDisplays(std::move(displays));
618 display_manager_observers_.AddInterfacePtr(std::move(observer));
619 }
620 587
621 } // namespace ws
622 } // namespace mus 588 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/connection_manager.h ('k') | components/mus/ws/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698