Migrate away from the PrefMetricsService-based device ID in PrefHashCalculator.
[chromium-blink-merge.git] / ui / views / widget / monitor_win.cc
blob1220671beb85e2715b96d1aa7fa0a0825c833d6c
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
3 // found in the LICENSE file.
5 #include "ui/views/widget/monitor_win.h"
7 #include <windows.h>
9 #include "base/logging.h"
10 #include "ui/gfx/rect.h"
12 namespace views {
14 gfx::Rect GetMonitorBoundsForRect(const gfx::Rect& rect) {
15 RECT p_rect = rect.ToRECT();
16 HMONITOR monitor = MonitorFromRect(&p_rect, MONITOR_DEFAULTTONEAREST);
17 if (monitor) {
18 MONITORINFO mi = { sizeof(MONITORINFO) };
19 GetMonitorInfo(monitor, &mi);
20 return gfx::Rect(mi.rcWork);
22 NOTREACHED();
23 return gfx::Rect();
26 } // namespace views