OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_DRI_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_PROXY_H_ |
6 #define UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_DRI_H_ | 6 #define UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_PROXY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "ui/display/types/chromeos/native_display_delegate.h" | 11 #include "ui/display/types/chromeos/native_display_delegate.h" |
12 #include "ui/events/ozone/device/device_event_observer.h" | 12 #include "ui/events/ozone/device/device_event_observer.h" |
| 13 #include "ui/ozone/public/gpu_platform_support_host.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 | 16 |
16 class DeviceManager; | 17 class DeviceManager; |
17 class DisplaySnapshotDri; | 18 class GpuPlatformSupportHostGbm; |
18 class DriConsoleBuffer; | |
19 class DriWrapper; | |
20 class ScreenManager; | |
21 | 19 |
22 class NativeDisplayDelegateDri | 20 struct DisplaySnapshot_Params; |
23 : public NativeDisplayDelegate, DeviceEventObserver { | 21 |
| 22 class NativeDisplayDelegateProxy : public NativeDisplayDelegate, |
| 23 public DeviceEventObserver, |
| 24 public GpuPlatformSupportHost { |
24 public: | 25 public: |
25 NativeDisplayDelegateDri(DriWrapper* dri, | 26 NativeDisplayDelegateProxy(GpuPlatformSupportHostGbm* proxy, |
26 ScreenManager* screen_manager, | 27 DeviceManager* device_manager); |
27 DeviceManager* device_manager); | 28 virtual ~NativeDisplayDelegateProxy(); |
28 virtual ~NativeDisplayDelegateDri(); | |
29 | 29 |
30 // NativeDisplayDelegate overrides: | 30 // NativeDisplayDelegate overrides: |
31 virtual void Initialize() OVERRIDE; | 31 virtual void Initialize() OVERRIDE; |
32 virtual void GrabServer() OVERRIDE; | 32 virtual void GrabServer() OVERRIDE; |
33 virtual void UngrabServer() OVERRIDE; | 33 virtual void UngrabServer() OVERRIDE; |
34 virtual void SyncWithServer() OVERRIDE; | 34 virtual void SyncWithServer() OVERRIDE; |
35 virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; | 35 virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; |
36 virtual void ForceDPMSOn() OVERRIDE; | 36 virtual void ForceDPMSOn() OVERRIDE; |
37 virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE; | 37 virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE; |
38 virtual void AddMode(const DisplaySnapshot& output, | 38 virtual void AddMode(const DisplaySnapshot& output, |
39 const DisplayMode* mode) OVERRIDE; | 39 const DisplayMode* mode) OVERRIDE; |
40 virtual bool Configure(const DisplaySnapshot& output, | 40 virtual bool Configure(const DisplaySnapshot& output, |
41 const DisplayMode* mode, | 41 const DisplayMode* mode, |
42 const gfx::Point& origin) OVERRIDE; | 42 const gfx::Point& origin) OVERRIDE; |
43 virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; | 43 virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; |
44 virtual bool GetHDCPState(const DisplaySnapshot& output, | 44 virtual bool GetHDCPState(const DisplaySnapshot& output, |
45 HDCPState* state) OVERRIDE; | 45 HDCPState* state) OVERRIDE; |
46 virtual bool SetHDCPState(const DisplaySnapshot& output, | 46 virtual bool SetHDCPState(const DisplaySnapshot& output, |
47 HDCPState state) OVERRIDE; | 47 HDCPState state) OVERRIDE; |
48 virtual std::vector<ui::ColorCalibrationProfile> | 48 virtual std::vector<ColorCalibrationProfile> |
49 GetAvailableColorCalibrationProfiles( | 49 GetAvailableColorCalibrationProfiles( |
50 const ui::DisplaySnapshot& output) OVERRIDE; | 50 const DisplaySnapshot& output) OVERRIDE; |
51 virtual bool SetColorCalibrationProfile( | 51 virtual bool SetColorCalibrationProfile( |
52 const ui::DisplaySnapshot& output, | 52 const DisplaySnapshot& output, |
53 ui::ColorCalibrationProfile new_profile) OVERRIDE; | 53 ColorCalibrationProfile new_profile) OVERRIDE; |
54 virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; | 54 virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; |
55 virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; | 55 virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; |
56 | 56 |
57 // DeviceEventObserver overrides: | 57 // DeviceEventObserver overrides: |
58 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; | 58 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; |
59 | 59 |
| 60 // GpuPlatformSupportHost: |
| 61 virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) OVERRIDE; |
| 62 virtual void OnChannelDestroyed(int host_id) OVERRIDE; |
| 63 |
| 64 // IPC::Listener overrides: |
| 65 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 66 |
60 private: | 67 private: |
61 // Notify ScreenManager of all the displays that were present before the | 68 void OnUpdateNativeDisplays( |
62 // update but are gone after the update. | 69 const std::vector<DisplaySnapshot_Params>& displays); |
63 void NotifyScreenManager( | |
64 const std::vector<DisplaySnapshotDri*>& new_displays, | |
65 const std::vector<DisplaySnapshotDri*>& old_displays) const; | |
66 | 70 |
67 DriWrapper* dri_; // Not owned. | 71 GpuPlatformSupportHostGbm* proxy_; // Not owned. |
68 ScreenManager* screen_manager_; // Not owned. | |
69 DeviceManager* device_manager_; // Not owned. | 72 DeviceManager* device_manager_; // Not owned. |
70 scoped_ptr<DriConsoleBuffer> console_buffer_; | 73 ScopedVector<DisplaySnapshot> displays_; |
71 ScopedVector<const DisplayMode> cached_modes_; | |
72 ScopedVector<DisplaySnapshotDri> cached_displays_; | |
73 ObserverList<NativeDisplayObserver> observers_; | 74 ObserverList<NativeDisplayObserver> observers_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateDri); | 76 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateProxy); |
76 }; | 77 }; |
77 | 78 |
78 } // namespace ui | 79 } // namespace ui |
79 | 80 |
80 #endif // UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_DRI_H_ | 81 #endif // UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_PROXY_H_ |
OLD | NEW |