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

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

Issue 2297743002: Process DisplaySnapshots in PlatformScreen. (Closed)
Patch Set: Fix test. Created 4 years, 4 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..c9defb75220e70c6016f4163b04e5dc39ceae19e 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): Replace with something like ash::DisplayInfo after it's
rjkroege 2016/08/30 18:41:59 fyi: is in the commit queue You need to say what
kylechar 2016/08/31 15:58:01 I've updated the comment. I see display::ManagedDi
+ // moved to src/ui/display.
+ struct DisplayInfo {
+ DisplayInfo(int64_t new_id, gfx::Rect new_bounds)
+ : 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.
+ 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
+ // call delegate.
+ void ProcessRemovedDisplays(
+ const ui::DisplayConfigurator::DisplayStateList& snapshots);
+
+ // Processes display snapshots and updates the bounds of an existing displays.
+ // 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