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_SCREEN_SAVER_BLOCKER_H_ | |
| 6 #define REMOTING_HOST_SCREEN_SAVER_BLOCKER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "device/power_save_blocker/power_save_blocker.h" | |
| 13 #include "remoting/host/chromoting_host_context.h" | |
| 14 #include "remoting/host/host_status_observer.h" | |
| 15 | |
| 16 namespace remoting { | |
| 17 | |
| 18 class HostStatusMonitor; | |
| 19 | |
| 20 // A HostStatusObserver to block screen saver from taking effect during the | |
| 21 // lifetime of a remoting connection. | |
| 22 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
| |
| 23 public: | |
| 24 ScreenSaverBlocker(base::WeakPtr<HostStatusMonitor> monitor, | |
| 25 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.
| |
| 26 | |
| 27 ~ScreenSaverBlocker() override; | |
| 28 | |
| 29 void OnClientConnected(const std::string& jid) override; | |
| 30 void OnClientDisconnected(const std::string& jid) override; | |
| 31 | |
| 32 private: | |
| 33 base::WeakPtr<HostStatusMonitor> monitor_; | |
| 34 std::unique_ptr<ChromotingHostContext> context_; | |
| 35 std::unique_ptr<device::PowerSaveBlocker> blocker_; | |
| 36 }; | |
| 37 | |
| 38 } // namespace remoting | |
| 39 | |
| 40 #endif // REMOTING_HOST_SCREEN_SAVER_BLOCKER_H_ | |
| OLD | NEW |