| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/api/system_info_display/display_info_provide
r.h" | 5 #include "chrome/browser/extensions/api/system_info_display/display_info_provide
r.h" |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); | 35 int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); |
| 36 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 36 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
| 37 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); | 37 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo()); |
| 38 const gfx::Display* display = display_manager->GetDisplayAt(i); | 38 const gfx::Display* display = display_manager->GetDisplayAt(i); |
| 39 const gfx::Rect& bounds = display->bounds(); | 39 const gfx::Rect& bounds = display->bounds(); |
| 40 const gfx::Rect& work_area = display->work_area(); | 40 const gfx::Rect& work_area = display->work_area(); |
| 41 const float dpi = display->device_scale_factor() * kDpi96; | 41 const float dpi = display->device_scale_factor() * kDpi96; |
| 42 unit->id = base::Int64ToString(display->id()); | 42 unit->id = base::Int64ToString(display->id()); |
| 43 unit->name = display_manager->GetDisplayNameFor(*display); | 43 unit->name = display_manager->GetDisplayNameFor(*display); |
| 44 unit->is_primary = (display->id() == primary_id); | 44 unit->is_primary = (display->id() == primary_id); |
| 45 unit->is_internal = display_manager->IsInternalDisplayId(display->id()); | 45 unit->is_internal = display->IsInternal(); |
| 46 unit->is_enabled = true; | 46 unit->is_enabled = true; |
| 47 unit->dpi_x = dpi; | 47 unit->dpi_x = dpi; |
| 48 unit->dpi_y = dpi; | 48 unit->dpi_y = dpi; |
| 49 unit->bounds.left = bounds.x(); | 49 unit->bounds.left = bounds.x(); |
| 50 unit->bounds.top = bounds.y(); | 50 unit->bounds.top = bounds.y(); |
| 51 unit->bounds.width = bounds.width(); | 51 unit->bounds.width = bounds.width(); |
| 52 unit->bounds.height = bounds.height(); | 52 unit->bounds.height = bounds.height(); |
| 53 unit->work_area.left = work_area.x(); | 53 unit->work_area.left = work_area.x(); |
| 54 unit->work_area.top = work_area.y(); | 54 unit->work_area.top = work_area.y(); |
| 55 unit->work_area.width = work_area.width(); | 55 unit->work_area.width = work_area.width(); |
| 56 unit->work_area.height = work_area.height(); | 56 unit->work_area.height = work_area.height(); |
| 57 info->push_back(unit); | 57 info->push_back(unit); |
| 58 } | 58 } |
| 59 | 59 |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace extensions | 63 } // namespace extensions |
| OLD | NEW |