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

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

Issue 2950083002: Add accelerometer support property to Display. (Closed)
Patch Set: fixed to bool Created 3 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 | « 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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 float device_scale_factor = display_info.GetEffectiveDeviceScaleFactor(); 1384 float device_scale_factor = display_info.GetEffectiveDeviceScaleFactor();
1385 1385
1386 // Simply set the origin to (0,0). The primary display's origin is 1386 // Simply set the origin to (0,0). The primary display's origin is
1387 // always (0,0) and the bounds of non-primary display(s) will be updated 1387 // always (0,0) and the bounds of non-primary display(s) will be updated
1388 // in |UpdateNonPrimaryDisplayBoundsForLayout| called in |UpdateDisplay|. 1388 // in |UpdateNonPrimaryDisplayBoundsForLayout| called in |UpdateDisplay|.
1389 new_display.SetScaleAndBounds(device_scale_factor, 1389 new_display.SetScaleAndBounds(device_scale_factor,
1390 gfx::Rect(bounds_in_native.size())); 1390 gfx::Rect(bounds_in_native.size()));
1391 new_display.set_rotation(display_info.GetActiveRotation()); 1391 new_display.set_rotation(display_info.GetActiveRotation());
1392 new_display.set_touch_support(display_info.touch_support()); 1392 new_display.set_touch_support(display_info.touch_support());
1393 new_display.set_maximum_cursor_size(display_info.maximum_cursor_size()); 1393 new_display.set_maximum_cursor_size(display_info.maximum_cursor_size());
1394
1395 if (internal_display_has_accelerometer_ && Display::IsInternalDisplayId(id)) {
1396 new_display.set_accelerometer_support(
1397 Display::ACCELEROMETER_SUPPORT_AVAILABLE);
1398 } else {
1399 new_display.set_accelerometer_support(
1400 Display::ACCELEROMETER_SUPPORT_UNAVAILABLE);
1401 }
1394 return new_display; 1402 return new_display;
1395 } 1403 }
1396 1404
1397 Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById( 1405 Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById(
1398 int64_t id, 1406 int64_t id,
1399 const gfx::Point& origin, 1407 const gfx::Point& origin,
1400 float scale) { 1408 float scale) {
1401 DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id; 1409 DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id;
1402 const ManagedDisplayInfo& display_info = display_info_[id]; 1410 const ManagedDisplayInfo& display_info = display_info_[id];
1403 1411
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 } 1507 }
1500 1508
1501 const Display& DisplayManager::GetSecondaryDisplay() const { 1509 const Display& DisplayManager::GetSecondaryDisplay() const {
1502 CHECK_LE(2U, GetNumDisplays()); 1510 CHECK_LE(2U, GetNumDisplays());
1503 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() 1511 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id()
1504 ? GetDisplayAt(1) 1512 ? GetDisplayAt(1)
1505 : GetDisplayAt(0); 1513 : GetDisplayAt(0);
1506 } 1514 }
1507 1515
1508 } // namespace display 1516 } // 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