native_display_delegate_proxy.h revision 116680a4aac90f2aa7413d9095a592090648e557
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_CHROMEOS_NATIVE_DISPLAY_DELEGATE_PROXY_H_ 6#define UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_PROXY_H_ 7 8#include "base/macros.h" 9#include "base/memory/scoped_vector.h" 10#include "base/observer_list.h" 11#include "ui/display/types/chromeos/native_display_delegate.h" 12#include "ui/events/ozone/device/device_event_observer.h" 13#include "ui/ozone/public/gpu_platform_support_host.h" 14 15namespace ui { 16 17class DeviceManager; 18class GpuPlatformSupportHostGbm; 19 20struct DisplaySnapshot_Params; 21 22class NativeDisplayDelegateProxy : public NativeDisplayDelegate, 23 public DeviceEventObserver, 24 public GpuPlatformSupportHost { 25 public: 26 NativeDisplayDelegateProxy(GpuPlatformSupportHostGbm* proxy, 27 DeviceManager* device_manager); 28 virtual ~NativeDisplayDelegateProxy(); 29 30 // NativeDisplayDelegate overrides: 31 virtual void Initialize() OVERRIDE; 32 virtual void GrabServer() OVERRIDE; 33 virtual void UngrabServer() OVERRIDE; 34 virtual void SyncWithServer() OVERRIDE; 35 virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; 36 virtual void ForceDPMSOn() OVERRIDE; 37 virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE; 38 virtual void AddMode(const DisplaySnapshot& output, 39 const DisplayMode* mode) OVERRIDE; 40 virtual bool Configure(const DisplaySnapshot& output, 41 const DisplayMode* mode, 42 const gfx::Point& origin) OVERRIDE; 43 virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; 44 virtual bool GetHDCPState(const DisplaySnapshot& output, 45 HDCPState* state) OVERRIDE; 46 virtual bool SetHDCPState(const DisplaySnapshot& output, 47 HDCPState state) OVERRIDE; 48 virtual std::vector<ColorCalibrationProfile> 49 GetAvailableColorCalibrationProfiles( 50 const DisplaySnapshot& output) OVERRIDE; 51 virtual bool SetColorCalibrationProfile( 52 const DisplaySnapshot& output, 53 ColorCalibrationProfile new_profile) OVERRIDE; 54 virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; 55 virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; 56 57 // DeviceEventObserver overrides: 58 virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; 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 67 private: 68 void OnUpdateNativeDisplays( 69 const std::vector<DisplaySnapshot_Params>& displays); 70 71 GpuPlatformSupportHostGbm* proxy_; // Not owned. 72 DeviceManager* device_manager_; // Not owned. 73 ScopedVector<DisplaySnapshot> displays_; 74 ObserverList<NativeDisplayObserver> observers_; 75 76 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateProxy); 77}; 78 79} // namespace ui 80 81#endif // UI_OZONE_PLATFORM_DRI_CHROMEOS_NATIVE_DISPLAY_DELEGATE_PROXY_H_ 82