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

Side by Side Diff: ui/display/chromeos/display_configurator.h

Issue 336863002: Moving input device hotplug event processing outside of ui/display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 5 #ifndef UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 6 #define UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 24 matching lines...) Expand all
35 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver { 35 class DISPLAY_EXPORT DisplayConfigurator : public NativeDisplayObserver {
36 public: 36 public:
37 typedef uint64_t ContentProtectionClientId; 37 typedef uint64_t ContentProtectionClientId;
38 static const ContentProtectionClientId kInvalidClientId = 0; 38 static const ContentProtectionClientId kInvalidClientId = 0;
39 39
40 struct DisplayState { 40 struct DisplayState {
41 DisplayState(); 41 DisplayState();
42 42
43 DisplaySnapshot* display; // Not owned. 43 DisplaySnapshot* display; // Not owned.
44 44
45 // XInput device ID or 0 if this display isn't a touchscreen.
46 int touch_device_id;
47
48 // User-selected mode for the display. 45 // User-selected mode for the display.
49 const DisplayMode* selected_mode; 46 const DisplayMode* selected_mode;
50 47
51 // Mode used when displaying the same desktop on multiple displays. 48 // Mode used when displaying the same desktop on multiple displays.
52 const DisplayMode* mirror_mode; 49 const DisplayMode* mirror_mode;
53 }; 50 };
54 51
55 typedef std::vector<DisplayState> DisplayStateList; 52 typedef std::vector<DisplayState> DisplayStateList;
56 53
57 class Observer { 54 class Observer {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Interface for classes that implement software based mirroring. 87 // Interface for classes that implement software based mirroring.
91 class SoftwareMirroringController { 88 class SoftwareMirroringController {
92 public: 89 public:
93 virtual ~SoftwareMirroringController() {} 90 virtual ~SoftwareMirroringController() {}
94 91
95 // Called when the hardware mirroring failed. 92 // Called when the hardware mirroring failed.
96 virtual void SetSoftwareMirroring(bool enabled) = 0; 93 virtual void SetSoftwareMirroring(bool enabled) = 0;
97 virtual bool SoftwareMirroringEnabled() const = 0; 94 virtual bool SoftwareMirroringEnabled() const = 0;
98 }; 95 };
99 96
100 class TouchscreenDelegate {
101 public:
102 virtual ~TouchscreenDelegate() {}
103
104 // Searches for touchscreens among input devices,
105 // and tries to match them up to screens in |displays|.
106 // |displays| is an array of detected screens.
107 // If a touchscreen with same resolution as a display's native mode
108 // is detected, its id will be stored in this display.
109 virtual void AssociateTouchscreens(std::vector<DisplayState>* displays) = 0;
110 };
111
112 // Helper class used by tests. 97 // Helper class used by tests.
113 class TestApi { 98 class TestApi {
114 public: 99 public:
115 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {} 100 TestApi(DisplayConfigurator* configurator) : configurator_(configurator) {}
116 ~TestApi() {} 101 ~TestApi() {}
117 102
118 // If |configure_timer_| is started, stops the timer, runs 103 // If |configure_timer_| is started, stops the timer, runs
119 // ConfigureDisplays(), and returns true; returns false otherwise. 104 // ConfigureDisplays(), and returns true; returns false otherwise.
120 bool TriggerConfigureTimeout(); 105 bool TriggerConfigureTimeout();
121 106
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 state_controller_ = controller; 147 state_controller_ = controller;
163 } 148 }
164 void set_mirroring_controller(SoftwareMirroringController* controller) { 149 void set_mirroring_controller(SoftwareMirroringController* controller) {
165 mirroring_controller_ = controller; 150 mirroring_controller_ = controller;
166 } 151 }
167 152
168 // Replaces |native_display_delegate_| and |touchscreen_delegate_| with the 2 153 // Replaces |native_display_delegate_| and |touchscreen_delegate_| with the 2
169 // delegates passed in and sets |configure_display_| to true. Should be called 154 // delegates passed in and sets |configure_display_| to true. Should be called
170 // before Init(). 155 // before Init().
171 void SetDelegatesForTesting( 156 void SetDelegatesForTesting(
172 scoped_ptr<NativeDisplayDelegate> display_delegate, 157 scoped_ptr<NativeDisplayDelegate> display_delegate);
173 scoped_ptr<TouchscreenDelegate> touchscreen_delegate);
174 158
175 // Sets the initial value of |power_state_|. Must be called before Start(). 159 // Sets the initial value of |power_state_|. Must be called before Start().
176 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state); 160 void SetInitialDisplayPower(chromeos::DisplayPowerState power_state);
177 161
178 // Initialization, must be called right after constructor. 162 // Initialization, must be called right after constructor.
179 // |is_panel_fitting_enabled| indicates hardware panel fitting support. 163 // |is_panel_fitting_enabled| indicates hardware panel fitting support.
180 void Init(bool is_panel_fitting_enabled); 164 void Init(bool is_panel_fitting_enabled);
181 165
182 // Does initial configuration of displays during startup. 166 // Does initial configuration of displays during startup.
183 // If |background_color_argb| is non zero and there are multiple displays, 167 // If |background_color_argb| is non zero and there are multiple displays,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 bool SetColorCalibrationProfile(int64_t display_id, 232 bool SetColorCalibrationProfile(int64_t display_id,
249 ui::ColorCalibrationProfile new_profile); 233 ui::ColorCalibrationProfile new_profile);
250 234
251 private: 235 private:
252 // Mapping a display_id to a protection request bitmask. 236 // Mapping a display_id to a protection request bitmask.
253 typedef std::map<int64_t, uint32_t> ContentProtections; 237 typedef std::map<int64_t, uint32_t> ContentProtections;
254 // Mapping a client to its protection request. 238 // Mapping a client to its protection request.
255 typedef std::map<ContentProtectionClientId, ContentProtections> 239 typedef std::map<ContentProtectionClientId, ContentProtections>
256 ProtectionRequests; 240 ProtectionRequests;
257 241
258 // If |native_display_delegate_| and |touchscreen_delegate_| are not set, then 242 // If |native_display_delegate_| is not set, then set it to
259 // set them to the passed in values. 243 // |display_delegate|.
260 void InitializeDelegates( 244 void InitializeDelegates(
261 scoped_ptr<NativeDisplayDelegate> display_delegate, 245 scoped_ptr<NativeDisplayDelegate> display_delegate);
262 scoped_ptr<TouchscreenDelegate> touchscreen_delegate);
263 246
264 // Performs platform specific delegate initialization. 247 // Performs platform specific delegate initialization.
265 void PlatformInitialize(); 248 void PlatformInitialize();
266 249
267 // Updates |cached_displays_| to contain currently-connected displays. Calls 250 // Updates |cached_displays_| to contain currently-connected displays. Calls
268 // |delegate_->GetDisplays()| and then does additional work, like finding the 251 // |delegate_->GetDisplays()| and then does additional work, like finding the
269 // mirror mode and setting user-preferred modes. Note that the server must be 252 // mirror mode and setting user-preferred modes. Note that the server must be
270 // grabbed via |delegate_->GrabServer()| first. 253 // grabbed via |delegate_->GrabServer()| first.
271 void UpdateCachedDisplays(); 254 void UpdateCachedDisplays();
272 255
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 303
321 // Returns true if in either hardware or software mirroring mode. 304 // Returns true if in either hardware or software mirroring mode.
322 bool IsMirroring() const; 305 bool IsMirroring() const;
323 306
324 // Applies display protections according to requests. 307 // Applies display protections according to requests.
325 bool ApplyProtections(const ContentProtections& requests); 308 bool ApplyProtections(const ContentProtections& requests);
326 309
327 StateController* state_controller_; 310 StateController* state_controller_;
328 SoftwareMirroringController* mirroring_controller_; 311 SoftwareMirroringController* mirroring_controller_;
329 scoped_ptr<NativeDisplayDelegate> native_display_delegate_; 312 scoped_ptr<NativeDisplayDelegate> native_display_delegate_;
330 scoped_ptr<TouchscreenDelegate> touchscreen_delegate_;
331 313
332 // Used to enable modes which rely on panel fitting. 314 // Used to enable modes which rely on panel fitting.
333 bool is_panel_fitting_enabled_; 315 bool is_panel_fitting_enabled_;
334 316
335 // This is detected by the constructor to determine whether or not we should 317 // This is detected by the constructor to determine whether or not we should
336 // be enabled. If we aren't running on ChromeOS, we can't assume that the 318 // be enabled. If we aren't running on ChromeOS, we can't assume that the
337 // Xrandr X11 extension is supported. 319 // Xrandr X11 extension is supported.
338 // If this flag is set to false, any attempts to change the display 320 // If this flag is set to false, any attempts to change the display
339 // configuration to immediately fail without changing the state. 321 // configuration to immediately fail without changing the state.
340 bool configure_display_; 322 bool configure_display_;
(...skipping 21 matching lines...) Expand all
362 344
363 // Display protection requests of each client. 345 // Display protection requests of each client.
364 ProtectionRequests client_protection_requests_; 346 ProtectionRequests client_protection_requests_;
365 347
366 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator); 348 DISALLOW_COPY_AND_ASSIGN(DisplayConfigurator);
367 }; 349 };
368 350
369 } // namespace ui 351 } // namespace ui
370 352
371 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_ 353 #endif // UI_DISPLAY_CHROMEOS_DISPLAY_CONFIGURATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698