Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / remoting / host / desktop_resizer.h
blob0b103fcc2d4488cadab7b416f4d165573b0b6c02
1 // Copyright (c) 2012 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.
5 #ifndef REMOTING_HOST_DESKTOP_RESIZER_H_
6 #define REMOTING_HOST_DESKTOP_RESIZER_H_
8 #include <list>
10 #include "base/memory/scoped_ptr.h"
11 #include "remoting/host/screen_resolution.h"
13 namespace remoting {
15 class DesktopResizer {
16 public:
17 virtual ~DesktopResizer() {}
19 // Create a platform-specific DesktopResizer instance.
20 static scoped_ptr<DesktopResizer> Create();
22 // Return the current resolution of the desktop.
23 virtual ScreenResolution GetCurrentResolution() = 0;
25 // Get the list of supported resolutions, which should ideally include
26 // |preferred|. Implementations will generally do one of the following:
27 // 1. Return the list of resolutions supported by the underlying video
28 // driver, regardless of |preferred|.
29 // 2. Return a list containing just |preferred|, perhaps after imposing
30 // some minimum size constraint. This will typically be the case if
31 // there are no constraints imposed by the underlying video driver.
32 // 3. Return an empty list if resize is not supported.
33 virtual std::list<ScreenResolution> GetSupportedResolutions(
34 const ScreenResolution& preferred) = 0;
36 // Set the resolution of the desktop. |resolution| must be one of the
37 // resolutions previously returned by |GetSupportedResolutions|. Note that
38 // implementations should fail gracefully if the specified resolution is no
39 // longer supported, since monitor configurations may change on the fly.
40 virtual void SetResolution(const ScreenResolution& resolution) = 0;
42 // Restore the original desktop resolution. The caller must provide the
43 // original resolution of the desktop, as returned by |GetCurrentResolution|,
44 // as a hint. However, implementaions are free to ignore this. For example,
45 // virtual hosts will typically ignore it to avoid unnecessary resizes.
46 virtual void RestoreResolution(const ScreenResolution& original) = 0;
49 } // namespace remoting
51 #endif // REMOTING_HOST_DESKTOP_RESIZER_H_