| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_display/display_info_provider.h" | 5 #include "extensions/browser/api/system_display/display_info_provider.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/win/win_util.h" | 12 #include "base/win/win_util.h" |
| 13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
| 14 #include "ui/gfx/win/dpi.h" | 14 #include "ui/gfx/win/dpi.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 using api::system_display::DisplayUnitInfo; | 18 using core_api::system_display::DisplayUnitInfo; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, | 22 BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, |
| 23 HDC hdc, | 23 HDC hdc, |
| 24 LPRECT rect, | 24 LPRECT rect, |
| 25 LPARAM data) { | 25 LPARAM data) { |
| 26 DisplayInfo* all_displays = reinterpret_cast<DisplayInfo*>(data); | 26 DisplayInfo* all_displays = reinterpret_cast<DisplayInfo*>(data); |
| 27 DCHECK(all_displays); | 27 DCHECK(all_displays); |
| 28 | 28 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 unit->dpi_x = dpi.width(); | 45 unit->dpi_x = dpi.width(); |
| 46 unit->dpi_y = dpi.height(); | 46 unit->dpi_y = dpi.height(); |
| 47 all_displays->push_back(unit); | 47 all_displays->push_back(unit); |
| 48 | 48 |
| 49 return TRUE; | 49 return TRUE; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 bool DisplayInfoProvider::SetInfo(const std::string& display_id, | 54 bool DisplayInfoProvider::SetInfo(const std::string& display_id, |
| 55 const api::system_display::DisplayProperties& info, | 55 const core_api::system_display::DisplayProperties& info, |
| 56 std::string* error) { | 56 std::string* error) { |
| 57 *error = "Not implemented"; | 57 *error = "Not implemented"; |
| 58 return false; | 58 return false; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( | 61 void DisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( |
| 62 const gfx::Display& display, | 62 const gfx::Display& display, |
| 63 extensions::api::system_display::DisplayUnitInfo* unit) { | 63 extensions::core_api::system_display::DisplayUnitInfo* unit) { |
| 64 DisplayInfo all_displays; | 64 DisplayInfo all_displays; |
| 65 EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, | 65 EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, |
| 66 reinterpret_cast<LPARAM>(&all_displays)); | 66 reinterpret_cast<LPARAM>(&all_displays)); |
| 67 for (size_t i = 0; i < all_displays.size(); ++i) { | 67 for (size_t i = 0; i < all_displays.size(); ++i) { |
| 68 if (unit->id == all_displays[i]->id) { | 68 if (unit->id == all_displays[i]->id) { |
| 69 unit->name = all_displays[i]->name; | 69 unit->name = all_displays[i]->name; |
| 70 unit->dpi_x = all_displays[i]->dpi_x; | 70 unit->dpi_x = all_displays[i]->dpi_x; |
| 71 unit->dpi_y = all_displays[i]->dpi_y; | 71 unit->dpi_y = all_displays[i]->dpi_y; |
| 72 break; | 72 break; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace extensions | 77 } // namespace extensions |
| OLD | NEW |