OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_DRM_HOST_DRM_WINDOW_HOST_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/display/types/display_snapshot.h" |
| 10 #include "ui/events/platform/platform_event_dispatcher.h" |
| 11 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/ozone/platform/drm/host/channel_observer.h" |
| 14 #include "ui/platform_window/platform_window.h" |
| 15 |
| 16 namespace ui { |
| 17 |
| 18 class DrmDisplayHostManager; |
| 19 class DrmCursor; |
| 20 class DrmGpuPlatformSupportHost; |
| 21 class DrmGpuWindow; |
| 22 class DrmWindowHostManager; |
| 23 class EventFactoryEvdev; |
| 24 |
| 25 // Implementation of the platform window. This object and its handle |widget_| |
| 26 // uniquely identify a window. Since the DRI/GBM platform is split into 2 |
| 27 // pieces (Browser process and GPU process), internally we need to make sure the |
| 28 // state is synchronized between the 2 processes. |
| 29 // |
| 30 // |widget_| is used in both processes to uniquely identify the window. This |
| 31 // means that any state on the browser side needs to be propagated to the GPU. |
| 32 // State propagation needs to happen before the state change is acknowledged to |
| 33 // |delegate_| as |delegate_| is responsible for initializing the surface |
| 34 // associated with the window (the surface is created on the GPU process). |
| 35 class DrmWindowHost : public PlatformWindow, |
| 36 public PlatformEventDispatcher, |
| 37 public ChannelObserver { |
| 38 public: |
| 39 DrmWindowHost(PlatformWindowDelegate* delegate, |
| 40 const gfx::Rect& bounds, |
| 41 DrmGpuPlatformSupportHost* sender, |
| 42 EventFactoryEvdev* event_factory, |
| 43 DrmCursor* cursor, |
| 44 DrmWindowHostManager* window_manager, |
| 45 DrmDisplayHostManager* display_manager); |
| 46 ~DrmWindowHost() override; |
| 47 |
| 48 void Initialize(); |
| 49 |
| 50 gfx::AcceleratedWidget GetAcceleratedWidget(); |
| 51 |
| 52 gfx::Rect GetCursorConfinedBounds() const; |
| 53 |
| 54 // PlatformWindow: |
| 55 void Show() override; |
| 56 void Hide() override; |
| 57 void Close() override; |
| 58 void SetBounds(const gfx::Rect& bounds) override; |
| 59 gfx::Rect GetBounds() override; |
| 60 void SetCapture() override; |
| 61 void ReleaseCapture() override; |
| 62 void ToggleFullscreen() override; |
| 63 void Maximize() override; |
| 64 void Minimize() override; |
| 65 void Restore() override; |
| 66 void SetCursor(PlatformCursor cursor) override; |
| 67 void MoveCursorTo(const gfx::Point& location) override; |
| 68 void ConfineCursorToBounds(const gfx::Rect& bounds) override; |
| 69 |
| 70 // PlatformEventDispatcher: |
| 71 bool CanDispatchEvent(const PlatformEvent& event) override; |
| 72 uint32_t DispatchEvent(const PlatformEvent& event) override; |
| 73 |
| 74 // ChannelObserver: |
| 75 void OnChannelEstablished() override; |
| 76 void OnChannelDestroyed() override; |
| 77 |
| 78 private: |
| 79 void SendBoundsChange(); |
| 80 |
| 81 PlatformWindowDelegate* delegate_; // Not owned. |
| 82 DrmGpuPlatformSupportHost* sender_; // Not owned. |
| 83 EventFactoryEvdev* event_factory_; // Not owned. |
| 84 DrmCursor* cursor_; // Not owned. |
| 85 DrmWindowHostManager* window_manager_; // Not owned. |
| 86 DrmDisplayHostManager* display_manager_; // Not owned. |
| 87 |
| 88 gfx::Rect bounds_; |
| 89 gfx::AcceleratedWidget widget_; |
| 90 |
| 91 gfx::Rect cursor_confined_bounds_; |
| 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(DrmWindowHost); |
| 94 }; |
| 95 |
| 96 } // namespace ui |
| 97 |
| 98 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ |
OLD | NEW |