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 CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_H_
6 #define CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_H_
8 #include "chromeos/display/output_configurator.h"
9 #include "ui/display/display_constants.h"
13 class NativeDisplayObserver
;
15 // Interface for classes that perform display configuration actions on behalf
16 // of OutputConfigurator.
17 // TODO(dnicoara) This interface will eventually be platform independent,
18 // however it first requires refactoring the datatypes: crbug.com/333413
19 class NativeDisplayDelegate
{
21 virtual ~NativeDisplayDelegate() {}
23 // Initializes the XRandR extension, saving the base event ID to |event_base|.
24 virtual void Initialize() = 0;
26 // Grabs the X server and refreshes XRandR-related resources. While
27 // the server is grabbed, other clients are blocked. Must be balanced
28 // by a call to UngrabServer().
29 virtual void GrabServer() = 0;
31 // Ungrabs the server and frees XRandR-related resources.
32 virtual void UngrabServer() = 0;
34 // Flushes all pending requests and waits for replies.
35 virtual void SyncWithServer() = 0;
37 // Sets the window's background color to |color_argb|.
38 virtual void SetBackgroundColor(uint32 color_argb
) = 0;
40 // Enables DPMS and forces it to the "on" state.
41 virtual void ForceDPMSOn() = 0;
43 // Returns information about the current outputs. This method may block for
44 // 60 milliseconds or more. The returned outputs are not fully initialized;
45 // the rest of the work happens in
46 // OutputConfigurator::UpdateCachedOutputs().
47 virtual std::vector
<OutputConfigurator::OutputSnapshot
> GetOutputs() = 0;
49 // Adds |mode| to |output|.
50 virtual void AddMode(const OutputConfigurator::OutputSnapshot
& output
,
53 // Calls XRRSetCrtcConfig() with the given options but some of our default
54 // output count and rotation arguments. Returns true on success.
55 virtual bool Configure(const OutputConfigurator::OutputSnapshot
& output
,
60 // Called to set the frame buffer (underlying XRR "screen") size. Has
61 // a side-effect of disabling all CRTCs.
62 virtual void CreateFrameBuffer(
65 const std::vector
<OutputConfigurator::OutputSnapshot
>& outputs
) = 0;
67 // Gets HDCP state of output.
68 virtual bool GetHDCPState(const OutputConfigurator::OutputSnapshot
& output
,
69 ui::HDCPState
* state
) = 0;
71 // Sets HDCP state of output.
72 virtual bool SetHDCPState(const OutputConfigurator::OutputSnapshot
& output
,
73 ui::HDCPState state
) = 0;
75 virtual void AddObserver(NativeDisplayObserver
* observer
) = 0;
77 virtual void RemoveObserver(NativeDisplayObserver
* observer
) = 0;
80 } // namespace chromeos
82 #endif // CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_H_