OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 5 #ifndef REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
6 #define REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 6 #define REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
7 | 7 |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
12 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
13 #include "remoting/host/host_status_observer.h" | 11 #include "remoting/host/session_controller.h" |
14 #include "third_party/skia/include/core/SkSize.h" | 12 #include "third_party/skia/include/core/SkSize.h" |
15 | 13 |
16 namespace remoting { | 14 namespace remoting { |
17 | 15 |
18 class DesktopResizer; | 16 class DesktopResizer; |
19 class HostStatusMonitor; | 17 |
| 18 // TODO(alexeypa): Rename this class to reflect that it is not |
| 19 // HostStatusObserver any more. |
20 | 20 |
21 // Use the specified DesktopResizer to match host desktop size to the client | 21 // Use the specified DesktopResizer to match host desktop size to the client |
22 // view size as closely as is possible. When the connection closes, restore | 22 // view size as closely as is possible. When the connection closes, restore |
23 // the original desktop size. | 23 // the original desktop size. |
24 class ResizingHostObserver : public HostStatusObserver { | 24 class ResizingHostObserver : public SessionController { |
25 public: | 25 public: |
26 ResizingHostObserver(DesktopResizer* desktop_resizer, | 26 explicit ResizingHostObserver(scoped_ptr<DesktopResizer> desktop_resizer); |
27 base::WeakPtr<HostStatusMonitor> monitor); | |
28 virtual ~ResizingHostObserver(); | 27 virtual ~ResizingHostObserver(); |
29 | 28 |
30 // HostStatusObserver interface | 29 // SessionController interface. |
31 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 30 virtual void OnClientResolutionChanged(const SkIPoint& client_dpi, |
32 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 31 const SkISize& client_size) OVERRIDE; |
33 virtual void OnClientResolutionChanged(const std::string& jid, | |
34 const SkISize& size, | |
35 const SkIPoint& dpi) OVERRIDE; | |
36 | 32 |
37 private: | 33 private: |
38 DesktopResizer* const desktop_resizer_; | 34 scoped_ptr<DesktopResizer> desktop_resizer_; |
39 base::WeakPtr<HostStatusMonitor> monitor_; | |
40 SkISize original_size_; | 35 SkISize original_size_; |
41 std::string client_jid_; | |
42 | 36 |
43 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); | 37 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); |
44 }; | 38 }; |
45 | 39 |
46 } // namespace remoting | 40 } // namespace remoting |
47 | 41 |
48 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 42 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
OLD | NEW |