OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ui/views/widget/desktop_aura/desktop_screen_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/aura/root_window.h" | 8 #include "ui/aura/root_window.h" |
9 #include "ui/aura/root_window_host.h" | 9 #include "ui/aura/root_window_host.h" |
10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool DesktopScreenWin::IsDIPEnabled() { | 45 bool DesktopScreenWin::IsDIPEnabled() { |
46 return true; | 46 return true; |
47 } | 47 } |
48 | 48 |
49 gfx::Display DesktopScreenWin::GetDisplayMatching( | 49 gfx::Display DesktopScreenWin::GetDisplayMatching( |
50 const gfx::Rect& match_rect) const { | 50 const gfx::Rect& match_rect) const { |
51 return GetDisplayNearestPoint(match_rect.CenterPoint()); | 51 return GetDisplayNearestPoint(match_rect.CenterPoint()); |
52 } | 52 } |
53 | 53 |
54 HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { | 54 HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { |
55 return window->GetRootWindow()->GetAcceleratedWidget(); | 55 aura::RootWindow* root_window = window->GetRootWindow(); |
| 56 return root_window ? root_window->GetAcceleratedWidget() : NULL; |
56 } | 57 } |
57 | 58 |
58 gfx::NativeWindow DesktopScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { | 59 gfx::NativeWindow DesktopScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { |
59 return (::IsWindow(hwnd)) ? | 60 return (::IsWindow(hwnd)) ? |
60 aura::RootWindow::GetForAcceleratedWidget(hwnd) : NULL; | 61 aura::RootWindow::GetForAcceleratedWidget(hwnd) : NULL; |
61 } | 62 } |
62 | 63 |
63 //////////////////////////////////////////////////////////////////////////////// | 64 //////////////////////////////////////////////////////////////////////////////// |
64 | 65 |
65 gfx::Screen* CreateDesktopScreen() { | 66 gfx::Screen* CreateDesktopScreen() { |
66 return new DesktopScreenWin; | 67 return new DesktopScreenWin; |
67 } | 68 } |
68 | 69 |
69 } // namespace views | 70 } // namespace views |
OLD | NEW |