Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / ozone / platform / drm / host / drm_native_display_delegate.h
blob42802a81e6e19c71460bf2b94ff2f992a715b590
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_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_
6 #define UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_
8 #include <map>
10 #include "base/files/file.h"
11 #include "base/files/file_path.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_vector.h"
14 #include "base/observer_list.h"
15 #include "ui/display/types/native_display_delegate.h"
16 #include "ui/events/ozone/device/device_event_observer.h"
17 #include "ui/ozone/public/gpu_platform_support_host.h"
19 namespace ui {
21 class DeviceManager;
22 class DisplayManager;
23 class DrmGpuPlatformSupportHost;
25 struct DisplaySnapshot_Params;
27 class DrmNativeDisplayDelegate : public NativeDisplayDelegate,
28 public DeviceEventObserver,
29 public GpuPlatformSupportHost {
30 public:
31 DrmNativeDisplayDelegate(DrmGpuPlatformSupportHost* proxy,
32 DeviceManager* device_manager,
33 DisplayManager* display_manager,
34 const base::FilePath& primary_graphics_card_path);
35 ~DrmNativeDisplayDelegate() override;
37 // NativeDisplayDelegate overrides:
38 void Initialize() override;
39 void GrabServer() override;
40 void UngrabServer() override;
41 bool TakeDisplayControl() override;
42 bool RelinquishDisplayControl() override;
43 void SyncWithServer() override;
44 void SetBackgroundColor(uint32_t color_argb) override;
45 void ForceDPMSOn() override;
46 void GetDisplays(const GetDisplaysCallback& callback) override;
47 void AddMode(const DisplaySnapshot& output, const DisplayMode* mode) override;
48 void Configure(const DisplaySnapshot& output,
49 const DisplayMode* mode,
50 const gfx::Point& origin,
51 const ConfigureCallback& callback) override;
52 void CreateFrameBuffer(const gfx::Size& size) override;
53 bool GetHDCPState(const DisplaySnapshot& output, HDCPState* state) override;
54 bool SetHDCPState(const DisplaySnapshot& output, HDCPState state) override;
55 std::vector<ColorCalibrationProfile> GetAvailableColorCalibrationProfiles(
56 const DisplaySnapshot& output) override;
57 bool SetColorCalibrationProfile(const DisplaySnapshot& output,
58 ColorCalibrationProfile new_profile) override;
59 void AddObserver(NativeDisplayObserver* observer) override;
60 void RemoveObserver(NativeDisplayObserver* observer) override;
62 // DeviceEventObserver overrides:
63 void OnDeviceEvent(const DeviceEvent& event) override;
65 // GpuPlatformSupportHost:
66 void OnChannelEstablished(
67 int host_id,
68 scoped_refptr<base::SingleThreadTaskRunner> send_runner,
69 const base::Callback<void(IPC::Message*)>& send_callback) override;
70 void OnChannelDestroyed(int host_id) override;
72 // IPC::Listener overrides:
73 bool OnMessageReceived(const IPC::Message& message) override;
75 private:
76 void OnUpdateNativeDisplays(
77 const std::vector<DisplaySnapshot_Params>& displays);
78 void OnDisplayConfigured(int64_t display_id, bool status);
80 void OnNewGraphicsDevice(const base::FilePath& path, base::File file);
82 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const;
84 DrmGpuPlatformSupportHost* proxy_; // Not owned.
85 DeviceManager* device_manager_; // Not owned.
86 DisplayManager* display_manager_; // Not owned.
88 // File path for the primary graphics card which is opened by default in the
89 // GPU process. We'll avoid opening this in hotplug events since it will race
90 // with the GPU process trying to open it and aquire DRM master.
91 const base::FilePath primary_graphics_card_path_;
93 // Keeps track if there is a dummy display. This happens on initialization
94 // when there is no connection to the GPU to update the displays.
95 bool has_dummy_display_;
97 ScopedVector<DisplaySnapshot> displays_;
98 ObserverList<NativeDisplayObserver> observers_;
100 GetDisplaysCallback get_displays_callback_;
102 // Map between display_id and the configuration callback.
103 std::map<int64_t, ConfigureCallback> configure_callback_map_;
105 base::WeakPtrFactory<DrmNativeDisplayDelegate> weak_ptr_factory_;
107 DISALLOW_COPY_AND_ASSIGN(DrmNativeDisplayDelegate);
110 } // namespace ui
112 #endif // UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_