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

Side by Side Diff: chrome/browser/extensions/display_info_provider_chromeos.cc

Issue 620663005: Lock screen for Chrome-Athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more nit Created 6 years, 2 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 | « chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc ('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 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 "chrome/browser/extensions/display_info_provider_chromeos.h" 5 #include "chrome/browser/extensions/display_info_provider_chromeos.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "extensions/common/api/system_display.h" 12 #include "extensions/common/api/system_display.h"
13 #include "ui/gfx/display.h" 13 #include "ui/gfx/display.h"
14 #include "ui/gfx/point.h" 14 #include "ui/gfx/point.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 16
17 using ash::DisplayManager; 17 using ash::DisplayManager;
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 using core_api::system_display::Bounds; 21 using core_api::system_display::Bounds;
22 using core_api::system_display::DisplayUnitInfo; 22 using core_api::system_display::DisplayUnitInfo;
23 using core_api::system_display::DisplayProperties; 23 using core_api::system_display::DisplayProperties;
24 using core_api::system_display::Insets; 24 using core_api::system_display::Insets;
25 25
26 namespace { 26 namespace {
27 27
28 // TODO(hshi): determine the DPI of the screen.
29 const float kDpi96 = 96.0;
30 // Maximum allowed bounds origin absolute value. 28 // Maximum allowed bounds origin absolute value.
31 const int kMaxBoundsOrigin = 200 * 1000; 29 const int kMaxBoundsOrigin = 200 * 1000;
32 30
33 // Checks if the given integer value is valid display rotation in degrees. 31 // Checks if the given integer value is valid display rotation in degrees.
34 bool IsValidRotationValue(int rotation) { 32 bool IsValidRotationValue(int rotation) {
35 return rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270; 33 return rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270;
36 } 34 }
37 35
38 // Converts integer integer value in degrees to Rotation enum value. 36 // Converts integer integer value in degrees to Rotation enum value.
39 gfx::Display::Rotation DegreesToRotation(int degrees) { 37 gfx::Display::Rotation DegreesToRotation(int degrees) {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 UpdateDisplayLayout( 351 UpdateDisplayLayout(
354 primary.bounds(), primary.id(), target_bounds, target.id()); 352 primary.bounds(), primary.id(), target_bounds, target.id());
355 } 353 }
356 354
357 return true; 355 return true;
358 } 356 }
359 357
360 void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform( 358 void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform(
361 const gfx::Display& display, 359 const gfx::Display& display,
362 extensions::core_api::system_display::DisplayUnitInfo* unit) { 360 extensions::core_api::system_display::DisplayUnitInfo* unit) {
361 #if !defined(USE_ATHENA)
362 // TODO(dpolukhin): put something reasonable to the unit without ash::Shell.
363 // crbug.com/416961
363 ash::DisplayManager* display_manager = 364 ash::DisplayManager* display_manager =
364 ash::Shell::GetInstance()->display_manager(); 365 ash::Shell::GetInstance()->display_manager();
365 unit->name = display_manager->GetDisplayNameForId(display.id()); 366 unit->name = display_manager->GetDisplayNameForId(display.id());
366 if (display_manager->IsMirrored()) { 367 if (display_manager->IsMirrored()) {
367 unit->mirroring_source_id = 368 unit->mirroring_source_id =
368 base::Int64ToString(display_manager->mirrored_display_id()); 369 base::Int64ToString(display_manager->mirrored_display_id());
369 } 370 }
370 371
372 // TODO(hshi): determine the DPI of the screen.
373 const float kDpi96 = 96.0;
374
371 const float dpi = display.device_scale_factor() * kDpi96; 375 const float dpi = display.device_scale_factor() * kDpi96;
372 unit->dpi_x = dpi; 376 unit->dpi_x = dpi;
373 unit->dpi_y = dpi; 377 unit->dpi_y = dpi;
374 378
375 const gfx::Insets overscan_insets = 379 const gfx::Insets overscan_insets =
376 display_manager->GetOverscanInsets(display.id()); 380 display_manager->GetOverscanInsets(display.id());
377 unit->overscan.left = overscan_insets.left(); 381 unit->overscan.left = overscan_insets.left();
378 unit->overscan.top = overscan_insets.top(); 382 unit->overscan.top = overscan_insets.top();
379 unit->overscan.right = overscan_insets.right(); 383 unit->overscan.right = overscan_insets.right();
380 unit->overscan.bottom = overscan_insets.bottom(); 384 unit->overscan.bottom = overscan_insets.bottom();
385 #endif
381 } 386 }
382 387
383 gfx::Screen* DisplayInfoProviderChromeOS::GetActiveScreen() { 388 gfx::Screen* DisplayInfoProviderChromeOS::GetActiveScreen() {
384 return ash::Shell::GetScreen(); 389 return ash::Shell::GetScreen();
385 } 390 }
386 391
387 // static 392 // static
388 DisplayInfoProvider* DisplayInfoProvider::Create() { 393 DisplayInfoProvider* DisplayInfoProvider::Create() {
389 return new DisplayInfoProviderChromeOS(); 394 return new DisplayInfoProviderChromeOS();
390 } 395 }
391 396
392 } // namespace extensions 397 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698