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> | 8 #include <string> |
9 | 9 |
10 #include "remoting/host/host_status_observer.h" | |
11 #include "remoting/host/chromoting_host.h" | |
12 | |
13 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "remoting/host/host_status_observer.h" |
15 #include "third_party/skia/include/core/SkSize.h" | 14 #include "third_party/skia/include/core/SkSize.h" |
16 | 15 |
17 namespace remoting { | 16 namespace remoting { |
18 | 17 |
19 class DesktopResizer; | 18 class DesktopResizer; |
| 19 class HostStatusMonitor; |
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 HostStatusObserver { |
25 public: | 25 public: |
26 ResizingHostObserver(DesktopResizer* desktop_resizer, ChromotingHost* host); | 26 ResizingHostObserver(DesktopResizer* desktop_resizer, |
| 27 base::WeakPtr<HostStatusMonitor> monitor); |
27 virtual ~ResizingHostObserver(); | 28 virtual ~ResizingHostObserver(); |
28 | 29 |
29 // HostStatusObserver interface | 30 // HostStatusObserver interface |
30 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; | 31 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; |
31 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; | 32 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; |
32 virtual void OnClientResolutionChanged(const std::string& jid, | 33 virtual void OnClientResolutionChanged(const std::string& jid, |
33 const SkISize& size, | 34 const SkISize& size, |
34 const SkIPoint& dpi) OVERRIDE; | 35 const SkIPoint& dpi) OVERRIDE; |
35 | 36 |
36 private: | 37 private: |
37 DesktopResizer* const desktop_resizer_; | 38 DesktopResizer* const desktop_resizer_; |
38 scoped_refptr<ChromotingHost> host_; | 39 base::WeakPtr<HostStatusMonitor> monitor_; |
39 SkISize original_size_; | 40 SkISize original_size_; |
40 std::string client_jid_; | 41 std::string client_jid_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); | 43 DISALLOW_COPY_AND_ASSIGN(ResizingHostObserver); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace remoting | 46 } // namespace remoting |
46 | 47 |
47 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ | 48 #endif // REMOTING_HOST_RESIZING_HOST_OBSERVER_H_ |
OLD | NEW |