OLD | NEW |
| (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 // Display management callback. | |
51 void OnDisplaysAquired(const ConfiguredDisplayCallback& callback, | |
52 const std::vector<ui::DisplaySnapshot*>& displays); | |
53 | |
54 // The display subsystem calls |OnDisplayConfigured| for each display that has | |
55 // been successfully configured. This in turn calls |callback_| with the | |
56 // identity and bounds of each physical display. | |
57 void OnDisplayConfigured(const ConfiguredDisplayCallback& callback, | |
58 int64_t id, | |
59 const gfx::Rect& bounds, | |
60 bool success); | |
61 | |
62 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate_; | |
63 | |
64 base::WeakPtrFactory<PlatformScreenImplOzone> weak_ptr_factory_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone); | |
67 }; | |
68 | |
69 } // namespace ws | |
70 } // namespace mus | |
71 | |
72 #endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ | |
OLD | NEW |