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

Side by Side Diff: extensions/browser/api/audio/audio_service.h

Issue 2605983002: Simplify logic behind chrome.audio.setActiveDevices (Closed)
Patch Set: . Created 3 years, 11 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 EXTENSIONS_BROWSER_API_AUDIO_AUDIO_SERVICE_H_ 5 #ifndef EXTENSIONS_BROWSER_API_AUDIO_AUDIO_SERVICE_H_
6 #define EXTENSIONS_BROWSER_API_AUDIO_AUDIO_SERVICE_H_ 6 #define EXTENSIONS_BROWSER_API_AUDIO_AUDIO_SERVICE_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "extensions/common/api/audio.h" 14 #include "extensions/common/api/audio.h"
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 using OutputInfo = std::vector<api::audio::OutputDeviceInfo>; 18 using OutputInfo = std::vector<api::audio::OutputDeviceInfo>;
(...skipping 30 matching lines...) Expand all
48 // Called by listeners to this service to add/remove themselves as observers. 49 // Called by listeners to this service to add/remove themselves as observers.
49 virtual void AddObserver(Observer* observer) = 0; 50 virtual void AddObserver(Observer* observer) = 0;
50 virtual void RemoveObserver(Observer* observer) = 0; 51 virtual void RemoveObserver(Observer* observer) = 0;
51 52
52 // Start to query audio device information. Should be called on UI thread. 53 // Start to query audio device information. Should be called on UI thread.
53 // Populates |output_info_out| and |input_info_out| with the results. 54 // Populates |output_info_out| and |input_info_out| with the results.
54 // Returns true on success. 55 // Returns true on success.
55 virtual bool GetInfo(OutputInfo* output_info_out, 56 virtual bool GetInfo(OutputInfo* output_info_out,
56 InputInfo* input_info_out) = 0; 57 InputInfo* input_info_out) = 0;
57 58
59 virtual bool SetActiveDeviceLists(
60 const std::unique_ptr<DeviceIdList>& input_devices,
61 const std::unique_ptr<DeviceIdList>& output_devives) = 0;
jennyz 2017/01/07 00:33:00 Please add some comments about the new function.
tbarzic 2017/01/07 05:16:31 Done.
62
58 // Sets the active devices to the devices specified by |device_list|. 63 // Sets the active devices to the devices specified by |device_list|.
59 // It can pass in the "complete" active device list of either input 64 // It can pass in the "complete" active device list of either input
60 // devices, or output devices, or both. If only input devices are passed in, 65 // devices, or output devices, or both. If only input devices are passed in,
61 // it will only change the input devices' active status, output devices will 66 // it will only change the input devices' active status, output devices will
62 // NOT be changed; similarly for the case if only output devices are passed. 67 // NOT be changed; similarly for the case if only output devices are passed.
63 // If the devices specified in |new_active_ids| are already active, they will 68 // If the devices specified in |new_active_ids| are already active, they will
64 // remain active. Otherwise, the old active devices will be de-activated 69 // remain active. Otherwise, the old active devices will be de-activated
65 // before we activate the new devices with the same type(input/output). 70 // before we activate the new devices with the same type(input/output).
66 virtual void SetActiveDevices(const DeviceIdList& device_list) = 0; 71 virtual void SetActiveDevices(const DeviceIdList& device_list) = 0;
67 72
68 // Set the muted and volume/gain properties of a device. 73 // Set the muted and volume/gain properties of a device.
69 virtual bool SetDeviceProperties(const std::string& device_id, 74 virtual bool SetDeviceProperties(const std::string& device_id,
70 bool muted, 75 bool muted,
71 int volume, 76 int volume,
72 int gain) = 0; 77 int gain) = 0;
73 78
74 protected: 79 protected:
75 AudioService() {} 80 AudioService() {}
76 81
77 private: 82 private:
78 DISALLOW_COPY_AND_ASSIGN(AudioService); 83 DISALLOW_COPY_AND_ASSIGN(AudioService);
79 }; 84 };
80 85
81 } // namespace extensions 86 } // namespace extensions
82 87
83 #endif // EXTENSIONS_BROWSER_API_AUDIO_AUDIO_SERVICE_H_ 88 #endif // EXTENSIONS_BROWSER_API_AUDIO_AUDIO_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698