diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 04:27:49 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 04:27:49 +0000 |
commit | 9cfb0c35a8ee5bb7f1ee22063e4b5d4bc2b62d3d (patch) | |
tree | 419e5567d6e33222e350438cc20809274a77d480 /remoting/host/resizing_host_observer.cc | |
parent | 6efcdcd281eac224b621474f4a82bece49e94ba9 (diff) | |
download | chromium_src-9cfb0c35a8ee5bb7f1ee22063e4b5d4bc2b62d3d.zip chromium_src-9cfb0c35a8ee5bb7f1ee22063e4b5d4bc2b62d3d.tar.gz chromium_src-9cfb0c35a8ee5bb7f1ee22063e4b5d4bc2b62d3d.tar.bz2 |
Moving host status events monitoring to a separate interface (HostStatusMonitor).
This CL unbinds the host status event observers from ChromotingHost. This is useful when, for instance, an observer resides in a different process where ChromotingHost is not available. Additionally, observers get HostStatusMonitor as a weak pointer, making sure that they do not need to worry about HostStatusMonitor's life time.
BUG=178873
Review URL: https://chromiumcodereview.appspot.com/12386035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/resizing_host_observer.cc')
-rw-r--r-- | remoting/host/resizing_host_observer.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/remoting/host/resizing_host_observer.cc b/remoting/host/resizing_host_observer.cc index 48742ca..e1c96b5 100644 --- a/remoting/host/resizing_host_observer.cc +++ b/remoting/host/resizing_host_observer.cc @@ -3,28 +3,27 @@ // found in the LICENSE file. #include "remoting/host/resizing_host_observer.h" -#include "remoting/host/desktop_resizer.h" #include <set> #include "base/logging.h" +#include "remoting/host/desktop_resizer.h" +#include "remoting/host/host_status_monitor.h" namespace remoting { ResizingHostObserver::ResizingHostObserver( - DesktopResizer* desktop_resizer, ChromotingHost* host) + DesktopResizer* desktop_resizer, + base::WeakPtr<HostStatusMonitor> monitor) : desktop_resizer_(desktop_resizer), - host_(host), + monitor_(monitor), original_size_(SkISize::Make(0, 0)) { - if (host_ != NULL) { - host_->AddStatusObserver(this); - } + monitor_->AddStatusObserver(this); } ResizingHostObserver::~ResizingHostObserver() { - if (host_ != NULL) { - host_->RemoveStatusObserver(this); - } + if (monitor_) + monitor_->RemoveStatusObserver(this); } void ResizingHostObserver::OnClientAuthenticated(const std::string& jid) { |