| 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_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ | |
| 6 #define UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ | |
| 7 | |
| 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" | |
| 12 #include "ui/events/ozone/device/device_event_observer.h" | |
| 13 | |
| 14 namespace ui { | |
| 15 | |
| 16 class DeviceManager; | |
| 17 class DisplaySnapshotDri; | |
| 18 class DriConsoleBuffer; | |
| 19 class DriWrapper; | |
| 20 class ScreenManager; | |
| 21 | |
| 22 class NativeDisplayDelegateDri : public NativeDisplayDelegate, | |
| 23 DeviceEventObserver { | |
| 24 public: | |
| 25 NativeDisplayDelegateDri(DriWrapper* dri, | |
| 26 ScreenManager* screen_manager, | |
| 27 DeviceManager* device_manager); | |
| 28 virtual ~NativeDisplayDelegateDri(); | |
| 29 | |
| 30 DisplaySnapshot* FindDisplaySnapshot(int64_t id); | |
| 31 const DisplayMode* FindDisplayMode(const gfx::Size& size, | |
| 32 bool is_interlaced, | |
| 33 float refresh_rate); | |
| 34 | |
| 35 // NativeDisplayDelegate overrides: | |
| 36 virtual void Initialize() override; | |
| 37 virtual void GrabServer() override; | |
| 38 virtual void UngrabServer() override; | |
| 39 virtual void SyncWithServer() override; | |
| 40 virtual void SetBackgroundColor(uint32_t color_argb) override; | |
| 41 virtual void ForceDPMSOn() override; | |
| 42 virtual std::vector<DisplaySnapshot*> GetDisplays() override; | |
| 43 virtual void AddMode(const DisplaySnapshot& output, | |
| 44 const DisplayMode* mode) override; | |
| 45 virtual bool Configure(const DisplaySnapshot& output, | |
| 46 const DisplayMode* mode, | |
| 47 const gfx::Point& origin) override; | |
| 48 virtual void CreateFrameBuffer(const gfx::Size& size) override; | |
| 49 virtual bool GetHDCPState(const DisplaySnapshot& output, | |
| 50 HDCPState* state) override; | |
| 51 virtual bool SetHDCPState(const DisplaySnapshot& output, | |
| 52 HDCPState state) override; | |
| 53 virtual std::vector<ui::ColorCalibrationProfile> | |
| 54 GetAvailableColorCalibrationProfiles( | |
| 55 const ui::DisplaySnapshot& output) override; | |
| 56 virtual bool SetColorCalibrationProfile( | |
| 57 const ui::DisplaySnapshot& output, | |
| 58 ui::ColorCalibrationProfile new_profile) override; | |
| 59 virtual void AddObserver(NativeDisplayObserver* observer) override; | |
| 60 virtual void RemoveObserver(NativeDisplayObserver* observer) override; | |
| 61 | |
| 62 // DeviceEventObserver overrides: | |
| 63 virtual void OnDeviceEvent(const DeviceEvent& event) override; | |
| 64 | |
| 65 private: | |
| 66 // Notify ScreenManager of all the displays that were present before the | |
| 67 // update but are gone after the update. | |
| 68 void NotifyScreenManager( | |
| 69 const std::vector<DisplaySnapshotDri*>& new_displays, | |
| 70 const std::vector<DisplaySnapshotDri*>& old_displays) const; | |
| 71 | |
| 72 DriWrapper* dri_; // Not owned. | |
| 73 ScreenManager* screen_manager_; // Not owned. | |
| 74 DeviceManager* device_manager_; // Not owned. | |
| 75 scoped_ptr<DriConsoleBuffer> console_buffer_; | |
| 76 // Modes can be shared between different displays, so we need to keep track | |
| 77 // of them independently for cleanup. | |
| 78 ScopedVector<const DisplayMode> cached_modes_; | |
| 79 ScopedVector<DisplaySnapshotDri> cached_displays_; | |
| 80 ObserverList<NativeDisplayObserver> observers_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateDri); | |
| 83 }; | |
| 84 | |
| 85 } // namespace ui | |
| 86 | |
| 87 #endif // UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ | |
| OLD | NEW |