Chromium Code Reviews| 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 UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ | |
| 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OUTPUT_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "ui/gfx/geometry/rect.h" | |
| 13 #include "ui/ozone/platform/wayland/wayland_object.h" | |
| 14 | |
| 15 namespace ui { | |
| 16 | |
| 17 // WaylandOutput objects keep track of the current output of display | |
| 18 // that are available to the application. | |
| 19 class WaylandOutput { | |
| 20 public: | |
| 21 // Runs a callback when wl_output is available. | |
| 22 class Observer { | |
| 23 public: | |
| 24 explicit Observer(const base::Closure&, WaylandOutput*); | |
| 25 ~Observer(); | |
| 26 // Will be called when wl_output is available. | |
| 27 void OnOutputReadyForUse(); | |
| 28 | |
| 29 private: | |
| 30 const base::Closure closure_; | |
|
Michael Forney
2016/07/20 21:49:00
Why the closure? Why not just make OnOutputReadyFo
joone
2016/07/20 23:23:59
Observer is used in the test case in order to wait
| |
| 31 }; | |
| 32 | |
| 33 WaylandOutput(wl_output*); | |
| 34 ~WaylandOutput(); | |
| 35 | |
| 36 // Returns the resolution of the screen. | |
| 37 gfx::Rect Geometry() const { return rect_; } | |
| 38 void SetObserver(Observer* observer) { observer_ = observer; } | |
| 39 Observer* observer() { return observer_; } | |
| 40 | |
| 41 private: | |
| 42 // Callback functions that allows the display to initialize the screen's | |
| 43 // position and available modes. | |
| 44 static void OutputHandleGeometry(void* data, | |
| 45 wl_output* output, | |
| 46 int32_t x, | |
| 47 int32_t y, | |
| 48 int32_t physical_width, | |
| 49 int32_t physical_height, | |
| 50 int32_t subpixel, | |
| 51 const char* make, | |
| 52 const char* model, | |
| 53 int32_t output_transform); | |
| 54 | |
| 55 static void OutputHandleMode(void* data, | |
| 56 wl_output* wl_output, | |
| 57 uint32_t flags, | |
| 58 int32_t width, | |
| 59 int32_t height, | |
| 60 int32_t refresh); | |
| 61 | |
| 62 wl::Object<wl_output> output_; | |
| 63 gfx::Rect rect_; | |
| 64 | |
| 65 Observer* observer_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(WaylandOutput); | |
| 68 }; | |
| 69 | |
| 70 } // namespace ui | |
| 71 | |
| 72 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_SCREEN_H_ | |
| OLD | NEW |