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_NATIVE_DISPLAY_DELEGATE_DRI_H_
6 #define UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/observer_list.h"
11 #include "ui/display/types/native_display_delegate.h"
16 class DisplaySnapshotDri
;
20 class NativeDisplayDelegateDri
: public NativeDisplayDelegate
{
22 NativeDisplayDelegateDri(DriWrapper
* dri
, ScreenManager
* screen_manager
);
23 ~NativeDisplayDelegateDri() override
;
25 DisplaySnapshot
* FindDisplaySnapshot(int64_t id
);
26 const DisplayMode
* FindDisplayMode(const gfx::Size
& size
,
30 std::vector
<DisplaySnapshot
*> GetDisplays();
31 bool Configure(const DisplaySnapshot
& output
,
32 const DisplayMode
* mode
,
33 const gfx::Point
& origin
);
35 // NativeDisplayDelegate overrides:
36 void Initialize() override
;
37 void GrabServer() override
;
38 void UngrabServer() override
;
39 bool TakeDisplayControl() override
;
40 bool RelinquishDisplayControl() override
;
41 void SyncWithServer() override
;
42 void SetBackgroundColor(uint32_t color_argb
) override
;
43 void ForceDPMSOn() override
;
44 void GetDisplays(const GetDisplaysCallback
& callback
) override
;
45 void AddMode(const DisplaySnapshot
& output
, const DisplayMode
* mode
) override
;
46 void Configure(const DisplaySnapshot
& output
,
47 const DisplayMode
* mode
,
48 const gfx::Point
& origin
,
49 const ConfigureCallback
& callback
) override
;
50 void CreateFrameBuffer(const gfx::Size
& size
) override
;
51 bool GetHDCPState(const DisplaySnapshot
& output
, HDCPState
* state
) override
;
52 bool SetHDCPState(const DisplaySnapshot
& output
, HDCPState state
) override
;
53 std::vector
<ui::ColorCalibrationProfile
> GetAvailableColorCalibrationProfiles(
54 const ui::DisplaySnapshot
& output
) override
;
55 bool SetColorCalibrationProfile(
56 const ui::DisplaySnapshot
& output
,
57 ui::ColorCalibrationProfile new_profile
) override
;
58 void AddObserver(NativeDisplayObserver
* observer
) override
;
59 void RemoveObserver(NativeDisplayObserver
* observer
) override
;
62 // Notify ScreenManager of all the displays that were present before the
63 // update but are gone after the update.
64 void NotifyScreenManager(
65 const std::vector
<DisplaySnapshotDri
*>& new_displays
,
66 const std::vector
<DisplaySnapshotDri
*>& old_displays
) const;
68 DriWrapper
* dri_
; // Not owned.
69 ScreenManager
* screen_manager_
; // Not owned.
70 // Modes can be shared between different displays, so we need to keep track
71 // of them independently for cleanup.
72 ScopedVector
<const DisplayMode
> cached_modes_
;
73 ScopedVector
<DisplaySnapshotDri
> cached_displays_
;
74 ObserverList
<NativeDisplayObserver
> observers_
;
76 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateDri
);
81 #endif // UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_