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