Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: ui/gfx/screen_win.cc

Issue 23415002: Implement Screen::GetAllDisplays for windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_win.cc
diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
index 9ea1a4c833c73fb9e41fce4a6c2bdaf7d450aaf8..642db8571bb6b7803bf801e3a902a35e1931b71c 100644
--- a/ui/gfx/screen_win.cc
+++ b/ui/gfx/screen_win.cc
@@ -33,6 +33,20 @@ gfx::Display GetDisplay(MONITORINFOEX& monitor_info) {
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 gfx {
@@ -68,8 +82,10 @@ int ScreenWin::GetNumDisplays() const {
}
std::vector<gfx::Display> ScreenWin::GetAllDisplays() const {
- NOTIMPLEMENTED();
- return std::vector<gfx::Display>(1, GetPrimaryDisplay());
+ std::vector<gfx::Display> all_displays;
+ EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback,
+ reinterpret_cast<LPARAM>(&all_displays));
+ return all_displays;
}
gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698