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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SET_VOLUME _JOB_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SET_VOLUME _JOB_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback_forward.h"
12 #include "base/macros.h"
13 #include "components/policy/core/common/remote_commands/remote_command_job.h"
14
15 namespace policy {
16
17 class DeviceCommandSetVolumeJob : public RemoteCommandJob {
18 public:
19 DeviceCommandSetVolumeJob();
20 ~DeviceCommandSetVolumeJob() override;
21
22 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.
23
24 // RemoteCommandJob:
25 enterprise_management::RemoteCommand_Type GetType() const override;
26 base::TimeDelta GetCommmandTimeout() const override;
27
28 protected:
29 // RemoteCommandJob:
30 bool ParseCommandPayload(const std::string& command_payload) override;
31 bool IsExpired(base::TimeTicks now) override;
32 void RunImpl(const CallbackWithResult& succeeded_callback,
33 const CallbackWithResult& failed_callback) override;
34
35 private:
36 // New volume level to be set, value in range [0,100].
37 int volume_;
38
39 // Used in tests instead of CrasAudioHandler::SetOutputVolumePercent.
40 base::Callback<void(int)> volume_callback_;
41
42 DISALLOW_COPY_AND_ASSIGN(DeviceCommandSetVolumeJob);
43 };
44
45 } // namespace policy
46
47 #endif // CHROME_BROWSER_CHROMEOS_POLICY_REMOTE_COMMANDS_DEVICE_COMMAND_SET_VOL UME_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698