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

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

Issue 2297743002: Process DisplaySnapshots in PlatformScreen. (Closed)
Patch Set: Update tests. 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
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..b8856b629a7b60331e0cd4157c7bb4637a8b5aec 100644
--- a/services/ui/display/platform_screen_impl_ozone.h
+++ b/services/ui/display/platform_screen_impl_ozone.h
@@ -23,14 +23,50 @@ namespace display {
class PlatformScreenImplOzone : public PlatformScreen,
public ui::DisplayConfigurator::Observer {
public:
+ // TODO(kylechar): This struct is just temporary until we migrate
+ // DisplayManager code out of ash so it can be used here.
+ struct DisplayInfo {
sky 2016/09/01 19:25:08 Does this need to be public?
kylechar 2016/09/02 15:18:34 Not anymore (it did at a previous revision). Move
+ DisplayInfo(int64_t new_id, gfx::Rect new_bounds)
sky 2016/09/01 19:25:08 const gfx::rect&
kylechar 2016/09/02 15:18:34 Done.
+ : id(new_id), bounds(new_bounds), known_bounds(new_bounds) {}
+
+ int64_t id;
+ // The display bounds.
+ gfx::Rect bounds;
+ // The display bounds that the delegate knows about.
sky 2016/09/01 19:25:08 clarify what 'knows about' means here. That said,
kylechar 2016/09/02 15:18:34 Clarified comment. As to why, the bounds can get c
sky 2016/09/02 16:03:21 I'm likely missing something. See my other comment
+ gfx::Rect known_bounds;
+ bool removed = false;
+ };
+
PlatformScreenImplOzone();
~PlatformScreenImplOzone() override;
- private:
// PlatformScreen:
void Init(PlatformScreenDelegate* delegate) override;
int64_t GetPrimaryDisplayId() const override;
+ private:
+ // Process display snapshots and mark removed displays as removed. Does not
sky 2016/09/01 19:25:08 Document what 'process' means here. I'm suggesting
kylechar 2016/09/02 15:18:34 Done.
+ // call delegate.
+ void ProcessRemovedDisplays(
+ const ui::DisplayConfigurator::DisplayStateList& snapshots);
+
+ // Processes display snapshots and updates the bounds of an existing displays.
sky 2016/09/01 19:25:08 remove 'an'
kylechar 2016/09/02 15:18:34 Done. I've updated the method descriptions to be m
+ // Does not call delegate.
+ void ProcessModifiedDisplays(
+ const ui::DisplayConfigurator::DisplayStateList& snapshots);
+
+ // Examines list of cached displays and checks for modified or removed
+ // displays. Also updates display bounds in response to modified or removed
+ // displays. Calls OnDisplayModified() or OnDisplayRemoved() on the delegate
+ // when appropriate, at most once per display.
+ //
+ // Usually used after ProcessRemovedDisplays() and ProcessModifiedDisplays().
+ void UpdateCachedDisplays();
+
+ // Adds any new displays in the list of cached displays and calls delegate.
+ void AddNewDisplays(
+ const ui::DisplayConfigurator::DisplayStateList& snapshots);
+
// ui::DisplayConfigurator::Observer:
void OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& displays) override;
@@ -43,7 +79,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);

Powered by Google App Engine
This is Rietveld 408576698