| 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_DISPLAY_MANAGER_DISPLAY_MANAGER_H_ | 5 #ifndef UI_DISPLAY_MANAGER_DISPLAY_MANAGER_H_ |
| 6 #define UI_DISPLAY_MANAGER_DISPLAY_MANAGER_H_ | 6 #define UI_DISPLAY_MANAGER_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 public: | 57 public: |
| 58 virtual ~Delegate() {} | 58 virtual ~Delegate() {} |
| 59 | 59 |
| 60 // Create or updates the mirroring window with |display_info_list|. | 60 // Create or updates the mirroring window with |display_info_list|. |
| 61 virtual void CreateOrUpdateMirroringDisplay( | 61 virtual void CreateOrUpdateMirroringDisplay( |
| 62 const DisplayInfoList& display_info_list) = 0; | 62 const DisplayInfoList& display_info_list) = 0; |
| 63 | 63 |
| 64 // Closes the mirror window if not necessary. | 64 // Closes the mirror window if not necessary. |
| 65 virtual void CloseMirroringDisplayIfNotNecessary() = 0; | 65 virtual void CloseMirroringDisplayIfNotNecessary() = 0; |
| 66 | 66 |
| 67 // Called before and after the display configuration changes. | 67 // Called before and after the display configuration changes. When |
| 68 // When |clear_focus| is true, the implementation should | 68 // |clear_focus| is true, the implementation should deactivate the active |
| 69 // deactivate the active window and set the focus window to NULL. | 69 // window and set the focus window to NULL. |
| 70 virtual void PreDisplayConfigurationChange(bool clear_focus) = 0; | 70 virtual void PreDisplayConfigurationChange(bool clear_focus) = 0; |
| 71 virtual void PostDisplayConfigurationChange(bool must_clear_window) = 0; | 71 virtual void PostDisplayConfigurationChange(bool must_clear_window) = 0; |
| 72 | 72 |
| 73 #if defined(OS_CHROMEOS) | 73 #if defined(OS_CHROMEOS) |
| 74 // Get the ui::DisplayConfigurator. | 74 // Get the ui::DisplayConfigurator. |
| 75 virtual ui::DisplayConfigurator* display_configurator() = 0; | 75 virtual ui::DisplayConfigurator* display_configurator() = 0; |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 virtual std::string GetInternalDisplayNameString() = 0; | 78 virtual std::string GetInternalDisplayNameString() = 0; |
| 79 virtual std::string GetUnknownDisplayNameString() = 0; | 79 virtual std::string GetUnknownDisplayNameString() = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 97 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
| 98 ~DisplayManager() override; | 98 ~DisplayManager() override; |
| 99 #else | 99 #else |
| 100 virtual ~DisplayManager(); | 100 virtual ~DisplayManager(); |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 DisplayLayoutStore* layout_store() { return layout_store_.get(); } | 103 DisplayLayoutStore* layout_store() { return layout_store_.get(); } |
| 104 | 104 |
| 105 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 105 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 106 | 106 |
| 107 // When set to true, the DisplayManager calls OnDisplayMetricsChanged | 107 // When set to true, the DisplayManager calls OnDisplayMetricsChanged even if |
| 108 // even if the display's bounds didn't change. Used to swap primary | 108 // the display's bounds didn't change. Used to swap primary display. |
| 109 // display. | |
| 110 void set_force_bounds_changed(bool force_bounds_changed) { | 109 void set_force_bounds_changed(bool force_bounds_changed) { |
| 111 force_bounds_changed_ = force_bounds_changed; | 110 force_bounds_changed_ = force_bounds_changed; |
| 112 } | 111 } |
| 113 | 112 |
| 114 // Returns the display id of the first display in the outupt list. | 113 // Returns the display id of the first display in the outupt list. |
| 115 int64_t first_display_id() const { return first_display_id_; } | 114 int64_t first_display_id() const { return first_display_id_; } |
| 116 | 115 |
| 117 // Initializes displays using command line flag. Returns false | 116 // Initializes displays using command line flag. Returns false if no command |
| 118 // if no command line flag was provided. | 117 // line flag was provided. |
| 119 bool InitFromCommandLine(); | 118 bool InitFromCommandLine(); |
| 120 | 119 |
| 121 // Initialize default display. | 120 // Initialize default display. |
| 122 void InitDefaultDisplay(); | 121 void InitDefaultDisplay(); |
| 123 | 122 |
| 124 // Initializes font related params that depends on display | 123 // Initializes font related params that depends on display configuration. |
| 125 // configuration. | |
| 126 void RefreshFontParams(); | 124 void RefreshFontParams(); |
| 127 | 125 |
| 128 // Returns the display layout used for current displays. | 126 // Returns the display layout used for current displays. |
| 129 const display::DisplayLayout& GetCurrentDisplayLayout() const; | 127 const DisplayLayout& GetCurrentDisplayLayout() const; |
| 130 | 128 |
| 131 // Returns the current display list. | 129 // Returns the current display list. |
| 132 display::DisplayIdList GetCurrentDisplayIdList() const; | 130 DisplayIdList GetCurrentDisplayIdList() const; |
| 133 | 131 |
| 134 // Sets the layout for the current display pair. The |layout| specifies | 132 // Sets the layout for the current display pair. The |layout| specifies the |
| 135 // the locaion of the displays relative to their parents. | 133 // locaion of the displays relative to their parents. |
| 136 void SetLayoutForCurrentDisplays( | 134 void SetLayoutForCurrentDisplays(std::unique_ptr<DisplayLayout> layout); |
| 137 std::unique_ptr<display::DisplayLayout> layout); | |
| 138 | 135 |
| 139 // Returns display for given |id|; | 136 // Returns display for given |id|; |
| 140 const display::Display& GetDisplayForId(int64_t id) const; | 137 const Display& GetDisplayForId(int64_t id) const; |
| 141 | 138 |
| 142 // Finds the display that contains |point| in screeen coordinates. | 139 // Finds the display that contains |point| in screeen coordinates. Returns |
| 143 // Returns invalid display if there is no display that can satisfy | 140 // invalid display if there is no display that can satisfy the condition. |
| 144 // the condition. | 141 const Display& FindDisplayContainingPoint( |
| 145 const display::Display& FindDisplayContainingPoint( | |
| 146 const gfx::Point& point_in_screen) const; | 142 const gfx::Point& point_in_screen) const; |
| 147 | 143 |
| 148 // Sets the work area's |insets| to the display given by |display_id|. | 144 // Sets the work area's |insets| to the display given by |display_id|. |
| 149 bool UpdateWorkAreaOfDisplay(int64_t display_id, const gfx::Insets& insets); | 145 bool UpdateWorkAreaOfDisplay(int64_t display_id, const gfx::Insets& insets); |
| 150 | 146 |
| 151 // Registers the overscan insets for the display of the specified ID. Note | 147 // Registers the overscan insets for the display of the specified ID. Note |
| 152 // that the insets size should be specified in DIP size. It also triggers the | 148 // that the insets size should be specified in DIP size. It also triggers the |
| 153 // display's bounds change. | 149 // display's bounds change. |
| 154 void SetOverscanInsets(int64_t display_id, const gfx::Insets& insets_in_dip); | 150 void SetOverscanInsets(int64_t display_id, const gfx::Insets& insets_in_dip); |
| 155 | 151 |
| 156 // Sets the display's rotation for the given |source|. The new |rotation| will | 152 // Sets the display's rotation for the given |source|. The new |rotation| will |
| 157 // also become active. | 153 // also become active. |
| 158 void SetDisplayRotation(int64_t display_id, | 154 void SetDisplayRotation(int64_t display_id, |
| 159 display::Display::Rotation rotation, | 155 Display::Rotation rotation, |
| 160 display::Display::RotationSource source); | 156 Display::RotationSource source); |
| 161 | 157 |
| 162 // Resets the UI scale of the display with |display_id| to the one defined in | 158 // Resets the UI scale of the display with |display_id| to the one defined in |
| 163 // the default mode. | 159 // the default mode. |
| 164 bool ResetDisplayToDefaultMode(int64_t display_id); | 160 bool ResetDisplayToDefaultMode(int64_t display_id); |
| 165 | 161 |
| 166 // Sets the external display's configuration, including resolution change, | 162 // Sets the external display's configuration, including resolution change, |
| 167 // ui-scale change, and device scale factor change. Returns true if it changes | 163 // ui-scale change, and device scale factor change. Returns true if it changes |
| 168 // the display resolution so that the caller needs to show a notification in | 164 // the display resolution so that the caller needs to show a notification in |
| 169 // case the new resolution actually doesn't work. | 165 // case the new resolution actually doesn't work. |
| 170 bool SetDisplayMode( | 166 bool SetDisplayMode(int64_t display_id, |
| 171 int64_t display_id, | 167 const scoped_refptr<ManagedDisplayMode>& display_mode); |
| 172 const scoped_refptr<display::ManagedDisplayMode>& display_mode); | |
| 173 | 168 |
| 174 // Register per display properties. |overscan_insets| is NULL if | 169 // Register per display properties. |overscan_insets| is null if the display |
| 175 // the display has no custom overscan insets. | 170 // has no custom overscan insets. |
| 176 void RegisterDisplayProperty(int64_t display_id, | 171 void RegisterDisplayProperty(int64_t display_id, |
| 177 display::Display::Rotation rotation, | 172 Display::Rotation rotation, |
| 178 float ui_scale, | 173 float ui_scale, |
| 179 const gfx::Insets* overscan_insets, | 174 const gfx::Insets* overscan_insets, |
| 180 const gfx::Size& resolution_in_pixels, | 175 const gfx::Size& resolution_in_pixels, |
| 181 float device_scale_factor, | 176 float device_scale_factor, |
| 182 ui::ColorCalibrationProfile color_profile); | 177 ui::ColorCalibrationProfile color_profile); |
| 183 | 178 |
| 184 // Register stored rotation properties for the internal display. | 179 // Register stored rotation properties for the internal display. |
| 185 void RegisterDisplayRotationProperties(bool rotation_lock, | 180 void RegisterDisplayRotationProperties(bool rotation_lock, |
| 186 display::Display::Rotation rotation); | 181 Display::Rotation rotation); |
| 187 | 182 |
| 188 // Returns the stored rotation lock preference if it has been loaded, | 183 // Returns the stored rotation lock preference if it has been loaded, |
| 189 // otherwise false. | 184 // otherwise false. |
| 190 bool registered_internal_display_rotation_lock() const { | 185 bool registered_internal_display_rotation_lock() const { |
| 191 return registered_internal_display_rotation_lock_; | 186 return registered_internal_display_rotation_lock_; |
| 192 } | 187 } |
| 193 | 188 |
| 194 // Returns the stored rotation preference for the internal display if it has | 189 // Returns the stored rotation preference for the internal display if it has |
| 195 // been loaded, otherwise |display::Display::Rotate_0|. | 190 // been loaded, otherwise |Display::Rotate_0|. |
| 196 display::Display::Rotation registered_internal_display_rotation() const { | 191 Display::Rotation registered_internal_display_rotation() const { |
| 197 return registered_internal_display_rotation_; | 192 return registered_internal_display_rotation_; |
| 198 } | 193 } |
| 199 | 194 |
| 200 // Returns the display mode of |display_id| which is currently used. | 195 // Returns the display mode of |display_id| which is currently used. |
| 201 scoped_refptr<display::ManagedDisplayMode> GetActiveModeForDisplayId( | 196 scoped_refptr<ManagedDisplayMode> GetActiveModeForDisplayId( |
| 202 int64_t display_id) const; | 197 int64_t display_id) const; |
| 203 | 198 |
| 204 // Returns the display's selected mode. This returns false and doesn't | 199 // Returns the display's selected mode. This returns false and doesn't set |
| 205 // set |mode_out| if the display mode is in default. | 200 // |mode_out| if the display mode is in default. |
| 206 scoped_refptr<display::ManagedDisplayMode> GetSelectedModeForDisplayId( | 201 scoped_refptr<ManagedDisplayMode> GetSelectedModeForDisplayId( |
| 207 int64_t display_id) const; | 202 int64_t display_id) const; |
| 208 | 203 |
| 209 // Tells if the virtual resolution feature is enabled. | 204 // Tells if the virtual resolution feature is enabled. |
| 210 bool IsDisplayUIScalingEnabled() const; | 205 bool IsDisplayUIScalingEnabled() const; |
| 211 | 206 |
| 212 // Returns the current overscan insets for the specified |display_id|. | 207 // Returns the current overscan insets for the specified |display_id|. |
| 213 // Returns an empty insets (0, 0, 0, 0) if no insets are specified for | 208 // Returns an empty insets (0, 0, 0, 0) if no insets are specified for the |
| 214 // the display. | 209 // display. |
| 215 gfx::Insets GetOverscanInsets(int64_t display_id) const; | 210 gfx::Insets GetOverscanInsets(int64_t display_id) const; |
| 216 | 211 |
| 217 // Sets the color calibration of the display to |profile|. | 212 // Sets the color calibration of the display to |profile|. |
| 218 void SetColorCalibrationProfile(int64_t display_id, | 213 void SetColorCalibrationProfile(int64_t display_id, |
| 219 ui::ColorCalibrationProfile profile); | 214 ui::ColorCalibrationProfile profile); |
| 220 | 215 |
| 221 // Called when display configuration has changed. The new display | 216 // Called when display configuration has changed. The new display |
| 222 // configurations is passed as a vector of Display object, which | 217 // configurations is passed as a vector of Display object, which contains each |
| 223 // contains each display's new infomration. | 218 // display's new infomration. |
| 224 void OnNativeDisplaysChanged( | 219 void OnNativeDisplaysChanged( |
| 225 const std::vector<display::ManagedDisplayInfo>& display_info_list); | 220 const std::vector<ManagedDisplayInfo>& display_info_list); |
| 226 | 221 |
| 227 // Updates the internal display data and notifies observers about the changes. | 222 // Updates the internal display data and notifies observers about the changes. |
| 228 void UpdateDisplaysWith( | 223 void UpdateDisplaysWith( |
| 229 const std::vector<display::ManagedDisplayInfo>& display_info_list); | 224 const std::vector<ManagedDisplayInfo>& display_info_list); |
| 230 | 225 |
| 231 // Updates current displays using current |display_info_|. | 226 // Updates current displays using current |display_info_|. |
| 232 void UpdateDisplays(); | 227 void UpdateDisplays(); |
| 233 | 228 |
| 234 // Returns the display at |index|. The display at 0 is | 229 // Returns the display at |index|. The display at 0 is no longer considered |
| 235 // no longer considered "primary". | 230 // "primary". |
| 236 const display::Display& GetDisplayAt(size_t index) const; | 231 const Display& GetDisplayAt(size_t index) const; |
| 237 | 232 |
| 238 const display::Display& GetPrimaryDisplayCandidate() const; | 233 const Display& GetPrimaryDisplayCandidate() const; |
| 239 | 234 |
| 240 // Returns the logical number of displays. This returns 1 | 235 // Returns the logical number of displays. This returns 1 when displays are |
| 241 // when displays are mirrored. | 236 // mirrored. |
| 242 size_t GetNumDisplays() const; | 237 size_t GetNumDisplays() const; |
| 243 | 238 |
| 244 // Returns only the currently active displays. This list does not include the | 239 // Returns only the currently active displays. This list does not include the |
| 245 // displays that will be removed if |UpdateDisplaysWith| is currently | 240 // displays that will be removed if |UpdateDisplaysWith| is currently |
| 246 // executing. | 241 // executing. |
| 247 // See https://crbug.com/632755 | 242 // See https://crbug.com/632755 |
| 248 const display::Displays& active_only_display_list() const { | 243 const Displays& active_only_display_list() const { |
| 249 return is_updating_display_list_ ? active_only_display_list_ | 244 return is_updating_display_list_ ? active_only_display_list_ |
| 250 : active_display_list(); | 245 : active_display_list(); |
| 251 } | 246 } |
| 252 | 247 |
| 253 const display::Displays& active_display_list() const { | 248 const Displays& active_display_list() const { return active_display_list_; } |
| 254 return active_display_list_; | |
| 255 } | |
| 256 | 249 |
| 257 // Returns true if the display specified by |display_id| is currently | 250 // Returns true if the display specified by |display_id| is currently |
| 258 // connected and active. (mirroring display isn't active, for example). | 251 // connected and active. (mirroring display isn't active, for example). |
| 259 bool IsActiveDisplayId(int64_t display_id) const; | 252 bool IsActiveDisplayId(int64_t display_id) const; |
| 260 | 253 |
| 261 // Returns the number of connected displays. This returns 2 | 254 // Returns the number of connected displays. This returns 2 when displays are |
| 262 // when displays are mirrored. | 255 // mirrored. |
| 263 size_t num_connected_displays() const { return num_connected_displays_; } | 256 size_t num_connected_displays() const { return num_connected_displays_; } |
| 264 | 257 |
| 265 // Returns the mirroring status. | 258 // Returns the mirroring status. |
| 266 bool IsInMirrorMode() const; | 259 bool IsInMirrorMode() const; |
| 267 int64_t mirroring_display_id() const { return mirroring_display_id_; } | 260 int64_t mirroring_display_id() const { return mirroring_display_id_; } |
| 268 const display::Displays& software_mirroring_display_list() const { | 261 const Displays& software_mirroring_display_list() const { |
| 269 return software_mirroring_display_list_; | 262 return software_mirroring_display_list_; |
| 270 } | 263 } |
| 271 | 264 |
| 272 // Sets/gets if the unified desktop feature is enabled. | 265 // Sets/gets if the unified desktop feature is enabled. |
| 273 void SetUnifiedDesktopEnabled(bool enabled); | 266 void SetUnifiedDesktopEnabled(bool enabled); |
| 274 bool unified_desktop_enabled() const { return unified_desktop_enabled_; } | 267 bool unified_desktop_enabled() const { return unified_desktop_enabled_; } |
| 275 | 268 |
| 276 // Returns true if it's in unified desktop mode. | 269 // Returns true if it's in unified desktop mode. |
| 277 bool IsInUnifiedMode() const; | 270 bool IsInUnifiedMode() const; |
| 278 | 271 |
| 279 // Returns the display used for software mirrroring. Returns invalid | 272 // Returns the display used for software mirrroring. Returns invalid display |
| 280 // display if not found. | 273 // if not found. |
| 281 const display::Display GetMirroringDisplayById(int64_t id) const; | 274 const Display GetMirroringDisplayById(int64_t id) const; |
| 282 | 275 |
| 283 // Retuns the display info associated with |display_id|. | 276 // Retuns the display info associated with |display_id|. |
| 284 const display::ManagedDisplayInfo& GetDisplayInfo(int64_t display_id) const; | 277 const ManagedDisplayInfo& GetDisplayInfo(int64_t display_id) const; |
| 285 | 278 |
| 286 // Returns the human-readable name for the display |id|. | 279 // Returns the human-readable name for the display |id|. |
| 287 std::string GetDisplayNameForId(int64_t id); | 280 std::string GetDisplayNameForId(int64_t id); |
| 288 | 281 |
| 289 // Returns the display id that is capable of UI scaling. On device, | 282 // Returns the display id that is capable of UI scaling. On device, this |
| 290 // this returns internal display's ID if its device scale factor is 2, | 283 // returns internal display's ID if its device scale factor is 2, or invalid |
| 291 // or invalid ID if such internal display doesn't exist. On linux | 284 // ID if such internal display doesn't exist. On linux desktop, this returns |
| 292 // desktop, this returns the first display ID. | 285 // the first display ID. |
| 293 int64_t GetDisplayIdForUIScaling() const; | 286 int64_t GetDisplayIdForUIScaling() const; |
| 294 | 287 |
| 295 // Change the mirror mode. | 288 // Change the mirror mode. |
| 296 void SetMirrorMode(bool mirrored); | 289 void SetMirrorMode(bool mirrored); |
| 297 | 290 |
| 298 // Used to emulate display change when run in a desktop environment instead | 291 // Used to emulate display change when run in a desktop environment instead |
| 299 // of on a device. | 292 // of on a device. |
| 300 void AddRemoveDisplay(); | 293 void AddRemoveDisplay(); |
| 301 void ToggleDisplayScaleFactor(); | 294 void ToggleDisplayScaleFactor(); |
| 302 | 295 |
| 303 // SoftwareMirroringController override: | 296 // SoftwareMirroringController override: |
| 304 #if defined(OS_CHROMEOS) | 297 #if defined(OS_CHROMEOS) |
| 305 void SetSoftwareMirroring(bool enabled) override; | 298 void SetSoftwareMirroring(bool enabled) override; |
| 306 bool SoftwareMirroringEnabled() const override; | 299 bool SoftwareMirroringEnabled() const override; |
| 307 #endif | 300 #endif |
| 308 | 301 |
| 309 // Sets/gets default multi display mode. | 302 // Sets/gets default multi display mode. |
| 310 void SetDefaultMultiDisplayModeForCurrentDisplays(MultiDisplayMode mode); | 303 void SetDefaultMultiDisplayModeForCurrentDisplays(MultiDisplayMode mode); |
| 311 MultiDisplayMode current_default_multi_display_mode() const { | 304 MultiDisplayMode current_default_multi_display_mode() const { |
| 312 return current_default_multi_display_mode_; | 305 return current_default_multi_display_mode_; |
| 313 } | 306 } |
| 314 | 307 |
| 315 // Sets multi display mode. | 308 // Sets multi display mode. |
| 316 void SetMultiDisplayMode(MultiDisplayMode mode); | 309 void SetMultiDisplayMode(MultiDisplayMode mode); |
| 317 | 310 |
| 318 // Reconfigure display configuration using the same | 311 // Reconfigure display configuration using the same physical display. |
| 319 // physical display. TODO(oshima): Refactor and move this | 312 // TODO(oshima): Refactor and move this impl to |SetDefaultMultiDisplayMode|. |
| 320 // impl to |SetDefaultMultiDisplayMode|. | |
| 321 void ReconfigureDisplays(); | 313 void ReconfigureDisplays(); |
| 322 | 314 |
| 323 // Update the bounds of the display given by |display_id|. | 315 // Update the bounds of the display given by |display_id|. |
| 324 bool UpdateDisplayBounds(int64_t display_id, const gfx::Rect& new_bounds); | 316 bool UpdateDisplayBounds(int64_t display_id, const gfx::Rect& new_bounds); |
| 325 | 317 |
| 326 // Creates mirror window asynchronously if the software mirror mode | 318 // Creates mirror window asynchronously if the software mirror mode is |
| 327 // is enabled. | 319 // enabled. |
| 328 void CreateMirrorWindowAsyncIfAny(); | 320 void CreateMirrorWindowAsyncIfAny(); |
| 329 | 321 |
| 330 // A unit test may change the internal display id (which never happens on | 322 // A unit test may change the internal display id (which never happens on a |
| 331 // a real device). This will update the mode list for internal display | 323 // real device). This will update the mode list for internal display for this |
| 332 // for this test scenario. | 324 // test scenario. |
| 333 void UpdateInternalManagedDisplayModeListForTest(); | 325 void UpdateInternalManagedDisplayModeListForTest(); |
| 334 | 326 |
| 335 // Zoom the internal display. | 327 // Zoom the internal display. |
| 336 bool ZoomInternalDisplay(bool up); | 328 bool ZoomInternalDisplay(bool up); |
| 337 | 329 |
| 338 // Reset the internal display zoom. | 330 // Reset the internal display zoom. |
| 339 void ResetInternalDisplayZoom(); | 331 void ResetInternalDisplayZoom(); |
| 340 | 332 |
| 341 // Notifies observers of display configuration changes. | 333 // Notifies observers of display configuration changes. |
| 342 void NotifyMetricsChanged(const display::Display& display, uint32_t metrics); | 334 void NotifyMetricsChanged(const Display& display, uint32_t metrics); |
| 343 void NotifyDisplayAdded(const display::Display& display); | 335 void NotifyDisplayAdded(const Display& display); |
| 344 void NotifyDisplayRemoved(const display::Display& display); | 336 void NotifyDisplayRemoved(const Display& display); |
| 345 | 337 |
| 346 // Delegated from the Screen implementation. | 338 // Delegated from the Screen implementation. |
| 347 void AddObserver(display::DisplayObserver* observer); | 339 void AddObserver(DisplayObserver* observer); |
| 348 void RemoveObserver(display::DisplayObserver* observer); | 340 void RemoveObserver(DisplayObserver* observer); |
| 349 | 341 |
| 350 // Returns a display::Display object for a secondary display if it exists | 342 // Returns a Display object for a secondary display if it exists or returns |
| 351 // or returns invalid display if there is no secondary display. | 343 // invalid display if there is no secondary display. TODO(rjkroege): Display |
| 352 // TODO(rjkroege): Display swapping is an obsolete feature pre-dating | 344 // swapping is an obsolete feature pre-dating multi-display support so remove |
| 353 // multi-display support so remove it. | 345 // it. |
| 354 const display::Display& GetSecondaryDisplay() const; | 346 const Display& GetSecondaryDisplay() const; |
| 355 | 347 |
| 356 private: | 348 private: |
| 357 friend class test::DisplayManagerTestApi; | 349 friend class test::DisplayManagerTestApi; |
| 358 | 350 |
| 359 bool software_mirroring_enabled() const { | 351 bool software_mirroring_enabled() const { |
| 360 return multi_display_mode_ == MIRRORING; | 352 return multi_display_mode_ == MIRRORING; |
| 361 }; | 353 } |
| 362 | 354 |
| 363 void set_change_display_upon_host_resize(bool value) { | 355 void set_change_display_upon_host_resize(bool value) { |
| 364 change_display_upon_host_resize_ = value; | 356 change_display_upon_host_resize_ = value; |
| 365 } | 357 } |
| 366 | 358 |
| 367 // Creates software mirroring display related information. The display | 359 // Creates software mirroring display related information. The display used to |
| 368 // used to mirror the content is removed from the |display_info_list|. | 360 // mirror the content is removed from the |display_info_list|. |
| 369 void CreateSoftwareMirroringDisplayInfo(DisplayInfoList* display_info_list); | 361 void CreateSoftwareMirroringDisplayInfo(DisplayInfoList* display_info_list); |
| 370 | 362 |
| 371 display::Display* FindDisplayForId(int64_t id); | 363 Display* FindDisplayForId(int64_t id); |
| 372 | 364 |
| 373 // Add the mirror display's display info if the software based | 365 // Add the mirror display's display info if the software based mirroring is in |
| 374 // mirroring is in use. | 366 // use. |
| 375 void AddMirrorDisplayInfoIfAny(DisplayInfoList* display_info_list); | 367 void AddMirrorDisplayInfoIfAny(DisplayInfoList* display_info_list); |
| 376 | 368 |
| 377 // Inserts and update the display::ManagedDisplayInfo according to the | 369 // Inserts and update the ManagedDisplayInfo according to the overscan state. |
| 378 // overscan | 370 // Note that The ManagedDisplayInfo stored in the |internal_display_info_| can |
| 379 // state. Note that The display::ManagedDisplayInfo stored in the | 371 // be different from |new_info| (due to overscan state), so you must use |
| 380 // |internal_display_info_| | 372 // |GetDisplayInfo| to get the correct ManagedDisplayInfo for a display. |
| 381 // can be different from |new_info| (due to overscan state), so | 373 void InsertAndUpdateDisplayInfo(const ManagedDisplayInfo& new_info); |
| 382 // you must use |GetDisplayInfo| to get the correct | |
| 383 // display::ManagedDisplayInfo for | |
| 384 // a display. | |
| 385 void InsertAndUpdateDisplayInfo(const display::ManagedDisplayInfo& new_info); | |
| 386 | 374 |
| 387 // Called when the display info is updated through InsertAndUpdateDisplayInfo. | 375 // Called when the display info is updated through InsertAndUpdateDisplayInfo. |
| 388 void OnDisplayInfoUpdated(const display::ManagedDisplayInfo& display_info); | 376 void OnDisplayInfoUpdated(const ManagedDisplayInfo& display_info); |
| 389 | 377 |
| 390 // Creates a display object from the display::ManagedDisplayInfo for | 378 // Creates a display object from the ManagedDisplayInfo for |
| 391 // |display_id|. | 379 // |display_id|. |
| 392 display::Display CreateDisplayFromDisplayInfoById(int64_t display_id); | 380 Display CreateDisplayFromDisplayInfoById(int64_t display_id); |
| 393 | 381 |
| 394 // Creates a display object from the display::ManagedDisplayInfo for | 382 // Creates a display object from the ManagedDisplayInfo for |display_id| for |
| 395 // |display_id| | 383 // mirroring. The size of the display will be scaled using |scale| with the |
| 396 // for | 384 // offset using |origin|. |
| 397 // mirroring. The size of the display will be scaled using |scale| | 385 Display CreateMirroringDisplayFromDisplayInfoById(int64_t display_id, |
| 398 // with the offset using |origin|. | 386 const gfx::Point& origin, |
| 399 display::Display CreateMirroringDisplayFromDisplayInfoById( | 387 float scale); |
| 400 int64_t display_id, | |
| 401 const gfx::Point& origin, | |
| 402 float scale); | |
| 403 | 388 |
| 404 // Updates the bounds of all non-primary displays in |display_list| and | 389 // Updates the bounds of all non-primary displays in |display_list| and append |
| 405 // append the indices of displays updated to |updated_indices|. | 390 // the indices of displays updated to |updated_indices|. When the size of |
| 406 // When the size of |display_list| equals 2, the bounds are updated using | 391 // |display_list| equals 2, the bounds are updated using the layout registered |
| 407 // the layout registered for the display pair. For more than 2 displays, | 392 // for the display pair. For more than 2 displays, the bounds are updated |
| 408 // the bounds are updated using horizontal layout. | 393 // using horizontal layout. |
| 409 void UpdateNonPrimaryDisplayBoundsForLayout( | 394 void UpdateNonPrimaryDisplayBoundsForLayout( |
| 410 display::Displays* display_list, | 395 Displays* display_list, |
| 411 std::vector<size_t>* updated_indices); | 396 std::vector<size_t>* updated_indices); |
| 412 | 397 |
| 413 void CreateMirrorWindowIfAny(); | 398 void CreateMirrorWindowIfAny(); |
| 414 | 399 |
| 415 void RunPendingTasksForTest(); | 400 void RunPendingTasksForTest(); |
| 416 | 401 |
| 417 // Applies the |layout| and updates the bounds of displays in |display_list|. | 402 // Applies the |layout| and updates the bounds of displays in |display_list|. |
| 418 // |updated_ids| contains the ids for displays whose bounds have changed. | 403 // |updated_ids| contains the ids for displays whose bounds have changed. |
| 419 void ApplyDisplayLayout(const display::DisplayLayout& layout, | 404 void ApplyDisplayLayout(const DisplayLayout& layout, |
| 420 display::Displays* display_list, | 405 Displays* display_list, |
| 421 std::vector<int64_t>* updated_ids); | 406 std::vector<int64_t>* updated_ids); |
| 422 | 407 |
| 423 Delegate* delegate_ = nullptr; // not owned. | 408 Delegate* delegate_ = nullptr; // not owned. |
| 424 | 409 |
| 425 std::unique_ptr<Screen> screen_; | 410 std::unique_ptr<Screen> screen_; |
| 426 | 411 |
| 427 std::unique_ptr<DisplayLayoutStore> layout_store_; | 412 std::unique_ptr<DisplayLayoutStore> layout_store_; |
| 428 | 413 |
| 429 int64_t first_display_id_ = kInvalidDisplayId; | 414 int64_t first_display_id_ = kInvalidDisplayId; |
| 430 | 415 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 443 size_t num_connected_displays_ = 0; | 428 size_t num_connected_displays_ = 0; |
| 444 | 429 |
| 445 bool force_bounds_changed_ = false; | 430 bool force_bounds_changed_ = false; |
| 446 | 431 |
| 447 // The mapping from the display ID to its internal data. | 432 // The mapping from the display ID to its internal data. |
| 448 std::map<int64_t, ManagedDisplayInfo> display_info_; | 433 std::map<int64_t, ManagedDisplayInfo> display_info_; |
| 449 | 434 |
| 450 // Selected display modes for displays. Key is the displays' ID. | 435 // Selected display modes for displays. Key is the displays' ID. |
| 451 std::map<int64_t, scoped_refptr<ManagedDisplayMode>> display_modes_; | 436 std::map<int64_t, scoped_refptr<ManagedDisplayMode>> display_modes_; |
| 452 | 437 |
| 453 // When set to true, the host window's resize event updates | 438 // When set to true, the host window's resize event updates the display's |
| 454 // the display's size. This is set to true when running on | 439 // size. This is set to true when running on desktop environment (for |
| 455 // desktop environment (for debugging) so that resizing the host | 440 // debugging) so that resizing the host window will update the display |
| 456 // window will update the display properly. This is set to false | 441 // properly. This is set to false on device as well as during the unit tests. |
| 457 // on device as well as during the unit tests. | |
| 458 bool change_display_upon_host_resize_ = false; | 442 bool change_display_upon_host_resize_ = false; |
| 459 | 443 |
| 460 MultiDisplayMode multi_display_mode_ = EXTENDED; | 444 MultiDisplayMode multi_display_mode_ = EXTENDED; |
| 461 MultiDisplayMode current_default_multi_display_mode_ = EXTENDED; | 445 MultiDisplayMode current_default_multi_display_mode_ = EXTENDED; |
| 462 | 446 |
| 463 int64_t mirroring_display_id_ = kInvalidDisplayId; | 447 int64_t mirroring_display_id_ = kInvalidDisplayId; |
| 464 Displays software_mirroring_display_list_; | 448 Displays software_mirroring_display_list_; |
| 465 | 449 |
| 466 // User preference for rotation lock of the internal display. | 450 // User preference for rotation lock of the internal display. |
| 467 bool registered_internal_display_rotation_lock_ = false; | 451 bool registered_internal_display_rotation_lock_ = false; |
| 468 | 452 |
| 469 // User preference for the rotation of the internal display. | 453 // User preference for the rotation of the internal display. |
| 470 Display::Rotation registered_internal_display_rotation_ = Display::ROTATE_0; | 454 Display::Rotation registered_internal_display_rotation_ = Display::ROTATE_0; |
| 471 | 455 |
| 472 bool unified_desktop_enabled_ = false; | 456 bool unified_desktop_enabled_ = false; |
| 473 | 457 |
| 474 base::ObserverList<DisplayObserver> observers_; | 458 base::ObserverList<DisplayObserver> observers_; |
| 475 | 459 |
| 476 base::WeakPtrFactory<DisplayManager> weak_ptr_factory_; | 460 base::WeakPtrFactory<DisplayManager> weak_ptr_factory_; |
| 477 | 461 |
| 478 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 462 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 479 }; | 463 }; |
| 480 | 464 |
| 481 } // namespace display | 465 } // namespace display |
| 482 | 466 |
| 483 #endif // UI_DISPLAY_MANAGER_DISPLAY_MANAGER_H_ | 467 #endif // UI_DISPLAY_MANAGER_DISPLAY_MANAGER_H_ |
| OLD | NEW |