| Index: ui/display/manager/display_manager.h
|
| diff --git a/ui/display/manager/display_manager.h b/ui/display/manager/display_manager.h
|
| index f083a6a0a4c67c03dc6d8a16e17e96f866ac9353..2e1e90480f891a96a206d85f5fa35d43839c397f 100644
|
| --- a/ui/display/manager/display_manager.h
|
| +++ b/ui/display/manager/display_manager.h
|
| @@ -64,9 +64,9 @@ class DISPLAY_EXPORT DisplayManager
|
| // Closes the mirror window if not necessary.
|
| virtual void CloseMirroringDisplayIfNotNecessary() = 0;
|
|
|
| - // Called before and after the display configuration changes.
|
| - // When |clear_focus| is true, the implementation should
|
| - // deactivate the active window and set the focus window to NULL.
|
| + // Called before and after the display configuration changes. When
|
| + // |clear_focus| is true, the implementation should deactivate the active
|
| + // window and set the focus window to NULL.
|
| virtual void PreDisplayConfigurationChange(bool clear_focus) = 0;
|
| virtual void PostDisplayConfigurationChange(bool must_clear_window) = 0;
|
|
|
| @@ -104,9 +104,8 @@ class DISPLAY_EXPORT DisplayManager
|
|
|
| void set_delegate(Delegate* delegate) { delegate_ = delegate; }
|
|
|
| - // When set to true, the DisplayManager calls OnDisplayMetricsChanged
|
| - // even if the display's bounds didn't change. Used to swap primary
|
| - // display.
|
| + // When set to true, the DisplayManager calls OnDisplayMetricsChanged even if
|
| + // the display's bounds didn't change. Used to swap primary display.
|
| void set_force_bounds_changed(bool force_bounds_changed) {
|
| force_bounds_changed_ = force_bounds_changed;
|
| }
|
| @@ -114,35 +113,32 @@ class DISPLAY_EXPORT DisplayManager
|
| // Returns the display id of the first display in the outupt list.
|
| int64_t first_display_id() const { return first_display_id_; }
|
|
|
| - // Initializes displays using command line flag. Returns false
|
| - // if no command line flag was provided.
|
| + // Initializes displays using command line flag. Returns false if no command
|
| + // line flag was provided.
|
| bool InitFromCommandLine();
|
|
|
| // Initialize default display.
|
| void InitDefaultDisplay();
|
|
|
| - // Initializes font related params that depends on display
|
| - // configuration.
|
| + // Initializes font related params that depends on display configuration.
|
| void RefreshFontParams();
|
|
|
| // Returns the display layout used for current displays.
|
| - const display::DisplayLayout& GetCurrentDisplayLayout() const;
|
| + const DisplayLayout& GetCurrentDisplayLayout() const;
|
|
|
| // Returns the current display list.
|
| - display::DisplayIdList GetCurrentDisplayIdList() const;
|
| + DisplayIdList GetCurrentDisplayIdList() const;
|
|
|
| - // Sets the layout for the current display pair. The |layout| specifies
|
| - // the locaion of the displays relative to their parents.
|
| - void SetLayoutForCurrentDisplays(
|
| - std::unique_ptr<display::DisplayLayout> layout);
|
| + // Sets the layout for the current display pair. The |layout| specifies the
|
| + // locaion of the displays relative to their parents.
|
| + void SetLayoutForCurrentDisplays(std::unique_ptr<DisplayLayout> layout);
|
|
|
| // Returns display for given |id|;
|
| - const display::Display& GetDisplayForId(int64_t id) const;
|
| + const Display& GetDisplayForId(int64_t id) const;
|
|
|
| - // Finds the display that contains |point| in screeen coordinates.
|
| - // Returns invalid display if there is no display that can satisfy
|
| - // the condition.
|
| - const display::Display& FindDisplayContainingPoint(
|
| + // Finds the display that contains |point| in screeen coordinates. Returns
|
| + // invalid display if there is no display that can satisfy the condition.
|
| + const Display& FindDisplayContainingPoint(
|
| const gfx::Point& point_in_screen) const;
|
|
|
| // Sets the work area's |insets| to the display given by |display_id|.
|
| @@ -156,8 +152,8 @@ class DISPLAY_EXPORT DisplayManager
|
| // Sets the display's rotation for the given |source|. The new |rotation| will
|
| // also become active.
|
| void SetDisplayRotation(int64_t display_id,
|
| - display::Display::Rotation rotation,
|
| - display::Display::RotationSource source);
|
| + Display::Rotation rotation,
|
| + Display::RotationSource source);
|
|
|
| // Resets the UI scale of the display with |display_id| to the one defined in
|
| // the default mode.
|
| @@ -167,14 +163,13 @@ class DISPLAY_EXPORT DisplayManager
|
| // ui-scale change, and device scale factor change. Returns true if it changes
|
| // the display resolution so that the caller needs to show a notification in
|
| // case the new resolution actually doesn't work.
|
| - bool SetDisplayMode(
|
| - int64_t display_id,
|
| - const scoped_refptr<display::ManagedDisplayMode>& display_mode);
|
| + bool SetDisplayMode(int64_t display_id,
|
| + const scoped_refptr<ManagedDisplayMode>& display_mode);
|
|
|
| - // Register per display properties. |overscan_insets| is NULL if
|
| - // the display has no custom overscan insets.
|
| + // Register per display properties. |overscan_insets| is null if the display
|
| + // has no custom overscan insets.
|
| void RegisterDisplayProperty(int64_t display_id,
|
| - display::Display::Rotation rotation,
|
| + Display::Rotation rotation,
|
| float ui_scale,
|
| const gfx::Insets* overscan_insets,
|
| const gfx::Size& resolution_in_pixels,
|
| @@ -183,7 +178,7 @@ class DISPLAY_EXPORT DisplayManager
|
|
|
| // Register stored rotation properties for the internal display.
|
| void RegisterDisplayRotationProperties(bool rotation_lock,
|
| - display::Display::Rotation rotation);
|
| + Display::Rotation rotation);
|
|
|
| // Returns the stored rotation lock preference if it has been loaded,
|
| // otherwise false.
|
| @@ -192,26 +187,26 @@ class DISPLAY_EXPORT DisplayManager
|
| }
|
|
|
| // Returns the stored rotation preference for the internal display if it has
|
| - // been loaded, otherwise |display::Display::Rotate_0|.
|
| - display::Display::Rotation registered_internal_display_rotation() const {
|
| + // been loaded, otherwise |Display::Rotate_0|.
|
| + Display::Rotation registered_internal_display_rotation() const {
|
| return registered_internal_display_rotation_;
|
| }
|
|
|
| // Returns the display mode of |display_id| which is currently used.
|
| - scoped_refptr<display::ManagedDisplayMode> GetActiveModeForDisplayId(
|
| + scoped_refptr<ManagedDisplayMode> GetActiveModeForDisplayId(
|
| int64_t display_id) const;
|
|
|
| - // Returns the display's selected mode. This returns false and doesn't
|
| - // set |mode_out| if the display mode is in default.
|
| - scoped_refptr<display::ManagedDisplayMode> GetSelectedModeForDisplayId(
|
| + // Returns the display's selected mode. This returns false and doesn't set
|
| + // |mode_out| if the display mode is in default.
|
| + scoped_refptr<ManagedDisplayMode> GetSelectedModeForDisplayId(
|
| int64_t display_id) const;
|
|
|
| // Tells if the virtual resolution feature is enabled.
|
| bool IsDisplayUIScalingEnabled() const;
|
|
|
| // Returns the current overscan insets for the specified |display_id|.
|
| - // Returns an empty insets (0, 0, 0, 0) if no insets are specified for
|
| - // the display.
|
| + // Returns an empty insets (0, 0, 0, 0) if no insets are specified for the
|
| + // display.
|
| gfx::Insets GetOverscanInsets(int64_t display_id) const;
|
|
|
| // Sets the color calibration of the display to |profile|.
|
| @@ -219,53 +214,51 @@ class DISPLAY_EXPORT DisplayManager
|
| ui::ColorCalibrationProfile profile);
|
|
|
| // Called when display configuration has changed. The new display
|
| - // configurations is passed as a vector of Display object, which
|
| - // contains each display's new infomration.
|
| + // configurations is passed as a vector of Display object, which contains each
|
| + // display's new infomration.
|
| void OnNativeDisplaysChanged(
|
| - const std::vector<display::ManagedDisplayInfo>& display_info_list);
|
| + const std::vector<ManagedDisplayInfo>& display_info_list);
|
|
|
| // Updates the internal display data and notifies observers about the changes.
|
| void UpdateDisplaysWith(
|
| - const std::vector<display::ManagedDisplayInfo>& display_info_list);
|
| + const std::vector<ManagedDisplayInfo>& display_info_list);
|
|
|
| // Updates current displays using current |display_info_|.
|
| void UpdateDisplays();
|
|
|
| - // Returns the display at |index|. The display at 0 is
|
| - // no longer considered "primary".
|
| - const display::Display& GetDisplayAt(size_t index) const;
|
| + // Returns the display at |index|. The display at 0 is no longer considered
|
| + // "primary".
|
| + const Display& GetDisplayAt(size_t index) const;
|
|
|
| - const display::Display& GetPrimaryDisplayCandidate() const;
|
| + const Display& GetPrimaryDisplayCandidate() const;
|
|
|
| - // Returns the logical number of displays. This returns 1
|
| - // when displays are mirrored.
|
| + // Returns the logical number of displays. This returns 1 when displays are
|
| + // mirrored.
|
| size_t GetNumDisplays() const;
|
|
|
| // Returns only the currently active displays. This list does not include the
|
| // displays that will be removed if |UpdateDisplaysWith| is currently
|
| // executing.
|
| // See https://crbug.com/632755
|
| - const display::Displays& active_only_display_list() const {
|
| + const Displays& active_only_display_list() const {
|
| return is_updating_display_list_ ? active_only_display_list_
|
| : active_display_list();
|
| }
|
|
|
| - const display::Displays& active_display_list() const {
|
| - return active_display_list_;
|
| - }
|
| + const Displays& active_display_list() const { return active_display_list_; }
|
|
|
| // Returns true if the display specified by |display_id| is currently
|
| // connected and active. (mirroring display isn't active, for example).
|
| bool IsActiveDisplayId(int64_t display_id) const;
|
|
|
| - // Returns the number of connected displays. This returns 2
|
| - // when displays are mirrored.
|
| + // Returns the number of connected displays. This returns 2 when displays are
|
| + // mirrored.
|
| size_t num_connected_displays() const { return num_connected_displays_; }
|
|
|
| // Returns the mirroring status.
|
| bool IsInMirrorMode() const;
|
| int64_t mirroring_display_id() const { return mirroring_display_id_; }
|
| - const display::Displays& software_mirroring_display_list() const {
|
| + const Displays& software_mirroring_display_list() const {
|
| return software_mirroring_display_list_;
|
| }
|
|
|
| @@ -276,20 +269,20 @@ class DISPLAY_EXPORT DisplayManager
|
| // Returns true if it's in unified desktop mode.
|
| bool IsInUnifiedMode() const;
|
|
|
| - // Returns the display used for software mirrroring. Returns invalid
|
| - // display if not found.
|
| - const display::Display GetMirroringDisplayById(int64_t id) const;
|
| + // Returns the display used for software mirrroring. Returns invalid display
|
| + // if not found.
|
| + const Display GetMirroringDisplayById(int64_t id) const;
|
|
|
| // Retuns the display info associated with |display_id|.
|
| - const display::ManagedDisplayInfo& GetDisplayInfo(int64_t display_id) const;
|
| + const ManagedDisplayInfo& GetDisplayInfo(int64_t display_id) const;
|
|
|
| // Returns the human-readable name for the display |id|.
|
| std::string GetDisplayNameForId(int64_t id);
|
|
|
| - // Returns the display id that is capable of UI scaling. On device,
|
| - // this returns internal display's ID if its device scale factor is 2,
|
| - // or invalid ID if such internal display doesn't exist. On linux
|
| - // desktop, this returns the first display ID.
|
| + // Returns the display id that is capable of UI scaling. On device, this
|
| + // returns internal display's ID if its device scale factor is 2, or invalid
|
| + // ID if such internal display doesn't exist. On linux desktop, this returns
|
| + // the first display ID.
|
| int64_t GetDisplayIdForUIScaling() const;
|
|
|
| // Change the mirror mode.
|
| @@ -315,21 +308,20 @@ class DISPLAY_EXPORT DisplayManager
|
| // Sets multi display mode.
|
| void SetMultiDisplayMode(MultiDisplayMode mode);
|
|
|
| - // Reconfigure display configuration using the same
|
| - // physical display. TODO(oshima): Refactor and move this
|
| - // impl to |SetDefaultMultiDisplayMode|.
|
| + // Reconfigure display configuration using the same physical display.
|
| + // TODO(oshima): Refactor and move this impl to |SetDefaultMultiDisplayMode|.
|
| void ReconfigureDisplays();
|
|
|
| // Update the bounds of the display given by |display_id|.
|
| bool UpdateDisplayBounds(int64_t display_id, const gfx::Rect& new_bounds);
|
|
|
| - // Creates mirror window asynchronously if the software mirror mode
|
| - // is enabled.
|
| + // Creates mirror window asynchronously if the software mirror mode is
|
| + // enabled.
|
| void CreateMirrorWindowAsyncIfAny();
|
|
|
| - // A unit test may change the internal display id (which never happens on
|
| - // a real device). This will update the mode list for internal display
|
| - // for this test scenario.
|
| + // A unit test may change the internal display id (which never happens on a
|
| + // real device). This will update the mode list for internal display for this
|
| + // test scenario.
|
| void UpdateInternalManagedDisplayModeListForTest();
|
|
|
| // Zoom the internal display.
|
| @@ -339,75 +331,68 @@ class DISPLAY_EXPORT DisplayManager
|
| void ResetInternalDisplayZoom();
|
|
|
| // Notifies observers of display configuration changes.
|
| - void NotifyMetricsChanged(const display::Display& display, uint32_t metrics);
|
| - void NotifyDisplayAdded(const display::Display& display);
|
| - void NotifyDisplayRemoved(const display::Display& display);
|
| + void NotifyMetricsChanged(const Display& display, uint32_t metrics);
|
| + void NotifyDisplayAdded(const Display& display);
|
| + void NotifyDisplayRemoved(const Display& display);
|
|
|
| // Delegated from the Screen implementation.
|
| - void AddObserver(display::DisplayObserver* observer);
|
| - void RemoveObserver(display::DisplayObserver* observer);
|
| + void AddObserver(DisplayObserver* observer);
|
| + void RemoveObserver(DisplayObserver* observer);
|
|
|
| - // Returns a display::Display object for a secondary display if it exists
|
| - // or returns invalid display if there is no secondary display.
|
| - // TODO(rjkroege): Display swapping is an obsolete feature pre-dating
|
| - // multi-display support so remove it.
|
| - const display::Display& GetSecondaryDisplay() const;
|
| + // Returns a Display object for a secondary display if it exists or returns
|
| + // invalid display if there is no secondary display. TODO(rjkroege): Display
|
| + // swapping is an obsolete feature pre-dating multi-display support so remove
|
| + // it.
|
| + const Display& GetSecondaryDisplay() const;
|
|
|
| private:
|
| friend class test::DisplayManagerTestApi;
|
|
|
| bool software_mirroring_enabled() const {
|
| return multi_display_mode_ == MIRRORING;
|
| - };
|
| + }
|
|
|
| void set_change_display_upon_host_resize(bool value) {
|
| change_display_upon_host_resize_ = value;
|
| }
|
|
|
| - // Creates software mirroring display related information. The display
|
| - // used to mirror the content is removed from the |display_info_list|.
|
| + // Creates software mirroring display related information. The display used to
|
| + // mirror the content is removed from the |display_info_list|.
|
| void CreateSoftwareMirroringDisplayInfo(DisplayInfoList* display_info_list);
|
|
|
| - display::Display* FindDisplayForId(int64_t id);
|
| + Display* FindDisplayForId(int64_t id);
|
|
|
| - // Add the mirror display's display info if the software based
|
| - // mirroring is in use.
|
| + // Add the mirror display's display info if the software based mirroring is in
|
| + // use.
|
| void AddMirrorDisplayInfoIfAny(DisplayInfoList* display_info_list);
|
|
|
| - // Inserts and update the display::ManagedDisplayInfo according to the
|
| - // overscan
|
| - // state. Note that The display::ManagedDisplayInfo stored in the
|
| - // |internal_display_info_|
|
| - // can be different from |new_info| (due to overscan state), so
|
| - // you must use |GetDisplayInfo| to get the correct
|
| - // display::ManagedDisplayInfo for
|
| - // a display.
|
| - void InsertAndUpdateDisplayInfo(const display::ManagedDisplayInfo& new_info);
|
| + // Inserts and update the ManagedDisplayInfo according to the overscan state.
|
| + // Note that The ManagedDisplayInfo stored in the |internal_display_info_| can
|
| + // be different from |new_info| (due to overscan state), so you must use
|
| + // |GetDisplayInfo| to get the correct ManagedDisplayInfo for a display.
|
| + void InsertAndUpdateDisplayInfo(const ManagedDisplayInfo& new_info);
|
|
|
| // Called when the display info is updated through InsertAndUpdateDisplayInfo.
|
| - void OnDisplayInfoUpdated(const display::ManagedDisplayInfo& display_info);
|
| + void OnDisplayInfoUpdated(const ManagedDisplayInfo& display_info);
|
|
|
| - // Creates a display object from the display::ManagedDisplayInfo for
|
| + // Creates a display object from the ManagedDisplayInfo for
|
| // |display_id|.
|
| - display::Display CreateDisplayFromDisplayInfoById(int64_t display_id);
|
| -
|
| - // Creates a display object from the display::ManagedDisplayInfo for
|
| - // |display_id|
|
| - // for
|
| - // mirroring. The size of the display will be scaled using |scale|
|
| - // with the offset using |origin|.
|
| - display::Display CreateMirroringDisplayFromDisplayInfoById(
|
| - int64_t display_id,
|
| - const gfx::Point& origin,
|
| - float scale);
|
| -
|
| - // Updates the bounds of all non-primary displays in |display_list| and
|
| - // append the indices of displays updated to |updated_indices|.
|
| - // When the size of |display_list| equals 2, the bounds are updated using
|
| - // the layout registered for the display pair. For more than 2 displays,
|
| - // the bounds are updated using horizontal layout.
|
| + Display CreateDisplayFromDisplayInfoById(int64_t display_id);
|
| +
|
| + // Creates a display object from the ManagedDisplayInfo for |display_id| for
|
| + // mirroring. The size of the display will be scaled using |scale| with the
|
| + // offset using |origin|.
|
| + Display CreateMirroringDisplayFromDisplayInfoById(int64_t display_id,
|
| + const gfx::Point& origin,
|
| + float scale);
|
| +
|
| + // Updates the bounds of all non-primary displays in |display_list| and append
|
| + // the indices of displays updated to |updated_indices|. When the size of
|
| + // |display_list| equals 2, the bounds are updated using the layout registered
|
| + // for the display pair. For more than 2 displays, the bounds are updated
|
| + // using horizontal layout.
|
| void UpdateNonPrimaryDisplayBoundsForLayout(
|
| - display::Displays* display_list,
|
| + Displays* display_list,
|
| std::vector<size_t>* updated_indices);
|
|
|
| void CreateMirrorWindowIfAny();
|
| @@ -416,8 +401,8 @@ class DISPLAY_EXPORT DisplayManager
|
|
|
| // Applies the |layout| and updates the bounds of displays in |display_list|.
|
| // |updated_ids| contains the ids for displays whose bounds have changed.
|
| - void ApplyDisplayLayout(const display::DisplayLayout& layout,
|
| - display::Displays* display_list,
|
| + void ApplyDisplayLayout(const DisplayLayout& layout,
|
| + Displays* display_list,
|
| std::vector<int64_t>* updated_ids);
|
|
|
| Delegate* delegate_ = nullptr; // not owned.
|
| @@ -450,11 +435,10 @@ class DISPLAY_EXPORT DisplayManager
|
| // Selected display modes for displays. Key is the displays' ID.
|
| std::map<int64_t, scoped_refptr<ManagedDisplayMode>> display_modes_;
|
|
|
| - // When set to true, the host window's resize event updates
|
| - // the display's size. This is set to true when running on
|
| - // desktop environment (for debugging) so that resizing the host
|
| - // window will update the display properly. This is set to false
|
| - // on device as well as during the unit tests.
|
| + // When set to true, the host window's resize event updates the display's
|
| + // size. This is set to true when running on desktop environment (for
|
| + // debugging) so that resizing the host window will update the display
|
| + // properly. This is set to false on device as well as during the unit tests.
|
| bool change_display_upon_host_resize_ = false;
|
|
|
| MultiDisplayMode multi_display_mode_ = EXTENDED;
|
|
|