15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef REMOTING_HOST_DESKTOP_RESIZER_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define REMOTING_HOST_DESKTOP_RESIZER_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <list> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 110f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include "remoting/host/screen_resolution.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace remoting { 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DesktopResizer { 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~DesktopResizer() {} 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Create a platform-specific DesktopResizer instance. 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static scoped_ptr<DesktopResizer> Create(); 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 220f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // Return the current resolution of the desktop. 230f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) virtual ScreenResolution GetCurrentResolution() = 0; 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 250f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // Get the list of supported resolutions, which should ideally include 260f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // |preferred|. Implementations will generally do one of the following: 270f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // 1. Return the list of resolutions supported by the underlying video 280f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // driver, regardless of |preferred|. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 2. Return a list containing just |preferred|, perhaps after imposing 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // some minimum size constraint. This will typically be the case if 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // there are no constraints imposed by the underlying video driver. 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 3. Return an empty list if resize is not supported. 330f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) virtual std::list<ScreenResolution> GetSupportedResolutions( 340f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) const ScreenResolution& preferred) = 0; 350f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 360f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // Set the resolution of the desktop. |resolution| must be one of the 370f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // resolutions previously returned by |GetSupportedResolutions|. Note that 380f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // implementations should fail gracefully if the specified resolution is no 390f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // longer supported, since monitor configurations may change on the fly. 400f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) virtual void SetResolution(const ScreenResolution& resolution) = 0; 410f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) 420f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // Restore the original desktop resolution. The caller must provide the 430f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // original resolution of the desktop, as returned by |GetCurrentResolution|, 440f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // as a hint. However, implementaions are free to ignore this. For example, 450f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) // virtual hosts will typically ignore it to avoid unnecessary resizes. 460f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles) virtual void RestoreResolution(const ScreenResolution& original) = 0; 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace remoting 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // REMOTING_HOST_DESKTOP_RESIZER_H_ 52