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