| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 display::Screen { | 33 class DISPLAY_EXPORT ScreenWin : public 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Returns |hwnd|'s scale factor. | 102 // Returns |hwnd|'s scale factor. |
| 103 static float GetScaleFactorForHWND(HWND hwnd); | 103 static float GetScaleFactorForHWND(HWND hwnd); |
| 104 | 104 |
| 105 // Returns the HWND associated with the NativeView. | 105 // Returns the HWND associated with the NativeView. |
| 106 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; | 106 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; |
| 107 | 107 |
| 108 // Returns the NativeView associated with the HWND. | 108 // Returns the NativeView associated with the HWND. |
| 109 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; | 109 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; |
| 110 | 110 |
| 111 protected: | 111 protected: |
| 112 // display::Screen: | 112 // Screen: |
| 113 gfx::Point GetCursorScreenPoint() override; | 113 gfx::Point GetCursorScreenPoint() override; |
| 114 bool IsWindowUnderCursor(gfx::NativeWindow window) override; | 114 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
| 115 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 115 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 116 int GetNumDisplays() const override; | 116 int GetNumDisplays() const override; |
| 117 const std::vector<display::Display>& GetAllDisplays() const override; | 117 const std::vector<Display>& GetAllDisplays() const override; |
| 118 display::Display GetDisplayNearestWindow( | 118 Display GetDisplayNearestWindow(gfx::NativeView window) const override; |
| 119 gfx::NativeView window) const override; | 119 Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 120 display::Display GetDisplayNearestPoint( | 120 Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 121 const gfx::Point& point) const override; | 121 Display GetPrimaryDisplay() const override; |
| 122 display::Display GetDisplayMatching( | 122 void AddObserver(DisplayObserver* observer) override; |
| 123 const gfx::Rect& match_rect) const override; | 123 void RemoveObserver(DisplayObserver* observer) override; |
| 124 display::Display GetPrimaryDisplay() const override; | |
| 125 void AddObserver(display::DisplayObserver* observer) override; | |
| 126 void RemoveObserver(display::DisplayObserver* observer) override; | |
| 127 gfx::Rect ScreenToDIPRectInWindow( | 124 gfx::Rect ScreenToDIPRectInWindow( |
| 128 gfx::NativeView view, const gfx::Rect& screen_rect) const override; | 125 gfx::NativeView view, const gfx::Rect& screen_rect) const override; |
| 129 gfx::Rect DIPToScreenRectInWindow( | 126 gfx::Rect DIPToScreenRectInWindow( |
| 130 gfx::NativeView view, const gfx::Rect& dip_rect) const override; | 127 gfx::NativeView view, const gfx::Rect& dip_rect) const override; |
| 131 | 128 |
| 132 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos); | 129 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos); |
| 133 | 130 |
| 134 // Virtual to support mocking by unit tests. | 131 // Virtual to support mocking by unit tests. |
| 135 virtual void Initialize(); | 132 virtual void Initialize(); |
| 136 virtual MONITORINFOEX MonitorInfoFromScreenPoint( | 133 virtual MONITORINFOEX MonitorInfoFromScreenPoint( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void RecordDisplayScaleFactors() const; | 175 void RecordDisplayScaleFactors() const; |
| 179 | 176 |
| 180 // Helper implementing the DisplayObserver handling. | 177 // Helper implementing the DisplayObserver handling. |
| 181 DisplayChangeNotifier change_notifier_; | 178 DisplayChangeNotifier change_notifier_; |
| 182 | 179 |
| 183 std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_; | 180 std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_; |
| 184 | 181 |
| 185 // Current list of ScreenWinDisplays. | 182 // Current list of ScreenWinDisplays. |
| 186 std::vector<ScreenWinDisplay> screen_win_displays_; | 183 std::vector<ScreenWinDisplay> screen_win_displays_; |
| 187 | 184 |
| 188 // The display::Displays corresponding to |screen_win_displays_| for | 185 // The Displays corresponding to |screen_win_displays_| for GetAllDisplays(). |
| 189 // GetAllDisplays(). This must be updated anytime |screen_win_displays_| is | 186 // This must be updated anytime |screen_win_displays_| is updated. |
| 190 // updated. | 187 std::vector<Display> displays_; |
| 191 std::vector<display::Display> displays_; | |
| 192 | 188 |
| 193 DISALLOW_COPY_AND_ASSIGN(ScreenWin); | 189 DISALLOW_COPY_AND_ASSIGN(ScreenWin); |
| 194 }; | 190 }; |
| 195 | 191 |
| 196 } // namespace win | 192 } // namespace win |
| 197 } // namespace display | 193 } // namespace display |
| 198 | 194 |
| 199 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ | 195 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| OLD | NEW |