Chromium Code Reviews| Index: remoting/host/screen_saver_blocker.h |
| diff --git a/remoting/host/screen_saver_blocker.h b/remoting/host/screen_saver_blocker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48f8914587dd95bed1e91fcc1377edb8c8d2057e |
| --- /dev/null |
| +++ b/remoting/host/screen_saver_blocker.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef REMOTING_HOST_SCREEN_SAVER_BLOCKER_H_ |
| +#define REMOTING_HOST_SCREEN_SAVER_BLOCKER_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "device/power_save_blocker/power_save_blocker.h" |
| +#include "remoting/host/chromoting_host_context.h" |
| +#include "remoting/host/host_status_observer.h" |
| + |
| +namespace remoting { |
| + |
| +class HostStatusMonitor; |
| + |
| +// A HostStatusObserver to block screen saver from taking effect during the |
| +// lifetime of a remoting connection. |
| +class ScreenSaverBlocker : public HostStatusObserver { |
|
Sergey Ulanov
2016/07/08 21:31:47
I don't think this is the best name, as it blocks
Hzj_jie
2016/07/10 22:04:57
Indeed blocking screensaver implies the suspending
|
| + public: |
| + ScreenSaverBlocker(base::WeakPtr<HostStatusMonitor> monitor, |
| + std::unique_ptr<ChromotingHostContext>&& context); |
|
Sergey Ulanov
2016/07/08 21:31:47
Please pass unique_ptr by value instead of rvalue.
Hzj_jie
2016/07/10 22:04:57
Done.
|
| + |
| + ~ScreenSaverBlocker() override; |
| + |
| + void OnClientConnected(const std::string& jid) override; |
| + void OnClientDisconnected(const std::string& jid) override; |
| + |
| + private: |
| + base::WeakPtr<HostStatusMonitor> monitor_; |
| + std::unique_ptr<ChromotingHostContext> context_; |
| + std::unique_ptr<device::PowerSaveBlocker> blocker_; |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_SCREEN_SAVER_BLOCKER_H_ |