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