| 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_GFX_SCREEN_WIN_H_ | 5 #ifndef UI_GFX_SCREEN_WIN_H_ |
| 6 #define UI_GFX_SCREEN_WIN_H_ | 6 #define UI_GFX_SCREEN_WIN_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "ui/gfx/display_change_notifier.h" | 9 #include "ui/gfx/display_change_notifier.h" |
| 10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
| 11 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
| 12 #include "ui/gfx/win/singleton_hwnd.h" | 12 #include "ui/gfx/win/singleton_hwnd.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 | 15 |
| 16 class GFX_EXPORT ScreenWin : public Screen, | 16 class GFX_EXPORT ScreenWin : public Screen { |
| 17 public SingletonHwnd::Observer { | |
| 18 public: | 17 public: |
| 19 ScreenWin(); | 18 ScreenWin(); |
| 20 ~ScreenWin() override; | 19 ~ScreenWin() override; |
| 21 | 20 |
| 22 protected: | 21 protected: |
| 23 // Overridden from gfx::Screen: | 22 // Overridden from gfx::Screen: |
| 24 gfx::Point GetCursorScreenPoint() override; | 23 gfx::Point GetCursorScreenPoint() override; |
| 25 gfx::NativeWindow GetWindowUnderCursor() override; | 24 gfx::NativeWindow GetWindowUnderCursor() override; |
| 26 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 25 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 27 int GetNumDisplays() const override; | 26 int GetNumDisplays() const override; |
| 28 std::vector<gfx::Display> GetAllDisplays() const override; | 27 std::vector<gfx::Display> GetAllDisplays() const override; |
| 29 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override; | 28 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override; |
| 30 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; | 29 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 31 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; | 30 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 32 gfx::Display GetPrimaryDisplay() const override; | 31 gfx::Display GetPrimaryDisplay() const override; |
| 33 void AddObserver(DisplayObserver* observer) override; | 32 void AddObserver(DisplayObserver* observer) override; |
| 34 void RemoveObserver(DisplayObserver* observer) override; | 33 void RemoveObserver(DisplayObserver* observer) override; |
| 35 | 34 |
| 36 // Overriden from gfx::SingletonHwnd::Observer. | |
| 37 void OnWndProc(HWND hwnd, | |
| 38 UINT message, | |
| 39 WPARAM wparam, | |
| 40 LPARAM lparam) override; | |
| 41 | |
| 42 // Returns the HWND associated with the NativeView. | 35 // Returns the HWND associated with the NativeView. |
| 43 virtual HWND GetHWNDFromNativeView(NativeView window) const; | 36 virtual HWND GetHWNDFromNativeView(NativeView window) const; |
| 44 | 37 |
| 45 // Returns the NativeView associated with the HWND. | 38 // Returns the NativeView associated with the HWND. |
| 46 virtual NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; | 39 virtual NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; |
| 47 | 40 |
| 48 private: | 41 private: |
| 42 void OnDisplayChange(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
| 43 |
| 49 // Helper implementing the DisplayObserver handling. | 44 // Helper implementing the DisplayObserver handling. |
| 50 gfx::DisplayChangeNotifier change_notifier_; | 45 gfx::DisplayChangeNotifier change_notifier_; |
| 51 | 46 |
| 47 SingletonHwnd::Observer singletonHwndObserver_; |
| 48 |
| 52 // Current list of displays. | 49 // Current list of displays. |
| 53 std::vector<gfx::Display> displays_; | 50 std::vector<gfx::Display> displays_; |
| 54 | 51 |
| 55 DISALLOW_COPY_AND_ASSIGN(ScreenWin); | 52 DISALLOW_COPY_AND_ASSIGN(ScreenWin); |
| 56 }; | 53 }; |
| 57 | 54 |
| 58 } // namespace gfx | 55 } // namespace gfx |
| 59 | 56 |
| 60 #endif // UI_GFX_SCREEN_WIN_H_ | 57 #endif // UI_GFX_SCREEN_WIN_H_ |
| OLD | NEW |