1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/*
* Copyright (C) 2014 Igalia S.L.
* Copyright (C) 2016 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UserMediaPermissionRequestManager_h
#define UserMediaPermissionRequestManager_h
#if ENABLE(MEDIA_STREAM)
#include "MediaDeviceSandboxExtensions.h"
#include "SandboxExtension.h"
#include <WebCore/MediaCanStartListener.h>
#include <WebCore/MediaConstraints.h>
#include <WebCore/MediaDevicesEnumerationRequest.h>
#include <WebCore/UserMediaClient.h>
#include <WebCore/UserMediaRequest.h>
#include <wtf/HashMap.h>
#include <wtf/Ref.h>
#include <wtf/RefPtr.h>
namespace WebKit {
class WebPage;
class UserMediaPermissionRequestManager
: private WebCore::MediaCanStartListener {
public:
explicit UserMediaPermissionRequestManager(WebPage&);
~UserMediaPermissionRequestManager();
void startUserMediaRequest(WebCore::UserMediaRequest&);
void cancelUserMediaRequest(WebCore::UserMediaRequest&);
void userMediaAccessWasGranted(uint64_t, String&& audioDeviceUID, String&& videoDeviceUID, String&& deviceIdentifierHashSalt);
void userMediaAccessWasDenied(uint64_t, WebCore::UserMediaRequest::MediaAccessDenialReason, String&&);
void enumerateMediaDevices(WebCore::MediaDevicesEnumerationRequest&);
void cancelMediaDevicesEnumeration(WebCore::MediaDevicesEnumerationRequest&);
void didCompleteMediaDeviceEnumeration(uint64_t, const Vector<WebCore::CaptureDevice>& deviceList, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
void grantUserMediaDeviceSandboxExtensions(const MediaDeviceSandboxExtensions&);
void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
private:
void sendUserMediaRequest(WebCore::UserMediaRequest&);
// WebCore::MediaCanStartListener
void mediaCanStart(WebCore::Document&) override;
void removeMediaRequestFromMaps(WebCore::UserMediaRequest&);
WebPage& m_page;
HashMap<uint64_t, RefPtr<WebCore::UserMediaRequest>> m_idToUserMediaRequestMap;
HashMap<RefPtr<WebCore::UserMediaRequest>, uint64_t> m_userMediaRequestToIDMap;
HashMap<uint64_t, RefPtr<WebCore::MediaDevicesEnumerationRequest>> m_idToMediaDevicesEnumerationRequestMap;
HashMap<RefPtr<WebCore::MediaDevicesEnumerationRequest>, uint64_t> m_mediaDevicesEnumerationRequestToIDMap;
HashMap<String, RefPtr<SandboxExtension>> m_userMediaDeviceSandboxExtensions;
HashMap<RefPtr<WebCore::Document>, Vector<RefPtr<WebCore::UserMediaRequest>>> m_blockedRequests;
};
} // namespace WebKit
#endif // ENABLE(MEDIA_STREAM)
#endif // UserMediaPermissionRequestManager_h
|