File: desktop_resizer.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (70 lines) | stat: -rw-r--r-- 3,248 bytes parent folder | download | duplicates (7)
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
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_HOST_DESKTOP_RESIZER_H_
#define REMOTING_HOST_DESKTOP_RESIZER_H_

#include <list>
#include <memory>

#include "remoting/host/base/screen_resolution.h"
#include "remoting/proto/control.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h"

namespace remoting {

// Interface for resizing the desktop displays. These methods take an optional
// |screen_id| parameter to resize an individual monitor. If |screen_id| refers
// to a monitor that no longer exists, the implementation should do nothing, or
// return empty data. If |screen_id| is not provided, the implementation should
// operate on the single monitor if there is only one. If there are several
// monitors, the implementation should fall back to the legacy (per-platform)
// behavior.
class DesktopResizer {
 public:
  virtual ~DesktopResizer() {}

  // Create a platform-specific DesktopResizer instance.
  static std::unique_ptr<DesktopResizer> Create();

  // Return the current resolution of the monitor.
  virtual ScreenResolution GetCurrentResolution(webrtc::ScreenId screen_id) = 0;

  // Get the list of supported resolutions for the monitor, which should ideally
  // include |preferred|. Implementations will generally do one of the
  // following:
  //   1. Return the list of resolutions supported by the underlying video
  //      driver, regardless of |preferred|.
  //   2. Return a list containing just |preferred|, perhaps after imposing
  //      some minimum size constraint. This will typically be the case if
  //      there are no constraints imposed by the underlying video driver.
  //   3. Return an empty list if resize is not supported.
  virtual std::list<ScreenResolution> GetSupportedResolutions(
      const ScreenResolution& preferred,
      webrtc::ScreenId screen_id) = 0;

  // Set the resolution of the monitor. |resolution| must be one of the
  // resolutions previously returned by |GetSupportedResolutions|. Note that
  // implementations should fail gracefully if the specified resolution is no
  // longer supported, since monitor configurations may change on the fly.
  virtual void SetResolution(const ScreenResolution& resolution,
                             webrtc::ScreenId screen_id) = 0;

  // Restore the original monitor resolution. The caller must provide the
  // original resolution of the monitor, as returned by GetCurrentResolution(),
  // as a hint. However, implementations are free to ignore this. For example,
  // virtual hosts will typically ignore it to avoid unnecessary resizes.
  virtual void RestoreResolution(const ScreenResolution& original,
                                 webrtc::ScreenId screen_id) = 0;

  // Updates current display layout to match |layout|. If a video track doesn't
  // have screen_id, a new monitor will be added with the matching geometry.
  // This method has the same requirements and behavior as SetResolution()
  // regarding the screen resolution.
  virtual void SetVideoLayout(const protocol::VideoLayout& layout) = 0;
};

}  // namespace remoting

#endif  // REMOTING_HOST_DESKTOP_RESIZER_H_