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

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

Issue 2021483002: mus: Remove ViewportMetrics from mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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/display.h ('k') | components/mus/ws/platform_display.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 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 "components/mus/ws/display.h" 5 #include "components/mus/ws/display.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 display_ptr = mojom::Display::New(); 84 display_ptr = mojom::Display::New();
85 display_ptr->id = id_; 85 display_ptr->id = id_;
86 display_ptr->bounds = mojo::Rect::New(); 86 display_ptr->bounds = mojo::Rect::New();
87 // TODO(sky): Display should know it's origin. 87 // TODO(sky): Display should know it's origin.
88 display_ptr->bounds->x = 0; 88 display_ptr->bounds->x = 0;
89 display_ptr->bounds->y = 0; 89 display_ptr->bounds->y = 0;
90 display_ptr->bounds->width = root_->bounds().size().width(); 90 display_ptr->bounds->width = root_->bounds().size().width();
91 display_ptr->bounds->height = root_->bounds().size().height(); 91 display_ptr->bounds->height = root_->bounds().size().height();
92 // TODO(sky): window manager needs an API to set the work area. 92 // TODO(sky): window manager needs an API to set the work area.
93 display_ptr->work_area = display_ptr->bounds.Clone(); 93 display_ptr->work_area = display_ptr->bounds.Clone();
94 display_ptr->device_pixel_ratio = 94 display_ptr->device_pixel_ratio = platform_display_->GetDeviceScaleFactor();
95 platform_display_->GetViewportMetrics().device_pixel_ratio;
96 display_ptr->rotation = platform_display_->GetRotation(); 95 display_ptr->rotation = platform_display_->GetRotation();
97 // TODO(sky): make this real. 96 // TODO(sky): make this real.
98 display_ptr->is_primary = true; 97 display_ptr->is_primary = true;
99 // TODO(sky): make this real. 98 // TODO(sky): make this real.
100 display_ptr->touch_support = mojom::TouchSupport::UNKNOWN; 99 display_ptr->touch_support = mojom::TouchSupport::UNKNOWN;
101 display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New(); 100 display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New();
102 display_ptr->frame_decoration_values->normal_client_area_insets = 101 display_ptr->frame_decoration_values->normal_client_area_insets =
103 mojo::Insets::New(); 102 mojo::Insets::New();
104 display_ptr->frame_decoration_values->maximized_client_area_insets = 103 display_ptr->frame_decoration_values->maximized_client_area_insets =
105 mojo::Insets::New(); 104 mojo::Insets::New();
(...skipping 10 matching lines...) Expand all
116 if (!platform_display_->IsFramePending()) { 115 if (!platform_display_->IsFramePending()) {
117 window->DestroySurfacesScheduledForDestruction(); 116 window->DestroySurfacesScheduledForDestruction();
118 return; 117 return;
119 } 118 }
120 if (windows_needing_frame_destruction_.count(window)) 119 if (windows_needing_frame_destruction_.count(window))
121 return; 120 return;
122 windows_needing_frame_destruction_.insert(window); 121 windows_needing_frame_destruction_.insert(window);
123 window->AddObserver(this); 122 window->AddObserver(this);
124 } 123 }
125 124
126 const mojom::ViewportMetrics& Display::GetViewportMetrics() const {
127 return platform_display_->GetViewportMetrics();
128 }
129
130 ServerWindow* Display::GetRootWithId(const WindowId& id) { 125 ServerWindow* Display::GetRootWithId(const WindowId& id) {
131 if (id == root_->id()) 126 if (id == root_->id())
132 return root_.get(); 127 return root_.get();
133 for (auto& pair : window_manager_state_map_) { 128 for (auto& pair : window_manager_state_map_) {
134 if (pair.second->root()->id() == id) 129 if (pair.second->root()->id() == id)
135 return pair.second->root(); 130 return pair.second->root();
136 } 131 }
137 return nullptr; 132 return nullptr;
138 } 133 }
139 134
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 void Display::OnNativeCaptureLost() { 280 void Display::OnNativeCaptureLost() {
286 WindowManagerState* state = GetActiveWindowManagerState(); 281 WindowManagerState* state = GetActiveWindowManagerState();
287 if (state) 282 if (state)
288 state->SetCapture(nullptr, false); 283 state->SetCapture(nullptr, false);
289 } 284 }
290 285
291 void Display::OnDisplayClosed() { 286 void Display::OnDisplayClosed() {
292 display_manager()->DestroyDisplay(this); 287 display_manager()->DestroyDisplay(this);
293 } 288 }
294 289
295 void Display::OnViewportMetricsChanged( 290 void Display::OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
296 const mojom::ViewportMetrics& old_metrics, 291 const ViewportMetrics& new_metrics) {
297 const mojom::ViewportMetrics& new_metrics) {
298 if (!root_) { 292 if (!root_) {
299 root_.reset(window_server_->CreateServerWindow( 293 root_.reset(window_server_->CreateServerWindow(
300 display_manager()->GetAndAdvanceNextRootId(), 294 display_manager()->GetAndAdvanceNextRootId(),
301 ServerWindow::Properties())); 295 ServerWindow::Properties()));
302 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>())); 296 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels));
303 root_->SetVisible(true); 297 root_->SetVisible(true);
304 focus_controller_.reset(new FocusController(this, root_.get())); 298 focus_controller_.reset(new FocusController(this, root_.get()));
305 focus_controller_->AddObserver(this); 299 focus_controller_->AddObserver(this);
306 InitWindowManagersIfNecessary(); 300 InitWindowManagersIfNecessary();
307 } else { 301 } else {
308 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>())); 302 root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels));
309 const gfx::Rect wm_bounds(root_->bounds().size()); 303 const gfx::Rect wm_bounds(root_->bounds().size());
310 for (auto& pair : window_manager_state_map_) 304 for (auto& pair : window_manager_state_map_)
311 pair.second->root()->SetBounds(wm_bounds); 305 pair.second->root()->SetBounds(wm_bounds);
312 } 306 }
313 display_manager()->OnDisplayUpdate(this); 307 display_manager()->OnDisplayUpdate(this);
314 } 308 }
315 309
316 void Display::OnCompositorFrameDrawn() { 310 void Display::OnCompositorFrameDrawn() {
317 std::set<ServerWindow*> windows; 311 std::set<ServerWindow*> windows;
318 windows.swap(windows_needing_frame_destruction_); 312 windows.swap(windows_needing_frame_destruction_);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 DCHECK_EQ(0u, window_manager_state_map_.count(id)); 452 DCHECK_EQ(0u, window_manager_state_map_.count(id));
459 } 453 }
460 454
461 void Display::OnWindowManagerFactorySet(WindowManagerFactoryService* service) { 455 void Display::OnWindowManagerFactorySet(WindowManagerFactoryService* service) {
462 if (!binding_) 456 if (!binding_)
463 CreateWindowManagerStateFromService(service); 457 CreateWindowManagerStateFromService(service);
464 } 458 }
465 459
466 } // namespace ws 460 } // namespace ws
467 } // namespace mus 461 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/display.h ('k') | components/mus/ws/platform_display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698