Chromium Code Reviews| Index: services/ui/display/platform_screen_impl_ozone.h |
| diff --git a/services/ui/display/platform_screen_impl_ozone.h b/services/ui/display/platform_screen_impl_ozone.h |
| index d7282df3bcce91440d9d324d84057ffe994bd51d..66daf969d6827c77d8c18c86073ca728b94e9d57 100644 |
| --- a/services/ui/display/platform_screen_impl_ozone.h |
| +++ b/services/ui/display/platform_screen_impl_ozone.h |
| @@ -26,11 +26,55 @@ class PlatformScreenImplOzone : public PlatformScreen, |
| PlatformScreenImplOzone(); |
| ~PlatformScreenImplOzone() override; |
| - private: |
| // PlatformScreen: |
| void Init(PlatformScreenDelegate* delegate) override; |
| int64_t GetPrimaryDisplayId() const override; |
| + private: |
| + // TODO(kylechar): This struct is just temporary until we migrate |
| + // DisplayManager code out of ash so it can be used here. |
| + struct DisplayInfo { |
| + DisplayInfo(int64_t new_id, const gfx::Rect& new_bounds) |
| + : id(new_id), bounds(new_bounds) {} |
| + |
| + int64_t id; |
| + // The display bounds. |
| + gfx::Rect bounds; |
| + bool modified = false; |
|
sky
2016/09/02 18:29:28
Add a description as to what this means and intend
kylechar
2016/09/06 15:35:55
Done.
|
| + bool removed = false; |
| + }; |
| + using CachedDisplayIterator = std::vector<DisplayInfo>::iterator; |
| + |
| + // Processes list of display snapshots and sets |removed| on any displays that |
| + // have been removed. Updates |primary_display_id_| if the primary display was |
| + // removed. Does not remove displays from |cached_displays_| or send updates |
| + // to delegate. |
| + void ProcessRemovedDisplays( |
| + const ui::DisplayConfigurator::DisplayStateList& snapshots); |
| + |
| + // Processes list of display snapshots and updates the bounds of any displays |
| + // in |cached_displays_| that have changed size. Does not send updates to |
| + // delegate. |
| + void ProcessModifiedDisplays( |
| + const ui::DisplayConfigurator::DisplayStateList& snapshots); |
| + |
| + // Looks at |cached_displays_| for modified or removed displays. Also updates |
| + // display bounds in response to modified or removed displays. Sends updates |
| + // to the delegate when appropriate by calling OnDisplayModified() or |
| + // OnDisplayRemoved(). Makes at most one function call per display. |
| + // |
| + // Usually used after ProcessRemovedDisplays() and ProcessModifiedDisplays(). |
| + void UpdateCachedDisplays(); |
| + |
| + // Processes list of display snapshots and adds any new displays to |
| + // |cached_displays_|. Updates delegate by calling OnDisplayAdded(). |
| + void AddNewDisplays( |
| + const ui::DisplayConfigurator::DisplayStateList& snapshots); |
| + |
| + // Returns an iterator to the cached display with |display_id| or an end |
| + // iterator if there is no display with that id. |
| + CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id); |
| + |
| // ui::DisplayConfigurator::Observer: |
| void OnDisplayModeChanged( |
| const ui::DisplayConfigurator::DisplayStateList& displays) override; |
| @@ -43,7 +87,7 @@ class PlatformScreenImplOzone : public PlatformScreen, |
| // TODO(kylechar): These values can/should be replaced by DisplayLayout. |
| int64_t primary_display_id_ = display::Display::kInvalidDisplayID; |
| - std::set<uint64_t> displays_; |
| + std::vector<DisplayInfo> cached_displays_; |
| gfx::Point next_display_origin_; |
| DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone); |