#include "chrome/browser/media/webrtc/chrome_camera_pan_tilt_zoom_permission_context_delegate.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "url/origin.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/compiler_specific.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS) && BUILDFLAG(IS_CHROMEOS_ASH)
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/kiosk/kiosk_delegate.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
#endif
ChromeCameraPanTiltZoomPermissionContextDelegate::
ChromeCameraPanTiltZoomPermissionContextDelegate(
content::BrowserContext* browser_context)
: … { … }
ChromeCameraPanTiltZoomPermissionContextDelegate::
~ChromeCameraPanTiltZoomPermissionContextDelegate() = default;
bool ChromeCameraPanTiltZoomPermissionContextDelegate::
GetPermissionStatusInternal(const GURL& requesting_origin,
const GURL& embedding_origin,
ContentSetting* content_setting_result) { … }
#if BUILDFLAG(ENABLE_EXTENSIONS) && BUILDFLAG(IS_CHROMEOS_ASH)
bool ChromeCameraPanTiltZoomPermissionContextDelegate::
IsPermissionGrantedForExtension(const GURL& origin) const {
const extensions::Extension* extension =
extensions::ExtensionRegistry::Get(browser_context_)
->enabled_extensions()
.GetExtensionOrAppByURL(origin);
extensions::KioskDelegate* const kiosk_delegate =
extensions::ExtensionsBrowserClient::Get()->GetKioskDelegate();
DCHECK(kiosk_delegate);
if (!extension ||
!extension->permissions_data()->HasAPIPermission(
extensions::mojom::APIPermissionID::kVideoCapture) ||
!kiosk_delegate->IsAutoLaunchedKioskApp(extension->id())) {
return false;
}
return true;
}
#endif