| OLD | NEW |
| 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 "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 <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "ui/base/win/dpi.h" | 10 #include "ui/base/win/dpi.h" |
| 11 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
| 12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 using api::system_info_display::Bounds; | 16 using api::system_info_display::Bounds; |
| 17 using api::system_info_display::DisplayUnitInfo; | 17 using api::system_info_display::DisplayUnitInfo; |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 void DisplayInfoProvider::RequestInfo(const RequestInfoCallback& callback) { |
| 22 // Redirect the request to a worker pool thread. |
| 23 StartQueryInfo(callback); |
| 24 } |
| 25 |
| 21 BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, | 26 BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, |
| 22 HDC hdc, | 27 HDC hdc, |
| 23 LPRECT rect, | 28 LPRECT rect, |
| 24 LPARAM data) { | 29 LPARAM data) { |
| 25 DisplayInfo* display_info = | 30 DisplayInfo* display_info = |
| 26 reinterpret_cast<DisplayInfo*>(data); | 31 reinterpret_cast<DisplayInfo*>(data); |
| 27 DCHECK(display_info); | 32 DCHECK(display_info); |
| 28 | 33 |
| 29 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo); | 34 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo); |
| 30 | 35 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 DCHECK(info); | 76 DCHECK(info); |
| 72 info->clear(); | 77 info->clear(); |
| 73 | 78 |
| 74 if (EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, | 79 if (EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, |
| 75 reinterpret_cast<LPARAM>(info))) | 80 reinterpret_cast<LPARAM>(info))) |
| 76 return true; | 81 return true; |
| 77 return false; | 82 return false; |
| 78 } | 83 } |
| 79 | 84 |
| 80 } // namespace extensions | 85 } // namespace extensions |
| OLD | NEW |