Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Side by Side Diff: remoting/host/screen_saver_blocker.cc

Issue 2080723008: [Chromoting] Use device::PowerSaveBlocker to block screen saver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "remoting/host/screen_saver_blocker.h"
6
7 #include <utility>
8
9 #include "base/logging.h"
10 #include "remoting/base/auto_thread_task_runner.h"
11 #include "remoting/host/host_status_monitor.h"
12
13 namespace remoting {
14
15 ScreenSaverBlocker::ScreenSaverBlocker(
16 base::WeakPtr<HostStatusMonitor> monitor,
17 std::unique_ptr<ChromotingHostContext>&& context)
18 : monitor_(monitor),
19 context_(std::move(context)) {
20 DCHECK(monitor_);
21 monitor_->AddStatusObserver(this);
22 }
23
24 ScreenSaverBlocker::~ScreenSaverBlocker() {
25 if (monitor_.get()) {
26 monitor_->RemoveStatusObserver(this);
27 }
28 }
29
30 void ScreenSaverBlocker::OnClientConnected(const std::string& jid) {
31 blocker_.reset(new device::PowerSaveBlocker(
32 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
33 device::PowerSaveBlocker::kReasonVideoPlayback,
Sergey Ulanov 2016/07/08 21:31:47 Why not kReasonOther?
Hzj_jie 2016/07/10 22:04:57 Done.
34 "Remoting session is active",
35 context_->ui_task_runner(),
36 context_->file_task_runner()));
37 }
38
39 void ScreenSaverBlocker::OnClientDisconnected(const std::string& jid) {
40 blocker_.reset();
41 }
42
43 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698