OLD | NEW |
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_win.h" | 5 #include "chrome/browser/extensions/display_info_provider_win.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 "chrome/common/extensions/api/system_display.h" | 13 #include "extensions/common/api/system_display.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 #include "ui/gfx/win/dpi.h" | 15 #include "ui/gfx/win/dpi.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 using api::system_display::DisplayUnitInfo; | 19 using core_api::system_display::DisplayUnitInfo; |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 BOOL CALLBACK | 23 BOOL CALLBACK |
24 EnumMonitorCallback(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data) { | 24 EnumMonitorCallback(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM data) { |
25 DisplayInfo* all_displays = reinterpret_cast<DisplayInfo*>(data); | 25 DisplayInfo* all_displays = reinterpret_cast<DisplayInfo*>(data); |
26 DCHECK(all_displays); | 26 DCHECK(all_displays); |
27 | 27 |
28 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo); | 28 linked_ptr<DisplayUnitInfo> unit(new DisplayUnitInfo); |
29 | 29 |
(...skipping 21 matching lines...) Expand all Loading... |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 DisplayInfoProviderWin::DisplayInfoProviderWin() { | 53 DisplayInfoProviderWin::DisplayInfoProviderWin() { |
54 } | 54 } |
55 | 55 |
56 DisplayInfoProviderWin::~DisplayInfoProviderWin() { | 56 DisplayInfoProviderWin::~DisplayInfoProviderWin() { |
57 } | 57 } |
58 | 58 |
59 bool DisplayInfoProviderWin::SetInfo( | 59 bool DisplayInfoProviderWin::SetInfo( |
60 const std::string& display_id, | 60 const std::string& display_id, |
61 const api::system_display::DisplayProperties& info, | 61 const core_api::system_display::DisplayProperties& info, |
62 std::string* error) { | 62 std::string* error) { |
63 *error = "Not implemented"; | 63 *error = "Not implemented"; |
64 return false; | 64 return false; |
65 } | 65 } |
66 | 66 |
67 void DisplayInfoProviderWin::UpdateDisplayUnitInfoForPlatform( | 67 void DisplayInfoProviderWin::UpdateDisplayUnitInfoForPlatform( |
68 const gfx::Display& display, | 68 const gfx::Display& display, |
69 extensions::api::system_display::DisplayUnitInfo* unit) { | 69 extensions::core_api::system_display::DisplayUnitInfo* unit) { |
70 DisplayInfo all_displays; | 70 DisplayInfo all_displays; |
71 EnumDisplayMonitors( | 71 EnumDisplayMonitors( |
72 NULL, NULL, EnumMonitorCallback, reinterpret_cast<LPARAM>(&all_displays)); | 72 NULL, NULL, EnumMonitorCallback, reinterpret_cast<LPARAM>(&all_displays)); |
73 for (size_t i = 0; i < all_displays.size(); ++i) { | 73 for (size_t i = 0; i < all_displays.size(); ++i) { |
74 if (unit->id == all_displays[i]->id) { | 74 if (unit->id == all_displays[i]->id) { |
75 unit->name = all_displays[i]->name; | 75 unit->name = all_displays[i]->name; |
76 unit->dpi_x = all_displays[i]->dpi_x; | 76 unit->dpi_x = all_displays[i]->dpi_x; |
77 unit->dpi_y = all_displays[i]->dpi_y; | 77 unit->dpi_y = all_displays[i]->dpi_y; |
78 break; | 78 break; |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 gfx::Screen* DisplayInfoProviderWin::GetActiveScreen() { | 83 gfx::Screen* DisplayInfoProviderWin::GetActiveScreen() { |
84 return NULL; | 84 return NULL; |
85 } | 85 } |
86 | 86 |
87 // static | 87 // static |
88 DisplayInfoProvider* DisplayInfoProvider::Create() { | 88 DisplayInfoProvider* DisplayInfoProvider::Create() { |
89 return new DisplayInfoProviderWin(); | 89 return new DisplayInfoProviderWin(); |
90 } | 90 } |
91 | 91 |
92 } // namespace extensions | 92 } // namespace extensions |
OLD | NEW |