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

Side by Side Diff: services/ui/ws/display.cc

Issue 2904993003: chromeos: changes how DisplayManagerObservers are notified (Closed)
Patch Set: cleanup Created 3 years, 7 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 | « services/ui/ws/display.h ('k') | services/ui/ws/display_creation_config.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 "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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 } 184 }
185 } 185 }
186 186
187 void Display::RemoveWindowManagerDisplayRoot( 187 void Display::RemoveWindowManagerDisplayRoot(
188 WindowManagerDisplayRoot* display_root) { 188 WindowManagerDisplayRoot* display_root) {
189 for (auto it = window_manager_display_root_map_.begin(); 189 for (auto it = window_manager_display_root_map_.begin();
190 it != window_manager_display_root_map_.end(); ++it) { 190 it != window_manager_display_root_map_.end(); ++it) {
191 if (it->second == display_root) { 191 if (it->second == display_root) {
192 window_manager_display_root_map_.erase(it); 192 window_manager_display_root_map_.erase(it);
193 if (window_manager_display_root_map_.empty())
194 display_manager()->DestroyDisplay(this);
193 return; 195 return;
194 } 196 }
195 } 197 }
196 NOTREACHED(); 198 NOTREACHED();
197 } 199 }
198 200
199 void Display::SetNativeCursor(const ui::CursorData& cursor) { 201 void Display::SetNativeCursor(const ui::CursorData& cursor) {
200 platform_display_->SetCursor(cursor); 202 platform_display_->SetCursor(cursor);
201 } 203 }
202 204
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return OzonePlatform::GetInstance(); 294 return OzonePlatform::GetInstance();
293 #else 295 #else
294 return nullptr; 296 return nullptr;
295 #endif 297 #endif
296 } 298 }
297 299
298 void Display::OnViewportMetricsChanged( 300 void Display::OnViewportMetricsChanged(
299 const display::ViewportMetrics& metrics) { 301 const display::ViewportMetrics& metrics) {
300 platform_display_->UpdateViewportMetrics(metrics); 302 platform_display_->UpdateViewportMetrics(metrics);
301 303
302 if (root_->bounds().size() == metrics.bounds_in_pixels.size()) 304 SetBoundsInPixels(metrics.bounds_in_pixels);
305 }
306
307 void Display::SetBoundsInPixels(const gfx::Rect& bounds_in_pixels) {
308 if (root_->bounds().size() == bounds_in_pixels.size())
303 return; 309 return;
304 310
305 gfx::Rect new_bounds(metrics.bounds_in_pixels.size()); 311 gfx::Rect new_bounds(bounds_in_pixels.size());
306 root_->SetBounds(new_bounds, allocator_.GenerateId()); 312 root_->SetBounds(new_bounds, allocator_.GenerateId());
307 for (auto& pair : window_manager_display_root_map_) 313 for (auto& pair : window_manager_display_root_map_)
308 pair.second->root()->SetBounds(new_bounds, allocator_.GenerateId()); 314 pair.second->root()->SetBounds(new_bounds, allocator_.GenerateId());
309 } 315 }
310 316
311 ServerWindow* Display::GetActiveRootWindow() { 317 ServerWindow* Display::GetActiveRootWindow() {
312 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); 318 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot();
313 if (display_root) 319 if (display_root)
314 return display_root->root(); 320 return display_root->root();
315 return nullptr; 321 return nullptr;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 413
408 UserActivityMonitor* activity_monitor = 414 UserActivityMonitor* activity_monitor =
409 window_server_->GetUserActivityMonitorForUser( 415 window_server_->GetUserActivityMonitorForUser(
410 window_server_->user_id_tracker()->active_id()); 416 window_server_->user_id_tracker()->active_id());
411 activity_monitor->OnUserActivity(); 417 activity_monitor->OnUserActivity();
412 return EventDispatchDetails(); 418 return EventDispatchDetails();
413 } 419 }
414 420
415 } // namespace ws 421 } // namespace ws
416 } // namespace ui 422 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/display.h ('k') | services/ui/ws/display_creation_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698