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 // Flushes all pending requests and waits for replies.
42 virtual void SyncWithServer() = 0;
44 // Sets the window's background color to |color_argb|.
45 virtual void SetBackgroundColor(uint32_t color_argb) = 0;
47 // Enables DPMS and forces it to the "on" state.
48 virtual void ForceDPMSOn() = 0;
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
54 virtual std::vector<ui::DisplaySnapshot*> GetDisplays() = 0;
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;
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;
67 // Called to set the frame buffer (underlying XRR "screen") size.
68 virtual void CreateFrameBuffer(const gfx::Size& size) = 0;
70 // Gets HDCP state of output.
71 virtual bool GetHDCPState(const ui::DisplaySnapshot& output,
72 ui::HDCPState* state) = 0;
74 // Sets HDCP state of output.
75 virtual bool SetHDCPState(const ui::DisplaySnapshot& output,
76 ui::HDCPState state) = 0;
78 // Gets the available list of color calibrations.
79 virtual std::vector<ui::ColorCalibrationProfile>
80 GetAvailableColorCalibrationProfiles(
81 const ui::DisplaySnapshot& output) = 0;
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;
88 virtual void AddObserver(NativeDisplayObserver* observer) = 0;
90 virtual void RemoveObserver(NativeDisplayObserver* observer) = 0;
95 #endif // UI_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_