#include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "components/media_device_salt/media_device_salt_service.h"
#include "content/public/browser/audio_service.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/media_device_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
#include "media/audio/audio_system.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace extensions {
BrowserThread;
wap;
static base::LazyInstance<BrowserContextKeyedAPIFactory<
WebrtcAudioPrivateEventService>>::DestructorAtExit
g_webrtc_audio_private_api_factory = …;
WebrtcAudioPrivateEventService::WebrtcAudioPrivateEventService(
content::BrowserContext* context)
: … { … }
WebrtcAudioPrivateEventService::~WebrtcAudioPrivateEventService() { … }
void WebrtcAudioPrivateEventService::Shutdown() { … }
BrowserContextKeyedAPIFactory<WebrtcAudioPrivateEventService>*
WebrtcAudioPrivateEventService::GetFactoryInstance() { … }
const char* WebrtcAudioPrivateEventService::service_name() { … }
void WebrtcAudioPrivateEventService::OnDevicesChanged(
base::SystemMonitor::DeviceType device_type) { … }
void WebrtcAudioPrivateEventService::SignalEvent() { … }
WebrtcAudioPrivateFunction::WebrtcAudioPrivateFunction() { … }
WebrtcAudioPrivateFunction::~WebrtcAudioPrivateFunction() { … }
url::Origin WebrtcAudioPrivateFunction::GetExtensionOrigin() const { … }
std::string WebrtcAudioPrivateFunction::CalculateHMAC(
const std::string& extension_salt,
const std::string& raw_id) { … }
void WebrtcAudioPrivateFunction::GetSalt(
const url::Origin& origin,
base::OnceCallback<void(const std::string&)> salt_callback) { … }
void WebrtcAudioPrivateFunction::GetSaltAndDeviceDescriptions(
const url::Origin& origin,
bool is_input_devices,
SaltAndDeviceDescriptionsCallback callback) { … }
void WebrtcAudioPrivateFunction::GotSaltForDeviceDescriptions(
bool is_input_devices,
SaltAndDeviceDescriptionsCallback callback,
const std::string& device_id_salt) { … }
media::AudioSystem* WebrtcAudioPrivateFunction::GetAudioSystem() { … }
ExtensionFunction::ResponseAction WebrtcAudioPrivateGetSinksFunction::Run() { … }
void WebrtcAudioPrivateGetSinksFunction::ReceiveOutputDeviceDescriptions(
const std::string& extension_salt,
media::AudioDeviceDescriptions sink_devices) { … }
WebrtcAudioPrivateGetAssociatedSinkFunction::
WebrtcAudioPrivateGetAssociatedSinkFunction() = default;
WebrtcAudioPrivateGetAssociatedSinkFunction::
~WebrtcAudioPrivateGetAssociatedSinkFunction() = default;
ExtensionFunction::ResponseAction
WebrtcAudioPrivateGetAssociatedSinkFunction::Run() { … }
void WebrtcAudioPrivateGetAssociatedSinkFunction::
ReceiveInputDeviceDescriptions(
const url::Origin& origin,
const std::string& salt,
media::AudioDeviceDescriptions source_devices) { … }
void WebrtcAudioPrivateGetAssociatedSinkFunction::GotExtensionSalt(
const std::string& raw_source_id,
const std::string& extension_salt) { … }
void WebrtcAudioPrivateGetAssociatedSinkFunction::CalculateHMACAndReply(
const std::string& extension_salt,
const std::optional<std::string>& raw_sink_id) { … }
void WebrtcAudioPrivateGetAssociatedSinkFunction::Reply(
const std::string& associated_sink_id) { … }
}