Chromium Code Reviews| 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 SequencedTaskRunner; | |
| 19 class SingleThreadTaskRunner; | |
| 20 | |
| 21 } // namespace base | |
| 22 | |
| 23 namespace remoting { | |
| 24 | |
| 25 class AutoThreadTaskRunner; | |
| 26 class HostStatusMonitor; | |
| 27 | |
| 28 // A HostStatusObserver to block screen saver from taking effect during the | |
| 29 // lifetime of a remoting connection. | |
| 30 class HostPowerSaveBlocker : public HostStatusObserver { | |
| 31 public: | |
| 32 HostPowerSaveBlocker( | |
| 33 base::WeakPtr<HostStatusMonitor> monitor, | |
| 34 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | |
| 35 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.
| |
| 36 | |
| 37 ~HostPowerSaveBlocker() override; | |
| 38 | |
| 39 void OnClientConnected(const std::string& jid) override; | |
| 40 void OnClientDisconnected(const std::string& jid) override; | |
| 41 | |
| 42 private: | |
| 43 friend class HostPowerSaveBlockerTest; | |
| 44 | |
| 45 base::WeakPtr<HostStatusMonitor> monitor_; | |
| 46 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | |
| 47 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | |
| 48 std::unique_ptr<device::PowerSaveBlocker> blocker_; | |
| 49 }; | |
| 50 | |
| 51 } // namespace remoting | |
| 52 | |
| 53 #endif // REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_ | |
| OLD | NEW |