Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: ui/display/win/screen_win.h

Issue 1825723002: Move ScreenWin to ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added is_chromeos guard Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_DISPLAY_WIN_SCREEN_WIN_H_
6 #define UI_GFX_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 <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "ui/display/display_export.h"
13 #include "ui/gfx/display_change_notifier.h" 14 #include "ui/gfx/display_change_notifier.h"
14 #include "ui/gfx/gfx_export.h"
15 #include "ui/gfx/native_widget_types.h" 15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gfx/screen.h" 16 #include "ui/gfx/screen.h"
17 #include "ui/gfx/win/singleton_hwnd_observer.h" 17 #include "ui/gfx/win/singleton_hwnd_observer.h"
18 18
19 namespace gfx { 19 namespace gfx {
20
21 class Display; 20 class Display;
22 class Point; 21 class Point;
23 class Rect; 22 class Rect;
23 } // namespace gfx
24 24
25 namespace display {
25 namespace win { 26 namespace win {
26 27
27 class DisplayInfo; 28 class DisplayInfo;
28 class ScreenWinDisplay; 29 class ScreenWinDisplay;
29 30
30 } // namespace win 31 class DISPLAY_EXPORT ScreenWin : public gfx::Screen {
31
32 class GFX_EXPORT ScreenWin : public Screen {
33 public: 32 public:
34 ScreenWin(); 33 ScreenWin();
35 ~ScreenWin() override; 34 ~ScreenWin() override;
36 35
37 // Returns the HWND associated with the NativeView. 36 // Returns the HWND associated with the NativeView.
38 virtual HWND GetHWNDFromNativeView(NativeView window) const; 37 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const;
39 38
40 // Returns the NativeView associated with the HWND. 39 // Returns the NativeView associated with the HWND.
41 virtual NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; 40 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const;
42 41
43 protected: 42 protected:
44 // gfx::Screen: 43 // gfx::Screen:
45 gfx::Point GetCursorScreenPoint() override; 44 gfx::Point GetCursorScreenPoint() override;
46 gfx::NativeWindow GetWindowUnderCursor() override; 45 gfx::NativeWindow GetWindowUnderCursor() override;
47 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; 46 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
48 int GetNumDisplays() const override; 47 int GetNumDisplays() const override;
49 std::vector<gfx::Display> GetAllDisplays() const override; 48 std::vector<gfx::Display> GetAllDisplays() const override;
50 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override; 49 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override;
51 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; 50 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override;
52 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; 51 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
53 gfx::Display GetPrimaryDisplay() const override; 52 gfx::Display GetPrimaryDisplay() const override;
54 void AddObserver(DisplayObserver* observer) override; 53 void AddObserver(gfx::DisplayObserver* observer) override;
55 void RemoveObserver(DisplayObserver* observer) override; 54 void RemoveObserver(gfx::DisplayObserver* observer) override;
56 55
57 void UpdateFromDisplayInfos( 56 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos);
58 const std::vector<gfx::win::DisplayInfo>& display_infos);
59 57
60 // Virtual to support mocking by unit tests. 58 // Virtual to support mocking by unit tests.
61 virtual void Initialize(); 59 virtual void Initialize();
62 virtual MONITORINFOEX MonitorInfoFromScreenPoint( 60 virtual MONITORINFOEX MonitorInfoFromScreenPoint(
63 const gfx::Point& screen_point) const; 61 const gfx::Point& screen_point) const;
64 virtual MONITORINFOEX MonitorInfoFromScreenRect(const gfx::Rect& screen_rect) 62 virtual MONITORINFOEX MonitorInfoFromScreenRect(const gfx::Rect& screen_rect)
65 const; 63 const;
66 virtual MONITORINFOEX MonitorInfoFromWindow(HWND hwnd, DWORD default_options) 64 virtual MONITORINFOEX MonitorInfoFromWindow(HWND hwnd, DWORD default_options)
67 const; 65 const;
68 virtual HWND GetRootWindow(HWND hwnd) const; 66 virtual HWND GetRootWindow(HWND hwnd) const;
69 67
70 private: 68 private:
71 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); 69 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
72 70
73 // Returns the ScreenWinDisplay closest to or enclosing |hwnd|. 71 // Returns the ScreenWinDisplay closest to or enclosing |hwnd|.
74 gfx::win::ScreenWinDisplay GetScreenWinDisplayNearestHWND(HWND hwnd) const; 72 ScreenWinDisplay GetScreenWinDisplayNearestHWND(HWND hwnd) const;
75 73
76 // Returns the ScreenWinDisplay closest to or enclosing |screen_rect|. 74 // Returns the ScreenWinDisplay closest to or enclosing |screen_rect|.
77 gfx::win::ScreenWinDisplay GetScreenWinDisplayNearestScreenRect( 75 ScreenWinDisplay GetScreenWinDisplayNearestScreenRect(
78 const Rect& screen_rect) const; 76 const gfx::Rect& screen_rect) const;
79 77
80 // Returns the ScreenWinDisplay closest to or enclosing |screen_point|. 78 // Returns the ScreenWinDisplay closest to or enclosing |screen_point|.
81 gfx::win::ScreenWinDisplay GetScreenWinDisplayNearestScreenPoint( 79 ScreenWinDisplay GetScreenWinDisplayNearestScreenPoint(
82 const Point& screen_point) const; 80 const gfx::Point& screen_point) const;
83 81
84 // Returns the ScreenWinDisplay corresponding to the primary monitor. 82 // Returns the ScreenWinDisplay corresponding to the primary monitor.
85 gfx::win::ScreenWinDisplay GetPrimaryScreenWinDisplay() const; 83 ScreenWinDisplay GetPrimaryScreenWinDisplay() const;
86 84
87 gfx::win::ScreenWinDisplay GetScreenWinDisplay( 85 ScreenWinDisplay GetScreenWinDisplay(const MONITORINFOEX& monitor_info) const;
88 const MONITORINFOEX& monitor_info) const;
89 86
90 // Helper implementing the DisplayObserver handling. 87 // Helper implementing the DisplayObserver handling.
91 gfx::DisplayChangeNotifier change_notifier_; 88 gfx::DisplayChangeNotifier change_notifier_;
92 89
93 scoped_ptr<SingletonHwndObserver> singleton_hwnd_observer_; 90 scoped_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_;
94 91
95 // Current list of ScreenWinDisplays. 92 // Current list of ScreenWinDisplays.
96 std::vector<gfx::win::ScreenWinDisplay> screen_win_displays_; 93 std::vector<ScreenWinDisplay> screen_win_displays_;
97 94
98 DISALLOW_COPY_AND_ASSIGN(ScreenWin); 95 DISALLOW_COPY_AND_ASSIGN(ScreenWin);
99 }; 96 };
100 97
101 } // namespace gfx 98 } // namespace win
99 } // namespace display
102 100
103 #endif // UI_GFX_SCREEN_WIN_H_ 101 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698