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

Side by Side Diff: chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h

Issue 2784563003: WebRTC Audio private API: removing WebRtcAudioPrivate(Set/Get)ActiveSinkFunction (Closed)
Patch Set: fix for webrtc_audio_private_browsertest Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_ API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_ API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_ API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVATE_ API_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 virtual void OnOutputDeviceDescriptions( 63 virtual void OnOutputDeviceDescriptions(
64 std::unique_ptr<media::AudioDeviceDescriptions> device_descriptions); 64 std::unique_ptr<media::AudioDeviceDescriptions> device_descriptions);
65 65
66 // Retrieve the list of AudioOutputController objects. Calls back 66 // Retrieve the list of AudioOutputController objects. Calls back
67 // via OnControllerList. 67 // via OnControllerList.
68 // 68 //
69 // Returns false on error, in which case it has set |error_| and the 69 // Returns false on error, in which case it has set |error_| and the
70 // entire function should fail. 70 // entire function should fail.
71 // 71 //
72 // Call from any thread. Callback will occur on originating thread. 72 // Call from any thread. Callback will occur on originating thread.
73 bool GetControllerList(const api::webrtc_audio_private::RequestInfo& request); 73 bool GetControllerList(const api::webrtc_audio_private::RequestInfo& request);
Max Morin 2017/03/31 07:04:20 remove?
o1ka 2017/03/31 09:15:28 Done.
74 74
75 // Must override this if you call GetControllerList.
76 virtual void OnControllerList(
77 const content::RenderProcessHost::AudioOutputControllerList& list);
78
79 // Calculates a single HMAC. Call from any thread. Calls back via 75 // Calculates a single HMAC. Call from any thread. Calls back via
80 // OnHMACCalculated on UI thread. 76 // OnHMACCalculated on UI thread.
81 // 77 //
82 // This function, and device ID HMACs in this API in general use the 78 // This function, and device ID HMACs in this API in general use the
83 // calling extension's ID as the security origin. The only exception 79 // calling extension's ID as the security origin. The only exception
84 // to this rule is when calculating the input device ID HMAC in 80 // to this rule is when calculating the input device ID HMAC in
85 // getAssociatedSink, where we use the provided |securityOrigin|. 81 // getAssociatedSink, where we use the provided |securityOrigin|.
86 void CalculateHMAC(const std::string& raw_id); 82 void CalculateHMAC(const std::string& raw_id);
87 83
88 // Must override this if you call CalculateHMAC. 84 // Must override this if you call CalculateHMAC.
(...skipping 29 matching lines...) Expand all
118 // Sequence of events is that we query the list of sinks on the 114 // Sequence of events is that we query the list of sinks on the
119 // AudioManager's thread, then calculate HMACs on the IO thread, 115 // AudioManager's thread, then calculate HMACs on the IO thread,
120 // then finish on the UI thread. 116 // then finish on the UI thread.
121 bool RunAsync() override; 117 bool RunAsync() override;
122 void DoQuery(); 118 void DoQuery();
123 void OnOutputDeviceDescriptions( 119 void OnOutputDeviceDescriptions(
124 std::unique_ptr<media::AudioDeviceDescriptions> raw_ids) override; 120 std::unique_ptr<media::AudioDeviceDescriptions> raw_ids) override;
125 void DoneOnUIThread(); 121 void DoneOnUIThread();
126 }; 122 };
127 123
128 class WebrtcAudioPrivateGetActiveSinkFunction
129 : public WebrtcAudioPrivateFunction {
130 protected:
131 ~WebrtcAudioPrivateGetActiveSinkFunction() override {}
132
133 private:
134 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getActiveSink",
135 WEBRTC_AUDIO_PRIVATE_GET_ACTIVE_SINK);
136
137 bool RunAsync() override;
138 void OnControllerList(
139 const content::RenderProcessHost::AudioOutputControllerList& controllers)
140 override;
141 void OnHMACCalculated(const std::string& hmac) override;
142 };
143
144 class WebrtcAudioPrivateSetActiveSinkFunction
145 : public WebrtcAudioPrivateFunction {
146 public:
147 WebrtcAudioPrivateSetActiveSinkFunction();
148
149 protected:
150 ~WebrtcAudioPrivateSetActiveSinkFunction() override;
151
152 private:
153 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.setActiveSink",
154 WEBRTC_AUDIO_PRIVATE_SET_ACTIVE_SINK);
155
156 bool RunAsync() override;
157 void OnControllerList(
158 const content::RenderProcessHost::AudioOutputControllerList& controllers)
159 override;
160 void OnOutputDeviceDescriptions(
161 std::unique_ptr<media::AudioDeviceDescriptions> device_descriptions)
162 override;
163 void SwitchDone();
164 void DoneOnUIThread();
165
166 api::webrtc_audio_private::RequestInfo request_info_;
167 std::string sink_id_;
168
169 // Filled in by OnControllerList.
170 content::RenderProcessHost::AudioOutputControllerList controllers_;
171
172 // Number of sink IDs we are still waiting for. Can become greater
173 // than 0 in OnControllerList, decreases on every OnSinkId call.
174 size_t num_remaining_sink_ids_;
175 };
176
177 class WebrtcAudioPrivateGetAssociatedSinkFunction 124 class WebrtcAudioPrivateGetAssociatedSinkFunction
178 : public WebrtcAudioPrivateFunction { 125 : public WebrtcAudioPrivateFunction {
179 public: 126 public:
180 WebrtcAudioPrivateGetAssociatedSinkFunction(); 127 WebrtcAudioPrivateGetAssociatedSinkFunction();
181 128
182 protected: 129 protected:
183 ~WebrtcAudioPrivateGetAssociatedSinkFunction() override; 130 ~WebrtcAudioPrivateGetAssociatedSinkFunction() override;
184 131
185 private: 132 private:
186 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getAssociatedSink", 133 DECLARE_EXTENSION_FUNCTION("webrtcAudioPrivate.getAssociatedSink",
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // time, no locking needed. 170 // time, no locking needed.
224 std::unique_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_; 171 std::unique_ptr<api::webrtc_audio_private::GetAssociatedSink::Params> params_;
225 172
226 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread. 173 // Audio sources (input devices). Filled in by DoWorkOnDeviceThread.
227 media::AudioDeviceDescriptions source_devices_; 174 media::AudioDeviceDescriptions source_devices_;
228 }; 175 };
229 176
230 } // namespace extensions 177 } // namespace extensions
231 178
232 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA TE_API_H_ 179 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBRTC_AUDIO_PRIVATE_WEBRTC_AUDIO_PRIVA TE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698