| OLD | NEW |
| (Empty) |
| 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 CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_H_ | |
| 6 #define CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_H_ | |
| 7 | |
| 8 #include "chromeos/display/output_configurator.h" | |
| 9 #include "ui/display/display_constants.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 | |
| 13 class NativeDisplayObserver; | |
| 14 | |
| 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 { | |
| 20 public: | |
| 21 virtual ~NativeDisplayDelegate() {} | |
| 22 | |
| 23 // Initializes the XRandR extension, saving the base event ID to |event_base|. | |
| 24 virtual void Initialize() = 0; | |
| 25 | |
| 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; | |
| 30 | |
| 31 // Ungrabs the server and frees XRandR-related resources. | |
| 32 virtual void UngrabServer() = 0; | |
| 33 | |
| 34 // Flushes all pending requests and waits for replies. | |
| 35 virtual void SyncWithServer() = 0; | |
| 36 | |
| 37 // Sets the window's background color to |color_argb|. | |
| 38 virtual void SetBackgroundColor(uint32 color_argb) = 0; | |
| 39 | |
| 40 // Enables DPMS and forces it to the "on" state. | |
| 41 virtual void ForceDPMSOn() = 0; | |
| 42 | |
| 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; | |
| 48 | |
| 49 // Adds |mode| to |output|. | |
| 50 virtual void AddMode(const OutputConfigurator::OutputSnapshot& output, | |
| 51 RRMode mode) = 0; | |
| 52 | |
| 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, | |
| 56 RRMode mode, | |
| 57 int x, | |
| 58 int y) = 0; | |
| 59 | |
| 60 // Called to set the frame buffer (underlying XRR "screen") size. Has | |
| 61 // a side-effect of disabling all CRTCs. | |
| 62 virtual void CreateFrameBuffer( | |
| 63 int width, | |
| 64 int height, | |
| 65 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) = 0; | |
| 66 | |
| 67 // Gets HDCP state of output. | |
| 68 virtual bool GetHDCPState(const OutputConfigurator::OutputSnapshot& output, | |
| 69 ui::HDCPState* state) = 0; | |
| 70 | |
| 71 // Sets HDCP state of output. | |
| 72 virtual bool SetHDCPState(const OutputConfigurator::OutputSnapshot& output, | |
| 73 ui::HDCPState state) = 0; | |
| 74 | |
| 75 virtual void AddObserver(NativeDisplayObserver* observer) = 0; | |
| 76 | |
| 77 virtual void RemoveObserver(NativeDisplayObserver* observer) = 0; | |
| 78 }; | |
| 79 | |
| 80 } // namespace chromeos | |
| 81 | |
| 82 #endif // CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_H_ | |
| OLD | NEW |