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

Unified Diff: chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.h

Issue 2733903002: Remote set volume command (Closed)
Patch Set: Callback, two more tests, nits Created 3 years, 9 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
Index: chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.h
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.h b/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5bec5d31521957d775507625d9a313c09c43143
--- /dev/null
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.h
@@ -0,0 +1,47 @@
+// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SET_VOLUME_JOB_H_
+#define CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SET_VOLUME_JOB_H_
+
+#include <memory>
+#include <string>
+
+#include "base/callback_forward.h"
+#include "base/macros.h"
+#include "components/policy/core/common/remote_commands/remote_command_job.h"
+
+namespace policy {
+
+class DeviceCommandSetVolumeJob : public RemoteCommandJob {
+ public:
+ DeviceCommandSetVolumeJob();
+ ~DeviceCommandSetVolumeJob() override;
+
+ void SetVolumeCallbackForTesting(const base::Callback<void(int)>& callback);
Andrew T Wilson (Slow) 2017/03/08 12:50:56 Maybe create a typedef for this callback?
Ivan Šandrk 2017/03/08 15:07:11 Done.
+
+ // RemoteCommandJob:
+ enterprise_management::RemoteCommand_Type GetType() const override;
+ base::TimeDelta GetCommmandTimeout() const override;
+
+ protected:
+ // RemoteCommandJob:
+ bool ParseCommandPayload(const std::string& command_payload) override;
+ bool IsExpired(base::TimeTicks now) override;
+ void RunImpl(const CallbackWithResult& succeeded_callback,
+ const CallbackWithResult& failed_callback) override;
+
+ private:
+ // New volume level to be set, value in range [0,100].
+ int volume_;
+
+ // Used in tests instead of CrasAudioHandler::SetOutputVolumePercent.
+ base::Callback<void(int)> volume_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeviceCommandSetVolumeJob);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SET_VOLUME_JOB_H_

Powered by Google App Engine
This is Rietveld 408576698