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

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

Issue 2959423003: color: Read all displays' color profiles on Windows (Closed)
Patch Set: Remove unused Initialize method Created 3 years, 5 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
« no previous file with comments | « ui/display/win/color_profile_reader.cc ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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_change_notifier.h" 14 #include "ui/display/display_change_notifier.h"
15 #include "ui/display/display_export.h" 15 #include "ui/display/display_export.h"
16 #include "ui/display/screen.h" 16 #include "ui/display/screen.h"
17 #include "ui/display/win/color_profile_reader.h"
17 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/win/singleton_hwnd_observer.h" 19 #include "ui/gfx/win/singleton_hwnd_observer.h"
19 20
20 namespace gfx { 21 namespace gfx {
21 class Display; 22 class Display;
22 class Point; 23 class Point;
23 class Rect; 24 class Rect;
24 class Size; 25 class Size;
25 } // namespace gfx 26 } // namespace gfx
26 27
27 namespace display { 28 namespace display {
28 namespace win { 29 namespace win {
29 30
30 class DisplayInfo; 31 class DisplayInfo;
31 class ScreenWinDisplay; 32 class ScreenWinDisplay;
32 33
33 class DISPLAY_EXPORT ScreenWin : public Screen { 34 class DISPLAY_EXPORT ScreenWin : public Screen,
35 public ColorProfileReader::Client {
34 public: 36 public:
35 ScreenWin(); 37 ScreenWin();
36 ~ScreenWin() override; 38 ~ScreenWin() override;
37 39
38 // Converts a screen physical point to a screen DIP point. 40 // Converts a screen physical point to a screen DIP point.
39 // The DPI scale is performed relative to the display containing the physical 41 // The DPI scale is performed relative to the display containing the physical
40 // point. 42 // point.
41 static gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point); 43 static gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point);
42 44
43 // Converts a screen DIP point to a screen physical point. 45 // Converts a screen DIP point to a screen physical point.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // you are targeting. 111 // you are targeting.
110 static float GetSystemScaleFactor(); 112 static float GetSystemScaleFactor();
111 113
112 // Returns the HWND associated with the NativeView. 114 // Returns the HWND associated with the NativeView.
113 virtual HWND GetHWNDFromNativeView(gfx::NativeView view) const; 115 virtual HWND GetHWNDFromNativeView(gfx::NativeView view) const;
114 116
115 // Returns the NativeView associated with the HWND. 117 // Returns the NativeView associated with the HWND.
116 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; 118 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const;
117 119
118 protected: 120 protected:
121 ScreenWin(bool initialize);
122
119 // Screen: 123 // Screen:
120 gfx::Point GetCursorScreenPoint() override; 124 gfx::Point GetCursorScreenPoint() override;
121 bool IsWindowUnderCursor(gfx::NativeWindow window) override; 125 bool IsWindowUnderCursor(gfx::NativeWindow window) override;
122 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; 126 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
123 int GetNumDisplays() const override; 127 int GetNumDisplays() const override;
124 const std::vector<Display>& GetAllDisplays() const override; 128 const std::vector<Display>& GetAllDisplays() const override;
125 Display GetDisplayNearestWindow(gfx::NativeWindow window) const override; 129 Display GetDisplayNearestWindow(gfx::NativeWindow window) const override;
126 Display GetDisplayNearestPoint(const gfx::Point& point) const override; 130 Display GetDisplayNearestPoint(const gfx::Point& point) const override;
127 Display GetDisplayMatching(const gfx::Rect& match_rect) const override; 131 Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
128 Display GetPrimaryDisplay() const override; 132 Display GetPrimaryDisplay() const override;
129 void AddObserver(DisplayObserver* observer) override; 133 void AddObserver(DisplayObserver* observer) override;
130 void RemoveObserver(DisplayObserver* observer) override; 134 void RemoveObserver(DisplayObserver* observer) override;
131 gfx::Rect ScreenToDIPRectInWindow( 135 gfx::Rect ScreenToDIPRectInWindow(
132 gfx::NativeView view, const gfx::Rect& screen_rect) const override; 136 gfx::NativeView view, const gfx::Rect& screen_rect) const override;
133 gfx::Rect DIPToScreenRectInWindow( 137 gfx::Rect DIPToScreenRectInWindow(
134 gfx::NativeView view, const gfx::Rect& dip_rect) const override; 138 gfx::NativeView view, const gfx::Rect& dip_rect) const override;
135 139
140 // ColorProfileReader::Client:
141 void OnColorProfilesChanged() override;
142
136 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos); 143 void UpdateFromDisplayInfos(const std::vector<DisplayInfo>& display_infos);
137 144
138 // Virtual to support mocking by unit tests. 145 // Virtual to support mocking by unit tests.
139 virtual void Initialize();
140 virtual MONITORINFOEX MonitorInfoFromScreenPoint( 146 virtual MONITORINFOEX MonitorInfoFromScreenPoint(
141 const gfx::Point& screen_point) const; 147 const gfx::Point& screen_point) const;
142 virtual MONITORINFOEX MonitorInfoFromScreenRect(const gfx::Rect& screen_rect) 148 virtual MONITORINFOEX MonitorInfoFromScreenRect(const gfx::Rect& screen_rect)
143 const; 149 const;
144 virtual MONITORINFOEX MonitorInfoFromWindow(HWND hwnd, DWORD default_options) 150 virtual MONITORINFOEX MonitorInfoFromWindow(HWND hwnd, DWORD default_options)
145 const; 151 const;
146 virtual HWND GetRootWindow(HWND hwnd) const; 152 virtual HWND GetRootWindow(HWND hwnd) const;
147 virtual int GetSystemMetrics(int metric) const; 153 virtual int GetSystemMetrics(int metric) const;
148 154
149 private: 155 private:
156 void Initialize();
150 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); 157 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
151 158
152 // Returns the ScreenWinDisplay closest to or enclosing |hwnd|. 159 // Returns the ScreenWinDisplay closest to or enclosing |hwnd|.
153 ScreenWinDisplay GetScreenWinDisplayNearestHWND(HWND hwnd) const; 160 ScreenWinDisplay GetScreenWinDisplayNearestHWND(HWND hwnd) const;
154 161
155 // Returns the ScreenWinDisplay closest to or enclosing |screen_rect|. 162 // Returns the ScreenWinDisplay closest to or enclosing |screen_rect|.
156 ScreenWinDisplay GetScreenWinDisplayNearestScreenRect( 163 ScreenWinDisplay GetScreenWinDisplayNearestScreenRect(
157 const gfx::Rect& screen_rect) const; 164 const gfx::Rect& screen_rect) const;
158 165
159 // Returns the ScreenWinDisplay closest to or enclosing |screen_point|. 166 // Returns the ScreenWinDisplay closest to or enclosing |screen_point|.
(...skipping 26 matching lines...) Expand all
186 193
187 std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_; 194 std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_;
188 195
189 // Current list of ScreenWinDisplays. 196 // Current list of ScreenWinDisplays.
190 std::vector<ScreenWinDisplay> screen_win_displays_; 197 std::vector<ScreenWinDisplay> screen_win_displays_;
191 198
192 // The Displays corresponding to |screen_win_displays_| for GetAllDisplays(). 199 // The Displays corresponding to |screen_win_displays_| for GetAllDisplays().
193 // This must be updated anytime |screen_win_displays_| is updated. 200 // This must be updated anytime |screen_win_displays_| is updated.
194 std::vector<Display> displays_; 201 std::vector<Display> displays_;
195 202
203 // A helper to read color profiles from the filesystem.
204 std::unique_ptr<ColorProfileReader> color_profile_reader_;
205
196 DISALLOW_COPY_AND_ASSIGN(ScreenWin); 206 DISALLOW_COPY_AND_ASSIGN(ScreenWin);
197 }; 207 };
198 208
199 } // namespace win 209 } // namespace win
200 } // namespace display 210 } // namespace display
201 211
202 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ 212 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_
OLDNEW
« no previous file with comments | « ui/display/win/color_profile_reader.cc ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698