| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ |
| 6 #define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ | 6 #define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "ui/display/chromeos/output_configurator.h" | |
| 9 #include "ui/display/display_constants.h" | 8 #include "ui/display/display_constants.h" |
| 9 #include "ui/display/display_export.h" |
| 10 |
| 11 namespace gfx { |
| 12 class Point; |
| 13 class Size; |
| 14 } |
| 10 | 15 |
| 11 namespace ui { | 16 namespace ui { |
| 17 class DisplayMode; |
| 18 class DisplaySnapshot; |
| 12 | 19 |
| 13 class NativeDisplayObserver; | 20 class NativeDisplayObserver; |
| 14 | 21 |
| 15 // Interface for classes that perform display configuration actions on behalf | 22 // Interface for classes that perform display configuration actions on behalf |
| 16 // of OutputConfigurator. | 23 // of OutputConfigurator. |
| 17 // TODO(dnicoara) This interface will eventually be platform independent, | 24 class DISPLAY_EXPORT NativeDisplayDelegate { |
| 18 // however it first requires refactoring the datatypes: crbug.com/333413 | |
| 19 class NativeDisplayDelegate { | |
| 20 public: | 25 public: |
| 21 virtual ~NativeDisplayDelegate() {} | 26 virtual ~NativeDisplayDelegate() {} |
| 22 | 27 |
| 23 // Initializes the XRandR extension, saving the base event ID to |event_base|. | |
| 24 virtual void Initialize() = 0; | 28 virtual void Initialize() = 0; |
| 25 | 29 |
| 26 // Grabs the X server and refreshes XRandR-related resources. While | 30 // Grabs and refreshes any display server related resources. Must be balanced |
| 27 // the server is grabbed, other clients are blocked. Must be balanced | |
| 28 // by a call to UngrabServer(). | 31 // by a call to UngrabServer(). |
| 29 virtual void GrabServer() = 0; | 32 virtual void GrabServer() = 0; |
| 30 | 33 |
| 31 // Ungrabs the server and frees XRandR-related resources. | 34 // Released the display server and any resources allocated by GrabServer(). |
| 32 virtual void UngrabServer() = 0; | 35 virtual void UngrabServer() = 0; |
| 33 | 36 |
| 34 // Flushes all pending requests and waits for replies. | 37 // Flushes all pending requests and waits for replies. |
| 35 virtual void SyncWithServer() = 0; | 38 virtual void SyncWithServer() = 0; |
| 36 | 39 |
| 37 // Sets the window's background color to |color_argb|. | 40 // Sets the window's background color to |color_argb|. |
| 38 virtual void SetBackgroundColor(uint32 color_argb) = 0; | 41 virtual void SetBackgroundColor(uint32 color_argb) = 0; |
| 39 | 42 |
| 40 // Enables DPMS and forces it to the "on" state. | 43 // Enables DPMS and forces it to the "on" state. |
| 41 virtual void ForceDPMSOn() = 0; | 44 virtual void ForceDPMSOn() = 0; |
| 42 | 45 |
| 43 // Returns information about the current outputs. This method may block for | 46 // Returns information about the current outputs. This method may block for |
| 44 // 60 milliseconds or more. The returned outputs are not fully initialized; | 47 // 60 milliseconds or more. |
| 45 // the rest of the work happens in | 48 // NativeDisplayDelegate maintains ownership of the ui::DisplaySnapshot |
| 46 // OutputConfigurator::UpdateCachedOutputs(). | 49 // pointers. |
| 47 virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() = 0; | 50 virtual std::vector<ui::DisplaySnapshot*> GetOutputs() = 0; |
| 48 | 51 |
| 49 // Adds |mode| to |output|. | 52 // Adds |mode| to |output|. |mode| must be a valid display mode pointer. |
| 50 virtual void AddMode(const OutputConfigurator::OutputSnapshot& output, | 53 virtual void AddMode(const ui::DisplaySnapshot& output, |
| 51 RRMode mode) = 0; | 54 const ui::DisplayMode* mode) = 0; |
| 52 | 55 |
| 53 // Calls XRRSetCrtcConfig() with the given options but some of our default | 56 // Configures the display represented by |output| to use |mode| and positions |
| 54 // output count and rotation arguments. Returns true on success. | 57 // the display to |origin| in the framebuffer. |mode| can be NULL, which |
| 55 virtual bool Configure(const OutputConfigurator::OutputSnapshot& output, | 58 // represents disabling the display. Returns true on success. |
| 56 RRMode mode, | 59 virtual bool Configure(const ui::DisplaySnapshot& output, |
| 57 int x, | 60 const ui::DisplayMode* mode, |
| 58 int y) = 0; | 61 const gfx::Point& origin) = 0; |
| 59 | 62 |
| 60 // Called to set the frame buffer (underlying XRR "screen") size. Has | 63 // Called to set the frame buffer (underlying XRR "screen") size. |
| 61 // a side-effect of disabling all CRTCs. | 64 virtual void CreateFrameBuffer(const gfx::Size& size) = 0; |
| 62 virtual void CreateFrameBuffer( | |
| 63 int width, | |
| 64 int height, | |
| 65 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) = 0; | |
| 66 | 65 |
| 67 // Gets HDCP state of output. | 66 // Gets HDCP state of output. |
| 68 virtual bool GetHDCPState(const OutputConfigurator::OutputSnapshot& output, | 67 virtual bool GetHDCPState(const ui::DisplaySnapshot& output, |
| 69 HDCPState* state) = 0; | 68 ui::HDCPState* state) = 0; |
| 70 | 69 |
| 71 // Sets HDCP state of output. | 70 // Sets HDCP state of output. |
| 72 virtual bool SetHDCPState(const OutputConfigurator::OutputSnapshot& output, | 71 virtual bool SetHDCPState(const ui::DisplaySnapshot& output, |
| 73 HDCPState state) = 0; | 72 ui::HDCPState state) = 0; |
| 74 | 73 |
| 75 virtual void AddObserver(NativeDisplayObserver* observer) = 0; | 74 virtual void AddObserver(NativeDisplayObserver* observer) = 0; |
| 76 | 75 |
| 77 virtual void RemoveObserver(NativeDisplayObserver* observer) = 0; | 76 virtual void RemoveObserver(NativeDisplayObserver* observer) = 0; |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 } // namespace ui | 79 } // namespace ui |
| 81 | 80 |
| 82 #endif // UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ | 81 #endif // UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_ |
| OLD | NEW |