Commit 991afe78 authored by Hokein.Wu@gmail.com's avatar Hokein.Wu@gmail.com

Implement Screen::GetAllDisplays for windows.

BUG=122863

Review URL: https://chromiumcodereview.appspot.com/23415002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221576 0039d316-1c4b-4281-b951-d872f2087c98
parent a02358d3
...@@ -33,6 +33,20 @@ gfx::Display GetDisplay(MONITORINFOEX& monitor_info) { ...@@ -33,6 +33,20 @@ gfx::Display GetDisplay(MONITORINFOEX& monitor_info) {
return display; return display;
} }
BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor,
HDC hdc,
LPRECT rect,
LPARAM data) {
std::vector<gfx::Display>* all_displays =
reinterpret_cast<std::vector<gfx::Display>*>(data);
DCHECK(all_displays);
MONITORINFOEX monitor_info = GetMonitorInfoForMonitor(monitor);
gfx::Display display = GetDisplay(monitor_info);
all_displays->push_back(display);
return TRUE;
}
} // namespace } // namespace
namespace gfx { namespace gfx {
...@@ -68,8 +82,10 @@ int ScreenWin::GetNumDisplays() const { ...@@ -68,8 +82,10 @@ int ScreenWin::GetNumDisplays() const {
} }
std::vector<gfx::Display> ScreenWin::GetAllDisplays() const { std::vector<gfx::Display> ScreenWin::GetAllDisplays() const {
NOTIMPLEMENTED(); std::vector<gfx::Display> all_displays;
return std::vector<gfx::Display>(1, GetPrimaryDisplay()); EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback,
reinterpret_cast<LPARAM>(&all_displays));
return all_displays;
} }
gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const { gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment