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

Side by Side Diff: remoting/host/host_power_save_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/host_power_save_blocker.h"
6
7 #include <utility>
8
9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h"
11 #include "remoting/host/host_status_monitor.h"
12
13 namespace remoting {
14
15 HostPowerSaveBlocker::HostPowerSaveBlocker(
16 base::WeakPtr<HostStatusMonitor> monitor,
17 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
18 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner)
19 : monitor_(monitor),
20 ui_task_runner_(ui_task_runner),
21 file_task_runner_(file_task_runner) {
22 DCHECK(monitor_);
23 monitor_->AddStatusObserver(this);
24 }
25
26 HostPowerSaveBlocker::~HostPowerSaveBlocker() {
27 if (monitor_.get()) {
28 monitor_->RemoveStatusObserver(this);
29 }
30 }
31
32 void HostPowerSaveBlocker::OnClientConnected(const std::string& jid) {
33 blocker_.reset(new device::PowerSaveBlocker(
34 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
35 device::PowerSaveBlocker::kReasonOther,
36 "Remoting session is active",
37 ui_task_runner_,
38 file_task_runner_));
39 }
40
41 void HostPowerSaveBlocker::OnClientDisconnected(const std::string& jid) {
42 blocker_.reset();
43 }
44
45 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_power_save_blocker.h ('k') | remoting/host/host_power_save_blocker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698