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

Unified Diff: services/ui/display/platform_screen_impl_ozone.h

Issue 2297743002: Process DisplaySnapshots in PlatformScreen. (Closed)
Patch Set: Add comment. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/display/BUILD.gn ('k') | services/ui/display/platform_screen_impl_ozone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2df9c8cfe35c83d1151d9dddff4b4f44f1bda1ce 100644
--- a/services/ui/display/platform_screen_impl_ozone.h
+++ b/services/ui/display/platform_screen_impl_ozone.h
@@ -26,11 +26,57 @@ 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;
+ // The display bounds have been modified and delegate should be updated.
+ bool modified = false;
+ // The display has been removed and delegate should be updated.
+ 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 call to delegate 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 +89,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);
« no previous file with comments | « services/ui/display/BUILD.gn ('k') | services/ui/display/platform_screen_impl_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698