#include "components/webrtc/media_stream_devices_controller.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "components/permissions/permission_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/permission_result.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom-shared.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom.h"
#if BUILDFLAG(IS_ANDROID)
#include "components/permissions/android/android_permission_util.h"
#include "ui/android/window_android.h"
#endif
MediaStreamDevices;
namespace webrtc {
namespace {
bool PermissionIsRequested(blink::PermissionType permission,
const content::MediaStreamRequest& request) { … }
}
void MediaStreamDevicesController::RequestPermissions(
const content::MediaStreamRequest& request,
MediaStreamDeviceEnumerator* enumerator,
ResultCallback callback) { … }
MediaStreamDevicesController::~MediaStreamDevicesController() { … }
MediaStreamDevicesController::MediaStreamDevicesController(
content::WebContents* web_contents,
MediaStreamDeviceEnumerator* enumerator,
const content::MediaStreamRequest& request,
ResultCallback callback)
: … { … }
bool MediaStreamDevicesController::ShouldRequestAudio() const { … }
bool MediaStreamDevicesController::ShouldRequestVideo() const { … }
blink::mojom::StreamDevicesSetPtr MediaStreamDevicesController::GetDevices(
ContentSetting audio_setting,
ContentSetting video_setting) { … }
void MediaStreamDevicesController::RunCallback(
bool blocked_by_permissions_policy) { … }
ContentSetting MediaStreamDevicesController::GetContentSetting(
blink::PermissionType permission,
const content::MediaStreamRequest& request,
blink::mojom::MediaStreamRequestResult* denial_reason) const { … }
bool MediaStreamDevicesController::IsUserAcceptAllowed(
blink::PermissionType permission) const { … }
bool MediaStreamDevicesController::PermissionIsBlockedForReason(
blink::PermissionType permission,
content::PermissionStatusSource reason) const { … }
void MediaStreamDevicesController::PromptAnsweredGroupedRequest(
const std::vector<blink::mojom::PermissionStatus>& permissions_status) { … }
bool MediaStreamDevicesController::HasAvailableDevices(
blink::PermissionType permission,
const std::vector<std::string>& device_ids) const { … }
}