| 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 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_ | 5 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ | 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/display/display_export.h" | 14 #include "ui/display/display_export.h" |
| 15 #include "ui/display/screen.h" |
| 15 #include "ui/gfx/display_change_notifier.h" | 16 #include "ui/gfx/display_change_notifier.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/gfx/screen.h" | |
| 18 #include "ui/gfx/win/singleton_hwnd_observer.h" | 18 #include "ui/gfx/win/singleton_hwnd_observer.h" |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class Display; | 21 class Display; |
| 22 class Point; | 22 class Point; |
| 23 class Rect; | 23 class Rect; |
| 24 class Size; | 24 class Size; |
| 25 } // namespace gfx | 25 } // namespace gfx |
| 26 | 26 |
| 27 namespace display { | 27 namespace display { |
| 28 namespace win { | 28 namespace win { |
| 29 | 29 |
| 30 class DisplayInfo; | 30 class DisplayInfo; |
| 31 class ScreenWinDisplay; | 31 class ScreenWinDisplay; |
| 32 | 32 |
| 33 class DISPLAY_EXPORT ScreenWin : public gfx::Screen { | 33 class DISPLAY_EXPORT ScreenWin : public display::Screen { |
| 34 public: | 34 public: |
| 35 ScreenWin(); | 35 ScreenWin(); |
| 36 ~ScreenWin() override; | 36 ~ScreenWin() override; |
| 37 | 37 |
| 38 // Converts a screen physical point to a screen DIP point. | 38 // Converts a screen physical point to a screen DIP point. |
| 39 // The DPI scale is performed relative to the display containing the physical | 39 // The DPI scale is performed relative to the display containing the physical |
| 40 // point. | 40 // point. |
| 41 static gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point); | 41 static gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point); |
| 42 | 42 |
| 43 // Converts a screen DIP point to a screen physical point. | 43 // Converts a screen DIP point to a screen physical point. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // The DPI scale is performed relative to the display nearest to |hwnd|. | 89 // The DPI scale is performed relative to the display nearest to |hwnd|. |
| 90 static gfx::Size DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size); | 90 static gfx::Size DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size); |
| 91 | 91 |
| 92 // Returns the HWND associated with the NativeView. | 92 // Returns the HWND associated with the NativeView. |
| 93 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; | 93 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; |
| 94 | 94 |
| 95 // Returns the NativeView associated with the HWND. | 95 // Returns the NativeView associated with the HWND. |
| 96 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; | 96 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; |
| 97 | 97 |
| 98 protected: | 98 protected: |
| 99 // gfx::Screen: | 99 // display::Screen: |
| 100 gfx::Point GetCursorScreenPoint() override; | 100 gfx::Point GetCursorScreenPoint() override; |
| 101 gfx::NativeWindow GetWindowUnderCursor() override; | 101 gfx::NativeWindow GetWindowUnderCursor() override; |
| 102 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 102 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 103 int GetNumDisplays() const override; | 103 int GetNumDisplays() const override; |
| 104 std::vector<gfx::Display> GetAllDisplays() const override; | 104 std::vector<display::Display> GetAllDisplays() const override; |
| 105 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override; | 105 display::Display GetDisplayNearestWindow( |
| 106 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; | 106 gfx::NativeView window) const override; |
| 107 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; | 107 display::Display GetDisplayNearestPoint( |
| 108 gfx::Display GetPrimaryDisplay() const override; | 108 const gfx::Point& point) const override; |
| 109 void AddObserver(gfx::DisplayObserver* observer) override; | 109 display::Display GetDisplayMatching( |
| 110 void RemoveObserver(gfx::DisplayObserver* observer) override; | 110 const gfx::Rect& match_rect) const override; |
| 111 display::Display GetPrimaryDisplay() const override; |
| 112 void AddObserver(display::DisplayObserver* observer) override; |
| 113 void RemoveObserver(display::DisplayObserver* observer) override; |
| 111 | 114 |
| 112 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos); | 115 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos); |
| 113 | 116 |
| 114 // Virtual to support mocking by unit tests. | 117 // Virtual to support mocking by unit tests. |
| 115 virtual void Initialize(); | 118 virtual void Initialize(); |
| 116 virtual MONITORINFOEX MonitorInfoFromScreenPoint( | 119 virtual MONITORINFOEX MonitorInfoFromScreenPoint( |
| 117 const gfx::Point& screen_point) const; | 120 const gfx::Point& screen_point) const; |
| 118 virtual MONITORINFOEX MonitorInfoFromScreenRect(const gfx::Rect& screen_rect) | 121 virtual MONITORINFOEX MonitorInfoFromScreenRect(const gfx::Rect& screen_rect) |
| 119 const; | 122 const; |
| 120 virtual MONITORINFOEX MonitorInfoFromWindow(HWND hwnd, DWORD default_options) | 123 virtual MONITORINFOEX MonitorInfoFromWindow(HWND hwnd, DWORD default_options) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 148 // Current list of ScreenWinDisplays. | 151 // Current list of ScreenWinDisplays. |
| 149 std::vector<ScreenWinDisplay> screen_win_displays_; | 152 std::vector<ScreenWinDisplay> screen_win_displays_; |
| 150 | 153 |
| 151 DISALLOW_COPY_AND_ASSIGN(ScreenWin); | 154 DISALLOW_COPY_AND_ASSIGN(ScreenWin); |
| 152 }; | 155 }; |
| 153 | 156 |
| 154 } // namespace win | 157 } // namespace win |
| 155 } // namespace display | 158 } // namespace display |
| 156 | 159 |
| 157 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ | 160 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| OLD | NEW |