OLD | NEW |
(Empty) | |
| 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 "third_party/skia/include/core/SkRect.h" |
| 12 |
| 13 namespace remoting { |
| 14 |
| 15 class DesktopResizer { |
| 16 public: |
| 17 virtual ~DesktopResizer() {} |
| 18 |
| 19 // Create a platform-specific DesktopResizer instance. |
| 20 static scoped_ptr<DesktopResizer> Create(); |
| 21 |
| 22 // Return the current size of the desktop. If resize is not supported, the |
| 23 // implementation should return 0x0, in which case none of the other API |
| 24 // methods will be called. |
| 25 virtual SkISize GetCurrentSize() = 0; |
| 26 |
| 27 // Get the list of supported sizes, which should ideally include |preferred|. |
| 28 // Implementations will generally do one of the following: |
| 29 // 1. Return the list of sizes supported by the underlying video driver, |
| 30 // regardless of |preferred|. |
| 31 // 2. Return a list containing just |preferred|, perhaps after imposing |
| 32 // some minimum size constraint. This will typically be the case if |
| 33 // there are no constraints imposed by the underlying video driver. |
| 34 // 3. Return an empty list if resize is not supported. |
| 35 virtual std::list<SkISize> GetSupportedSizes(const SkISize& preferred) = 0; |
| 36 |
| 37 // Set the size of the desktop. |size| must be one of the sizes previously |
| 38 // returned by |GetSupportedSizes|. Note that implementations should fail |
| 39 // gracefully if the specified size is no longer supported, since monitor |
| 40 // configurations may change on the fly. |
| 41 virtual void SetSize(const SkISize& size) = 0; |
| 42 |
| 43 // Restore the original desktop size. The caller must provide the original |
| 44 // size of the desktop, as returned by |GetCurrentSize|, as a hint. However, |
| 45 // implementaions are free to ignore this. For example, virtual hosts will |
| 46 // typically ignore it to avoid unnecessary resize operations. |
| 47 virtual void RestoreSize(const SkISize& original) = 0; |
| 48 }; |
| 49 |
| 50 } // namespace remoting |
| 51 |
| 52 #endif // REMOTING_HOST_DESKTOP_RESIZER_H_ |
OLD | NEW |