ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / ui / ozone / platform / dri / dri_window.h
blob3c6131829dd0de732d5ee5d74a6d1aaa9dc60a2c
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.
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_H_
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/dri/channel_observer.h"
14 #include "ui/platform_window/platform_window.h"
16 namespace ui {
18 class DisplayManager;
19 class DriCursor;
20 class DriWindowDelegate;
21 class DriWindowManager;
22 class EventFactoryEvdev;
23 class DriGpuPlatformSupportHost;
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.
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 DriWindow : public PlatformWindow,
36 public PlatformEventDispatcher,
37 public ChannelObserver {
38 public:
39 DriWindow(PlatformWindowDelegate* delegate,
40 const gfx::Rect& bounds,
41 DriGpuPlatformSupportHost* sender,
42 EventFactoryEvdev* event_factory,
43 DriCursor* cursor,
44 DriWindowManager* window_manager,
45 DisplayManager* display_manager);
46 ~DriWindow() override;
48 void Initialize();
50 gfx::AcceleratedWidget GetAcceleratedWidget();
52 gfx::Rect GetCursorConfinedBounds() const;
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;
70 // PlatformEventDispatcher:
71 bool CanDispatchEvent(const PlatformEvent& event) override;
72 uint32_t DispatchEvent(const PlatformEvent& event) override;
74 // ChannelObserver:
75 void OnChannelEstablished() override;
76 void OnChannelDestroyed() override;
78 private:
79 void SendBoundsChange();
81 PlatformWindowDelegate* delegate_; // Not owned.
82 DriGpuPlatformSupportHost* sender_; // Not owned.
83 EventFactoryEvdev* event_factory_; // Not owned.
84 DriCursor* cursor_; // Not owned.
85 DriWindowManager* window_manager_; // Not owned.
86 DisplayManager* display_manager_; // Not owned.
88 gfx::Rect bounds_;
89 gfx::AcceleratedWidget widget_;
91 gfx::Rect cursor_confined_bounds_;
93 DISALLOW_COPY_AND_ASSIGN(DriWindow);
96 } // namespace ui
98 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_H_