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..5106b3c350243733a9a39d88b2b30798594155c1 |
| --- /dev/null |
| +++ b/remoting/host/host_power_save_blocker.h |
| @@ -0,0 +1,43 @@ |
| +// 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/chromoting_host_context.h" |
| +#include "remoting/host/host_status_observer.h" |
| + |
| +namespace remoting { |
| + |
| +class HostStatusMonitor; |
| +class AutoThreadTaskRunner; |
|
Sergey Ulanov
2016/07/13 04:57:05
sort these alphabetically
Hzj_jie
2016/07/13 20:27:13
Done.
|
| + |
| +// 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 ChromotingHostContext& context); |
| + |
| + ~HostPowerSaveBlocker() override; |
| + |
| + void OnClientConnected(const std::string& jid) override; |
| + void OnClientDisconnected(const std::string& jid) override; |
| + |
| + private: |
| + base::WeakPtr<HostStatusMonitor> monitor_; |
| + scoped_refptr<AutoThreadTaskRunner> ui_task_runner_; |
| + scoped_refptr<AutoThreadTaskRunner> file_task_runner_; |
| + std::unique_ptr<device::PowerSaveBlocker> blocker_; |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ |