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

Unified Diff: remoting/host/host_power_save_blocker.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/DEPS ('k') | remoting/host/host_power_save_blocker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_power_save_blocker.h
diff --git a/remoting/host/host_power_save_blocker.h b/remoting/host/host_power_save_blocker.h
new file mode 100644
index 0000000000000000000000000000000000000000..3df488cae59e4f1b7c8471ffdcbbf89da58d60f4
--- /dev/null
+++ b/remoting/host/host_power_save_blocker.h
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_
+#define REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_
+
+#include <memory>
+#include <string>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "device/power_save_blocker/power_save_blocker.h"
+#include "remoting/host/host_status_observer.h"
+
+namespace base {
+
+class SingleThreadTaskRunner;
+
+} // namespace base
+
+namespace remoting {
+
+class AutoThreadTaskRunner;
+class HostStatusMonitor;
+
+// A HostStatusObserver to block screen saver from taking effect during the
+// lifetime of a remoting connection.
+class HostPowerSaveBlocker : public HostStatusObserver {
+ public:
+ HostPowerSaveBlocker(
+ base::WeakPtr<HostStatusMonitor> monitor,
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
+ const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner);
+
+ ~HostPowerSaveBlocker() override;
+
+ void OnClientConnected(const std::string& jid) override;
+ void OnClientDisconnected(const std::string& jid) override;
+
+ private:
+ friend class HostPowerSaveBlockerTest;
+
+ base::WeakPtr<HostStatusMonitor> monitor_;
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
+ std::unique_ptr<device::PowerSaveBlocker> blocker_;
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_HOST_POWER_SAVER_BLOCKER_H_
« no previous file with comments | « remoting/host/DEPS ('k') | remoting/host/host_power_save_blocker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698