Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / display / types / native_display_delegate.h
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 UI_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_
6 #define UI_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "ui/display/types/display_constants.h"
13 #include "ui/display/types/display_types_export.h"
14
15 namespace gfx {
16 class Point;
17 class Size;
18 }
19
20 namespace ui {
21 class DisplayMode;
22 class DisplaySnapshot;
23
24 class NativeDisplayObserver;
25
26 // Interface for classes that perform display configuration actions on behalf
27 // of DisplayConfigurator.
28 class DISPLAY_TYPES_EXPORT NativeDisplayDelegate {
29  public:
30   virtual ~NativeDisplayDelegate() {}
31
32   virtual void Initialize() = 0;
33
34   // Grabs and refreshes any display server related resources. Must be balanced
35   // by a call to UngrabServer().
36   virtual void GrabServer() = 0;
37
38   // Released the display server and any resources allocated by GrabServer().
39   virtual void UngrabServer() = 0;
40
41   // Take control of the display from any other controlling process.
42   virtual bool TakeDisplayControl() = 0;
43
44   // Let others control the display.
45   virtual bool RelinquishDisplayControl() = 0;
46
47   // Flushes all pending requests and waits for replies.
48   virtual void SyncWithServer() = 0;
49
50   // Sets the window's background color to |color_argb|.
51   virtual void SetBackgroundColor(uint32_t color_argb) = 0;
52
53   // Enables DPMS and forces it to the "on" state.
54   virtual void ForceDPMSOn() = 0;
55
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
59   // pointers.
60   virtual std::vector<ui::DisplaySnapshot*> GetDisplays() = 0;
61
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;
65
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;
72
73   // Called to set the frame buffer (underlying XRR "screen") size.
74   virtual void CreateFrameBuffer(const gfx::Size& size) = 0;
75
76   // Gets HDCP state of output.
77   virtual bool GetHDCPState(const ui::DisplaySnapshot& output,
78                             ui::HDCPState* state) = 0;
79
80   // Sets HDCP state of output.
81   virtual bool SetHDCPState(const ui::DisplaySnapshot& output,
82                             ui::HDCPState state) = 0;
83
84   // Gets the available list of color calibrations.
85   virtual std::vector<ui::ColorCalibrationProfile>
86       GetAvailableColorCalibrationProfiles(
87           const ui::DisplaySnapshot& output) = 0;
88
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;
93
94   virtual void AddObserver(NativeDisplayObserver* observer) = 0;
95
96   virtual void RemoveObserver(NativeDisplayObserver* observer) = 0;
97 };
98
99 }  // namespace ui
100
101 #endif  // UI_DISPLAY_TYPES_NATIVE_DISPLAY_DELEGATE_H_