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 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 resolution of the desktop. 23 virtual ScreenResolution GetCurrentResolution() = 0; 24 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; 35 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; 41 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; 47 }; 48 49 } // namespace remoting 50 51 #endif // REMOTING_HOST_DESKTOP_RESIZER_H_ 52