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

Side by Side Diff: components/mus/ws/platform_screen_impl_ozone.h

Issue 1899923002: Basic display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_
6 #define COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "base/memory/weak_ptr.h"
14 #include "components/mus/ws/platform_screen.h"
15 #include "ui/display/types/native_display_observer.h"
16 #include "ui/gfx/geometry/rect.h"
17
18 namespace gfx {
19 class Rect;
20 }
21
22 namespace ui {
23 class NativeDisplayDelegate;
24 class DisplaySnapshot;
25 }
26
27 namespace mus {
28 namespace ws {
29
30 // PlatformScreenImplOzone provides the necessary functionality to configure all
31 // attached physical displays on the ozone platform.
32 class PlatformScreenImplOzone : public PlatformScreen,
33 public ui::NativeDisplayObserver {
34 public:
35 PlatformScreenImplOzone();
36 ~PlatformScreenImplOzone() override;
37
38 private:
39 // PlatformScreen
40 void Init() override; // Must not be called until after the ozone platform is
41 // initialized.
42 void ConfigurePhysicalDisplay(
43 const ConfiguredDisplayCallback& callback) override;
44
45 // TODO(rjkroege): NativeDisplayObserver is misnamed as it tracks changes in
46 // the physical "Screen". Consider renaming it to NativeScreenObserver.
47 // ui::NativeDisplayObserver:
48 void OnConfigurationChanged() override;
49
50 // Some ozone platforms do not configure physical displays and so do not
51 // callback into this class via the implementation of NativeDisplayObserver.
52 // FixedSizeScreenConfiguration() short-circuits the implementation of display
53 // configuration in this case by calling the |callback| provided to
54 // ConfigurePhysicalDisplay() with a hard-coded |id| and |bounds|.
55 void FixedSizeScreenConfiguration(ConfiguredDisplayCallback callback);
56
57 // Additional display management callbacks.
58 void OnDisplaysAquired(const ConfiguredDisplayCallback& callback,
59 const std::vector<ui::DisplaySnapshot*>& displays);
60 void OnDisplayConfigured(const ConfiguredDisplayCallback& callback,
61 int64_t id,
62 const gfx::Rect& bounds,
63 bool success);
64
65 // Flags used to keep track of the current state of display configuration.
66 // |is_configuring| is true if configuring the Screen and starts false.
67 bool is_configuring_;
68
69 // If |is_configuring_| is true and another display configuration event
70 // happens, the event is deferred. |should_configure_| is set to true and a
71 // display configuration will be scheduled after the current one finishes.
72 // NB: events are handled once per vblank.
73 bool should_configure_;
74
75 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate_;
76 ConfiguredDisplayCallback callback_;
77
78 base::WeakPtrFactory<PlatformScreenImplOzone> weak_ptr_factory_;
79
80 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone);
81 };
82
83 } // namespace ws
84 } // namespace mus
85
86 #endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698