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

Unified Diff: components/mus/ws/platform_screen.h

Issue 1899923002: Basic display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed debugging code Created 4 years, 8 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 | « components/mus/ws/platform_display_init_params.h ('k') | components/mus/ws/platform_screen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/platform_screen.h
diff --git a/components/mus/ws/platform_screen.h b/components/mus/ws/platform_screen.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b12cc753dac0bbeb10cf6f5dd82f8288fc08b0f
--- /dev/null
+++ b/components/mus/ws/platform_screen.h
@@ -0,0 +1,87 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
+#define COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
+
+#include <stdint.h>
+
+#include <set>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "ui/display/types/native_display_observer.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace ui {
+class NativeDisplayDelegate;
+class DisplaySnapshot;
+}
+
+namespace mus {
+namespace ws {
+
+// PlatformScreen provides the necessary functionality to configure all
+// attached physical displays.
+class PlatformScreen : public ui::NativeDisplayObserver {
sky 2016/05/03 23:33:39 I find the class confusing because it has a bunch
rjkroege 2016/05/04 01:37:40 Done.
+ public:
+ PlatformScreen();
+ ~PlatformScreen() override;
+
+ // Initializes platform specific screen resources. Assumes that the ozone
+ // platform implementation has been initialized.
+ void Init();
+
+ // The PhysicalScreen will invoke this callback when a previously requested
+ // display configuration has been confirmed.
+ using ConfiguredDisplayCallback = base::Callback<void(int64_t, gfx::Rect)>;
+
+ // ConfigurePhysicalDisplay() configures a single physical display and returns
+ // pending bounds for it via callback.
+ void ConfigurePhysicalDisplay(const ConfiguredDisplayCallback& callback);
+
+ private:
+ // Some ozone platforms do not configure physical displays and so do not
+ // callback into this class via the implementation of NativeDisplayObserver.
+ // FixedSizeScreenConfiguration() short-circuits the implementation of display
+ // configuration in this case by calling the |callback| provided to
+ // ConfigurePhysicalDisplay() with a hard-coded |id| and |bounds|.
+ void FixedSizeScreenConfiguration(ConfiguredDisplayCallback callback);
+
+ // TODO(rjkroege): NativeDisplayObserver is misnamed as it tracks changes in
+ // the physical "Screen". Consider renaming it to NativeScreenObserver.
+ // ui::NativeDisplayObserver:
+ void OnConfigurationChanged() override;
+
+ // Additional display management callbacks.
+ void OnDisplaysAquired(const ConfiguredDisplayCallback& callback,
+ const std::vector<ui::DisplaySnapshot*>& displays);
+ void OnDisplayConfigured(const ConfiguredDisplayCallback& callback,
+ int64_t id,
+ const gfx::Rect& bounds,
+ bool success);
+
+ // Flags used to keep track of the current state of display configuration.
+ // |is_configuring| is true if configuring the Screen and starts false.
+ bool is_configuring_;
+
+ // If |is_configuring_| is true and another display configuration event
+ // happens, the event is deferred. |should_configure_| is set to true and a
+ // display configuration will be scheduled after the current one finishes.
+ // NB: events are handled once per vblank.
+ bool should_configure_;
+
+ std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate_;
+ ConfiguredDisplayCallback callback_;
+
+ base::WeakPtrFactory<PlatformScreen> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformScreen);
+};
+
+} // namespace ws
+} // namespace mus
+
+#endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
« no previous file with comments | « components/mus/ws/platform_display_init_params.h ('k') | components/mus/ws/platform_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698