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

Side by Side Diff: ui/display/manager/display_manager.cc

Issue 2728803002: Handles users rotating screen too early (Closed)
Patch Set: Rebased to commit. Created 3 years, 9 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 | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/display/manager/display_manager.h" 5 #include "ui/display/manager/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 for (int64_t id : updated_ids) { 258 for (int64_t id : updated_ids) {
259 NotifyMetricsChanged(GetDisplayForId(id), 259 NotifyMetricsChanged(GetDisplayForId(id),
260 DisplayObserver::DISPLAY_METRIC_BOUNDS | 260 DisplayObserver::DISPLAY_METRIC_BOUNDS |
261 DisplayObserver::DISPLAY_METRIC_WORK_AREA); 261 DisplayObserver::DISPLAY_METRIC_WORK_AREA);
262 } 262 }
263 263
264 if (delegate_) 264 if (delegate_)
265 delegate_->PostDisplayConfigurationChange(false); 265 delegate_->PostDisplayConfigurationChange(false);
266 } 266 }
267 267
268 const Display& DisplayManager::GetDisplayForId(int64_t id) const { 268 const Display& DisplayManager::GetDisplayForId(int64_t display_id) const {
269 Display* display = const_cast<DisplayManager*>(this)->FindDisplayForId(id); 269 Display* display =
270 const_cast<DisplayManager*>(this)->FindDisplayForId(display_id);
270 return display ? *display : GetInvalidDisplay(); 271 return display ? *display : GetInvalidDisplay();
271 } 272 }
272 273
274 bool DisplayManager::IsDisplayIdValid(int64_t display_id) const {
275 return GetDisplayForId(display_id).is_valid();
276 }
277
273 const Display& DisplayManager::FindDisplayContainingPoint( 278 const Display& DisplayManager::FindDisplayContainingPoint(
274 const gfx::Point& point_in_screen) const { 279 const gfx::Point& point_in_screen) const {
275 auto iter = display::FindDisplayContainingPoint(active_display_list_, 280 auto iter = display::FindDisplayContainingPoint(active_display_list_,
276 point_in_screen); 281 point_in_screen);
277 return iter == active_display_list_.end() ? GetInvalidDisplay() : *iter; 282 return iter == active_display_list_.end() ? GetInvalidDisplay() : *iter;
278 } 283 }
279 284
280 bool DisplayManager::UpdateWorkAreaOfDisplay(int64_t display_id, 285 bool DisplayManager::UpdateWorkAreaOfDisplay(int64_t display_id,
281 const gfx::Insets& insets) { 286 const gfx::Insets& insets) {
282 Display* display = FindDisplayForId(display_id); 287 Display* display = FindDisplayForId(display_id);
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 } 1456 }
1452 1457
1453 const Display& DisplayManager::GetSecondaryDisplay() const { 1458 const Display& DisplayManager::GetSecondaryDisplay() const {
1454 CHECK_LE(2U, GetNumDisplays()); 1459 CHECK_LE(2U, GetNumDisplays());
1455 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() 1460 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id()
1456 ? GetDisplayAt(1) 1461 ? GetDisplayAt(1)
1457 : GetDisplayAt(0); 1462 : GetDisplayAt(0);
1458 } 1463 }
1459 1464
1460 } // namespace display 1465 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698