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

Side by Side Diff: chromeos/audio/audio_devices_pref_handler_stub.h

Issue 1746843002: Persist the user's active audio device choice across chromeos session and reboots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 4 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_ 5 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_
6 #define CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_ 6 #define CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chromeos/audio/audio_devices_pref_handler.h" 13 #include "chromeos/audio/audio_devices_pref_handler.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 // Stub class for AudioDevicesPrefHandler, used for testing. 17 // Stub class for AudioDevicesPrefHandler, used for testing.
18 class CHROMEOS_EXPORT AudioDevicesPrefHandlerStub 18 class CHROMEOS_EXPORT AudioDevicesPrefHandlerStub
19 : public AudioDevicesPrefHandler { 19 : public AudioDevicesPrefHandler {
20 public: 20 public:
21 struct DeviceState {
22 bool active;
23 bool activate_by_user;
24 };
25
21 using AudioDeviceMute = std::map<uint64_t, bool>; 26 using AudioDeviceMute = std::map<uint64_t, bool>;
22 using AudioDeviceVolumeGain = std::map<uint64_t, int>; 27 using AudioDeviceVolumeGain = std::map<uint64_t, int>;
23 using AudioDeviceLastState = std::map<uint64_t, AudioDeviceState>; 28 using AudioDeviceStateMap = std::map<uint64_t, DeviceState>;
24 29
25 AudioDevicesPrefHandlerStub(); 30 AudioDevicesPrefHandlerStub();
26 31
27 // AudioDevicesPrefHandler: 32 // AudioDevicesPrefHandler:
28 double GetOutputVolumeValue(const AudioDevice* device) override; 33 double GetOutputVolumeValue(const AudioDevice* device) override;
29 double GetInputGainValue(const AudioDevice* device) override; 34 double GetInputGainValue(const AudioDevice* device) override;
30 void SetVolumeGainValue(const AudioDevice& device, double value) override; 35 void SetVolumeGainValue(const AudioDevice& device, double value) override;
31 bool GetMuteValue(const AudioDevice& device) override; 36 bool GetMuteValue(const AudioDevice& device) override;
32 void SetMuteValue(const AudioDevice& device, bool mute_on) override; 37 void SetMuteValue(const AudioDevice& device, bool mute_on) override;
33 AudioDeviceState GetDeviceState(const AudioDevice& device) override; 38 void SetDeviceActive(const AudioDevice& device,
34 void SetDeviceState(const AudioDevice& device, 39 bool active,
35 AudioDeviceState state) override; 40 bool activate_by_user) override;
41 bool GetDeviceActive(const AudioDevice& device,
42 bool* active,
43 bool* activate_by_user) override;
36 bool GetAudioOutputAllowedValue() override; 44 bool GetAudioOutputAllowedValue() override;
37 void AddAudioPrefObserver(AudioPrefObserver* observer) override; 45 void AddAudioPrefObserver(AudioPrefObserver* observer) override;
38 void RemoveAudioPrefObserver(AudioPrefObserver* observer) override; 46 void RemoveAudioPrefObserver(AudioPrefObserver* observer) override;
39 47
40 protected: 48 protected:
41 ~AudioDevicesPrefHandlerStub() override; 49 ~AudioDevicesPrefHandlerStub() override;
42 50
43 private: 51 private:
44 AudioDeviceMute audio_device_mute_map_; 52 AudioDeviceMute audio_device_mute_map_;
45 AudioDeviceVolumeGain audio_device_volume_gain_map_; 53 AudioDeviceVolumeGain audio_device_volume_gain_map_;
46 AudioDeviceLastState audio_device_state_map_; 54 AudioDeviceStateMap audio_device_state_map_;
47 55
48 DISALLOW_COPY_AND_ASSIGN(AudioDevicesPrefHandlerStub); 56 DISALLOW_COPY_AND_ASSIGN(AudioDevicesPrefHandlerStub);
49 }; 57 };
50 58
51 } // namespace chromeos 59 } // namespace chromeos
52 60
53 #endif // CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_ 61 #endif // CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_
OLDNEW
« no previous file with comments | « chromeos/audio/audio_devices_pref_handler_impl_unittest.cc ('k') | chromeos/audio/audio_devices_pref_handler_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698