| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ |
| 6 #define REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "device/power_save_blocker/power_save_blocker.h" |
| 14 #include "remoting/host/host_status_observer.h" |
| 15 |
| 16 namespace base { |
| 17 |
| 18 class SingleThreadTaskRunner; |
| 19 |
| 20 } // namespace base |
| 21 |
| 22 namespace remoting { |
| 23 |
| 24 class AutoThreadTaskRunner; |
| 25 class HostStatusMonitor; |
| 26 |
| 27 // A HostStatusObserver to block screen saver from taking effect during the |
| 28 // lifetime of a remoting connection. |
| 29 class HostPowerSaveBlocker : public HostStatusObserver { |
| 30 public: |
| 31 HostPowerSaveBlocker( |
| 32 base::WeakPtr<HostStatusMonitor> monitor, |
| 33 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
| 34 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner); |
| 35 |
| 36 ~HostPowerSaveBlocker() override; |
| 37 |
| 38 void OnClientConnected(const std::string& jid) override; |
| 39 void OnClientDisconnected(const std::string& jid) override; |
| 40 |
| 41 private: |
| 42 friend class HostPowerSaveBlockerTest; |
| 43 |
| 44 base::WeakPtr<HostStatusMonitor> monitor_; |
| 45 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 46 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 47 std::unique_ptr<device::PowerSaveBlocker> blocker_; |
| 48 }; |
| 49 |
| 50 } // namespace remoting |
| 51 |
| 52 #endif // REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ |
| OLD | NEW |