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_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_ 6 #define UI_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_ 7 8 #include <stdint.h> 9 10 #include <vector> 11 12 #include "ui/display/types/display_constants.h" 13 #include "ui/display/types/display_types_export.h" 14 15 namespace gfx { 16 class Point; 17 class Size; 18 } 19 20 namespace ui { 21 class DisplayMode; 22 class DisplaySnapshot; 23 24 class NativeDisplayObserver; 25 26 // Interface for classes that perform display configuration actions on behalf 27 // of DisplayConfigurator. 28 class DISPLAY_TYPES_EXPORT NativeDisplayDelegate { 29 public: 30 virtual ~NativeDisplayDelegate() {} 31 32 virtual void Initialize() = 0; 33 34 // Grabs and refreshes any display server related resources. Must be balanced 35 // by a call to UngrabServer(). 36 virtual void GrabServer() = 0; 37 38 // Released the display server and any resources allocated by GrabServer(). 39 virtual void UngrabServer() = 0; 40 41 // Flushes all pending requests and waits for replies. 42 virtual void SyncWithServer() = 0; 43 44 // Sets the window's background color to |color_argb|. 45 virtual void SetBackgroundColor(uint32_t color_argb) = 0; 46 47 // Enables DPMS and forces it to the "on" state. 48 virtual void ForceDPMSOn() = 0; 49 50 // Returns information about the current outputs. This method may block for 51 // 60 milliseconds or more. 52 // NativeDisplayDelegate maintains ownership of the ui::DisplaySnapshot 53 // pointers. 54 virtual std::vector<ui::DisplaySnapshot*> GetDisplays() = 0; 55 56 // Adds |mode| to |output|. |mode| must be a valid display mode pointer. 57 virtual void AddMode(const ui::DisplaySnapshot& output, 58 const ui::DisplayMode* mode) = 0; 59 60 // Configures the display represented by |output| to use |mode| and positions 61 // the display to |origin| in the framebuffer. |mode| can be NULL, which 62 // represents disabling the display. Returns true on success. 63 virtual bool Configure(const ui::DisplaySnapshot& output, 64 const ui::DisplayMode* mode, 65 const gfx::Point& origin) = 0; 66 67 // Called to set the frame buffer (underlying XRR "screen") size. 68 virtual void CreateFrameBuffer(const gfx::Size& size) = 0; 69 70 // Gets HDCP state of output. 71 virtual bool GetHDCPState(const ui::DisplaySnapshot& output, 72 ui::HDCPState* state) = 0; 73 74 // Sets HDCP state of output. 75 virtual bool SetHDCPState(const ui::DisplaySnapshot& output, 76 ui::HDCPState state) = 0; 77 78 // Gets the available list of color calibrations. 79 virtual std::vector<ui::ColorCalibrationProfile> 80 GetAvailableColorCalibrationProfiles( 81 const ui::DisplaySnapshot& output) = 0; 82 83 // Sets the color calibration of |output| to |new_profile|. 84 virtual bool SetColorCalibrationProfile( 85 const ui::DisplaySnapshot& output, 86 ui::ColorCalibrationProfile new_profile) = 0; 87 88 virtual void AddObserver(NativeDisplayObserver* observer) = 0; 89 90 virtual void RemoveObserver(NativeDisplayObserver* observer) = 0; 91 }; 92 93 } // namespace ui 94 95 #endif // UI_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_ 96