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

Side by Side 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: 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_H_
6 #define COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
7
8 #include <stdint.h>
9
10 #include <set>
11 #include <vector>
12
13 #include "base/callback.h"
14 #include "base/memory/weak_ptr.h"
15 #include "ui/display/types/native_display_observer.h"
16 #include "ui/gfx/geometry/rect.h"
17
18 namespace ui {
19 class NativeDisplayDelegate;
20 class DisplaySnapshot;
21 }
22
23 namespace mus {
24 namespace ws {
25
26 // In Chrome, a "Screen" is the aggregate of all attached physical displays.
sky 2016/05/03 02:39:51 nit: remove this first sentence as it's confusing
rjkroege 2016/05/03 21:03:03 Done.
27 // A |PlatformScreen| provides the necessary functionality to configure all
28 // attached physical displays.
29 class PlatformScreen : public ui::NativeDisplayObserver {
30 public:
31 PlatformScreen();
32 ~PlatformScreen() override;
33
34 // When using Ozone, PlatformScreen must be initialized after the Ozone
sky 2016/05/03 02:39:51 This is confusing. I think you want something like
rjkroege 2016/05/03 21:03:04 Re-worded to try to make the point that I was tryi
35 // platform is initialized.
36 void Init();
37
38 // The PhysicalScreen will invoke this callback when a previously requested
39 // display configuration has been confirmed.
40 typedef base::Callback<void(int64_t, gfx::Rect)> ConfiguredDisplayCallback;
sky 2016/05/03 02:39:51 Use 'using' instead. It is way easier to read.
rjkroege 2016/05/03 21:03:03 Done.
41
42 // |ConfigurePhysicalDisplay| configures a single physical display and returns
sky 2016/05/03 02:39:51 nit: generally |s are for references to parameters
rjkroege 2016/05/03 21:03:04 Done.
43 // pending bounds for it via callback.
44 void ConfigurePhysicalDisplay(ConfiguredDisplayCallback callback);
sky 2016/05/03 02:39:51 const&
rjkroege 2016/05/03 21:03:03 Done.
45
46 private:
47 void FixedSizeScreenConfiguration(ConfiguredDisplayCallback callback);
sky 2016/05/03 02:39:51 Add a description as this isn't obvious.
rjkroege 2016/05/03 21:03:03 Done.
48
49 // TODO(rjkroege): NativeDisplayObserver is misnamed as it tracks changes in
50 // the physical "Screen". Consider renaming it to NativeScreenObserver.
51 // ui::NativeDisplayObserver:
52 void OnConfigurationChanged() override;
53
54 // Additional display management callbacks.
55 void OnDisplaysAquired(ConfiguredDisplayCallback callback,
sky 2016/05/03 02:39:51 const&
rjkroege 2016/05/03 21:03:03 Done.
56 const std::vector<ui::DisplaySnapshot*>& displays);
57 void OnDisplayConfigured(ConfiguredDisplayCallback callback,
sky 2016/05/03 02:39:51 const&
rjkroege 2016/05/03 21:03:04 Done.
58 int64_t id,
59 const gfx::Rect& bounds,
60 bool success);
61
62 // Flags used to keep track of the current state of display configuration.
63 // |is_configuring| is true if configuring the Screen and starts false.
64 bool is_configuring_;
sky 2016/05/03 02:39:51 Initialize here (or update platform_screen.cc to i
rjkroege 2016/05/03 21:03:03 Done.
65
66 // If |is_configuring_| is true and another display configuration event
67 // happens, the event is deferred. |should_configure_| is set to true and a
68 // display configuration will be scheduled after the current one finishes.
69 // NB: events are handled once per vblank.
70 bool should_configure_;
71
72 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate_;
73 ConfiguredDisplayCallback callback_;
74
75 base::WeakPtrFactory<PlatformScreen> weak_ptr_factory_;
76 DISALLOW_COPY_AND_ASSIGN(PlatformScreen);
sky 2016/05/03 02:39:51 nit: newline between 75/76.
rjkroege 2016/05/03 21:03:03 Done.
77 };
78
79 } // namespace ws
80 } // namespace mus
81
82 #endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698