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/desktop_aura/desktop_screen_win.h"
7 #include "base/logging.h"
8 #include "ui/aura/window.h"
9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/aura/window_tree_host.h"
11 #include "ui/gfx/display.h"
12 #include "ui/views/widget/desktop_aura/desktop_screen.h"
13 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
17 ////////////////////////////////////////////////////////////////////////////////
18 // DesktopScreenWin, public:
20 DesktopScreenWin::DesktopScreenWin() {
23 DesktopScreenWin::~DesktopScreenWin() {
26 ////////////////////////////////////////////////////////////////////////////////
27 // DesktopScreenWin, gfx::ScreenWin implementation:
29 bool DesktopScreenWin::IsDIPEnabled() {
33 gfx::Display
DesktopScreenWin::GetDisplayMatching(
34 const gfx::Rect
& match_rect
) const {
35 return GetDisplayNearestPoint(match_rect
.CenterPoint());
38 HWND
DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window
) const {
39 aura::WindowTreeHost
* host
= window
->GetHost();
40 return host
? host
->GetAcceleratedWidget() : NULL
;
43 gfx::NativeWindow
DesktopScreenWin::GetNativeWindowFromHWND(HWND hwnd
) const {
44 return (::IsWindow(hwnd
)) ?
45 DesktopWindowTreeHostWin::GetContentWindowForHWND(hwnd
) : NULL
;
48 ////////////////////////////////////////////////////////////////////////////////
50 gfx::Screen
* CreateDesktopScreen() {
51 return new DesktopScreenWin
;