Chromium Code Reviews| Index: remoting/host/host_power_save_blocker.h |
| diff --git a/remoting/host/host_power_save_blocker.h b/remoting/host/host_power_save_blocker.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a704355c729ac7ff012b21547bb62b45f683f22d |
| --- /dev/null |
| +++ b/remoting/host/host_power_save_blocker.h |
| @@ -0,0 +1,53 @@ |
| +// 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_HOST_POWER_SAVER_BLOCKER_H_ |
| +#define REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "device/power_save_blocker/power_save_blocker.h" |
| +#include "remoting/host/host_status_observer.h" |
| + |
| +namespace base { |
| + |
| +class SequencedTaskRunner; |
| +class SingleThreadTaskRunner; |
| + |
| +} // namespace base |
| + |
| +namespace remoting { |
| + |
| +class AutoThreadTaskRunner; |
| +class HostStatusMonitor; |
| + |
| +// A HostStatusObserver to block screen saver from taking effect during the |
| +// lifetime of a remoting connection. |
| +class HostPowerSaveBlocker : public HostStatusObserver { |
| + public: |
| + HostPowerSaveBlocker( |
| + base::WeakPtr<HostStatusMonitor> monitor, |
| + const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner); |
|
Sergey Ulanov
2016/07/14 19:52:48
I think these both should be SingleThreadTaskRunne
Hzj_jie
2016/07/14 23:20:03
Follow the definition of PowerSaveBlocker.
Sergey Ulanov
2016/07/14 23:30:56
I'm not sure why they used SequencedTaskRunner the
Hzj_jie
2016/07/15 02:12:00
Done.
|
| + |
| + ~HostPowerSaveBlocker() override; |
| + |
| + void OnClientConnected(const std::string& jid) override; |
| + void OnClientDisconnected(const std::string& jid) override; |
| + |
| + private: |
| + friend class HostPowerSaveBlockerTest; |
| + |
| + base::WeakPtr<HostStatusMonitor> monitor_; |
| + scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| + std::unique_ptr<device::PowerSaveBlocker> blocker_; |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ |