Index: remoting/host/resizing_host_observer.h |
diff --git a/remoting/host/resizing_host_observer.h b/remoting/host/resizing_host_observer.h |
index 2682d76627d8ee208030646f61de3983a0052f42..a8200edab677f79429e245983657b8ec9470751a 100644 |
--- a/remoting/host/resizing_host_observer.h |
+++ b/remoting/host/resizing_host_observer.h |
@@ -8,13 +8,16 @@ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/time.h" |
+#include "base/timer.h" |
#include "remoting/host/screen_controls.h" |
+#include "remoting/host/screen_resolution.h" |
#include "third_party/skia/include/core/SkSize.h" |
namespace remoting { |
class DesktopResizer; |
-class ScreenResolution; |
// TODO(alexeypa): Rename this class to reflect that it is not |
// HostStatusObserver any more. |
@@ -30,10 +33,21 @@ class ResizingHostObserver : public ScreenControls { |
// ScreenControls interface. |
virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; |
+ // Set the minimum amount of time between resize requests so that this class |
+ // can be unit-tested in a timely manner. |
+ void SetMinimumResizeIntervalForTesting(const base::TimeDelta& interval); |
+ |
private: |
scoped_ptr<DesktopResizer> desktop_resizer_; |
SkISize original_size_; |
+ // State to manage rate-limiting of desktop resizes. |
+ base::OneShotTimer<ResizingHostObserver> deferred_resize_timer_; |
+ base::Time previous_resize_time_; |
+ base::TimeDelta minimum_resize_interval_; |
+ |
+ base::WeakPtrFactory<ResizingHostObserver> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); |
}; |