summaryrefslogtreecommitdiffstats
path: root/ui/display/chromeos/native_display_delegate.h
blob: 8322ecf0ead7cf732837bb53dece014175705ffd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_
#define UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_

#include <stdint.h>

#include <vector>

#include "ui/display/display_constants.h"
#include "ui/display/display_export.h"

namespace gfx {
class Point;
class Size;
}

namespace ui {
class DisplayMode;
class DisplaySnapshot;

class NativeDisplayObserver;

// Interface for classes that perform display configuration actions on behalf
// of OutputConfigurator.
class DISPLAY_EXPORT NativeDisplayDelegate {
 public:
  virtual ~NativeDisplayDelegate() {}

  virtual void Initialize() = 0;

  // Grabs and refreshes any display server related resources. Must be balanced
  // by a call to UngrabServer().
  virtual void GrabServer() = 0;

  // Released the display server and any resources allocated by GrabServer().
  virtual void UngrabServer() = 0;

  // Flushes all pending requests and waits for replies.
  virtual void SyncWithServer() = 0;

  // Sets the window's background color to |color_argb|.
  virtual void SetBackgroundColor(uint32_t color_argb) = 0;

  // Enables DPMS and forces it to the "on" state.
  virtual void ForceDPMSOn() = 0;

  // Returns information about the current outputs. This method may block for
  // 60 milliseconds or more.
  // NativeDisplayDelegate maintains ownership of the ui::DisplaySnapshot
  // pointers.
  virtual std::vector<ui::DisplaySnapshot*> GetOutputs() = 0;

  // Adds |mode| to |output|. |mode| must be a valid display mode pointer.
  virtual void AddMode(const ui::DisplaySnapshot& output,
                       const ui::DisplayMode* mode) = 0;

  // Configures the display represented by |output| to use |mode| and positions
  // the display to |origin| in the framebuffer. |mode| can be NULL, which
  // represents disabling the display. Returns true on success.
  virtual bool Configure(const ui::DisplaySnapshot& output,
                         const ui::DisplayMode* mode,
                         const gfx::Point& origin) = 0;

  // Called to set the frame buffer (underlying XRR "screen") size.
  virtual void CreateFrameBuffer(const gfx::Size& size) = 0;

  // Gets HDCP state of output.
  virtual bool GetHDCPState(const ui::DisplaySnapshot& output,
                            ui::HDCPState* state) = 0;

  // Sets HDCP state of output.
  virtual bool SetHDCPState(const ui::DisplaySnapshot& output,
                            ui::HDCPState state) = 0;

  // Gets the available list of color calibrations.
  virtual std::vector<ui::ColorCalibrationProfile>
      GetAvailableColorCalibrationProfiles(
          const ui::DisplaySnapshot& output) = 0;

  // Sets the color calibration of |output| to |new_profile|.
  virtual bool SetColorCalibrationProfile(
      const ui::DisplaySnapshot& output,
      ui::ColorCalibrationProfile new_profile) = 0;

  virtual void AddObserver(NativeDisplayObserver* observer) = 0;

  virtual void RemoveObserver(NativeDisplayObserver* observer) = 0;
};

}  // namespace ui

#endif  // UI_DISPLAY_CHROMEOS_NATIVE_DISPLAY_DELEGATE_H_