#include "chrome/browser/controlled_frame/controlled_frame_media_access_handler.h"
#include "base/types/expected.h"
#include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/media_stream_request.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "extensions/browser/browser_frame_context_data.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-shared.h"
namespace controlled_frame {
namespace {
blink::mojom::PermissionsPolicyFeature
GetPermissionPolicyFeatureForMediaStreamType(
blink::mojom::MediaStreamType type) { … }
bool IsMediaStreamTypeSupported(blink::mojom::MediaStreamType type) { … }
}
ControlledFrameMediaAccessHandler::PendingMediaAccessRequestDetails::
PendingMediaAccessRequestDetails(const url::Origin& embedded_frame_origin,
blink::mojom::MediaStreamType type)
: … { … }
ControlledFrameMediaAccessHandler::ControlledFrameMediaAccessHandler() =
default;
ControlledFrameMediaAccessHandler::~ControlledFrameMediaAccessHandler() =
default;
bool ControlledFrameMediaAccessHandler::SupportsStreamType(
content::WebContents* web_contents,
const blink::mojom::MediaStreamType type,
const extensions::Extension* extension) { … }
bool ControlledFrameMediaAccessHandler::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type,
const extensions::Extension* extension) { … }
void ControlledFrameMediaAccessHandler::HandleRequest(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback,
const extensions::Extension* extension) { … }
bool ControlledFrameMediaAccessHandler::IsAllowedByPermissionsPolicy(
extensions::WebViewGuest* web_view,
const url::Origin& requesting_origin,
blink::mojom::MediaStreamType type) { … }
}