Bridged passing lists of devices between the UIProcess and the WebProcess
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Jul 2015 22:15:22 +0000 (22:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Jul 2015 22:15:22 +0000 (22:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147056
<rdar://problem/21883094>

Patch by Matthew Daiter <mdaiter@apple.com> on 2015-07-23
Reviewed by Brent Fulgham.

Source/WebCore:

* Modules/mediastream/UserMediaRequest.h: Added fields to store and
retrieve lists of devices
(WebCore::UserMediaRequest::deviceUIDsVideo):
(WebCore::UserMediaRequest::deviceUIDsAudio):

Source/WebKit2:

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Modified file
to reflect changes made to the header in the .messages.in file
(WebKit::UserMediaPermissionRequestManagerProxy::createRequest): Ditto
(WebKit::UserMediaPermissionRequestManagerProxy::didReceiveUserMediaPermissionDecision):
* UIProcess/UserMediaPermissionRequestManagerProxy.h: Ditto
* UIProcess/UserMediaPermissionRequestProxy.cpp: Ditto
(WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::create):
(WebKit::UserMediaPermissionRequestProxy::deviceUIDsVideo):
(WebKit::UserMediaPermissionRequestProxy::deviceUIDsAudio):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: Changed heading
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::startRequest):
(WebKit::UserMediaPermissionRequestManager::didReceiveUserMediaPermissionDecision):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didReceiveUserMediaPermissionDecision):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Changed heading

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187258 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/UserMediaRequest.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.h
Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.cpp
Source/WebKit2/UIProcess/UserMediaPermissionRequestProxy.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index a202672..a804086 100644 (file)
@@ -1,3 +1,16 @@
+2015-07-23  Matthew Daiter  <mdaiter@apple.com>
+
+        Bridged passing lists of devices between the UIProcess and the WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=147056
+        <rdar://problem/21883094>
+
+        Reviewed by Brent Fulgham.
+
+        * Modules/mediastream/UserMediaRequest.h: Added fields to store and
+        retrieve lists of devices
+        (WebCore::UserMediaRequest::deviceUIDsVideo):
+        (WebCore::UserMediaRequest::deviceUIDsAudio):
+
 2015-07-19  Matt Rajca  <mrajca@apple.com>
 
         Media Session: add support for ducking media elements
index 099e14f..bcbce08 100644 (file)
@@ -73,6 +73,8 @@ public:
     const Vector<String>& videoDeviceUIDs() const { return m_videoDeviceUIDs; }
     const Vector<String>& audioDeviceUIDs() const { return m_audioDeviceUIDs; }
 
+    const Vector<String>& deviceUIDsVideo() const { return m_deviceUIDsVideo; }
+    const Vector<String>& deviceUIDsAudio() const { return m_deviceUIDsAudio; }
 private:
     UserMediaRequest(ScriptExecutionContext*, UserMediaController*, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints, MediaDevices::Promise&&);
 
@@ -88,6 +90,9 @@ private:
     
     RefPtr<MediaConstraints> m_audioConstraints;
     RefPtr<MediaConstraints> m_videoConstraints;
+    
+    Vector<String> m_deviceUIDsVideo;
+    Vector<String> m_deviceUIDsAudio;
 
     Vector<String> m_videoDeviceUIDs;
     Vector<String> m_audioDeviceUIDs;
index 89990e1..c68f6d0 100644 (file)
@@ -1,3 +1,35 @@
+2015-07-23  Matthew Daiter  <mdaiter@apple.com>
+
+        Bridged passing lists of devices between the UIProcess and the WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=147056
+        <rdar://problem/21883094>
+
+        Reviewed by Brent Fulgham.
+
+        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Modified file
+        to reflect changes made to the header in the .messages.in file
+        (WebKit::UserMediaPermissionRequestManagerProxy::createRequest): Ditto
+        (WebKit::UserMediaPermissionRequestManagerProxy::didReceiveUserMediaPermissionDecision):
+        * UIProcess/UserMediaPermissionRequestManagerProxy.h: Ditto
+        * UIProcess/UserMediaPermissionRequestProxy.cpp: Ditto
+        (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
+        * UIProcess/UserMediaPermissionRequestProxy.h:
+        (WebKit::UserMediaPermissionRequestProxy::create):
+        (WebKit::UserMediaPermissionRequestProxy::deviceUIDsVideo):
+        (WebKit::UserMediaPermissionRequestProxy::deviceUIDsAudio):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in: Changed heading
+        * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
+        (WebKit::UserMediaPermissionRequestManager::startRequest):
+        (WebKit::UserMediaPermissionRequestManager::didReceiveUserMediaPermissionDecision):
+        * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didReceiveUserMediaPermissionDecision):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Changed heading
+
 2015-07-23  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         Adopt the new _previewItemControllerDidCancelPreview delegate method.
index f540c8e..5dc8b32 100644 (file)
@@ -38,9 +38,9 @@ void UserMediaPermissionRequestManagerProxy::invalidateRequests()
     m_pendingRequests.clear();
 }
 
-PassRefPtr<UserMediaPermissionRequestProxy> UserMediaPermissionRequestManagerProxy::createRequest(uint64_t userMediaID, bool requiresAudio, bool requiresVideo)
+PassRefPtr<UserMediaPermissionRequestProxy> UserMediaPermissionRequestManagerProxy::createRequest(uint64_t userMediaID, bool requiresAudio, bool requiresVideo, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio)
 {
-    RefPtr<UserMediaPermissionRequestProxy> request = UserMediaPermissionRequestProxy::create(*this, userMediaID, requiresAudio, requiresVideo);
+    RefPtr<UserMediaPermissionRequestProxy> request = UserMediaPermissionRequestProxy::create(*this, userMediaID, requiresAudio, requiresVideo, deviceUIDsVideo, deviceUIDsAudio);
     m_pendingRequests.add(userMediaID, request.get());
     return request.release();
 }
@@ -54,7 +54,8 @@ void UserMediaPermissionRequestManagerProxy::didReceiveUserMediaPermissionDecisi
         return;
 
 #if ENABLE(MEDIA_STREAM)
-    m_page.process().send(Messages::WebPage::DidReceiveUserMediaPermissionDecision(userMediaID, allowed), m_page.pageID());
+    // FIXME(147062): Need to add in the support for Safari to pass strings given from user's decision on what piece of media to open
+    m_page.process().send(Messages::WebPage::DidReceiveUserMediaPermissionDecision(userMediaID, allowed, "", ""), m_page.pageID());
 #else
     UNUSED_PARAM(allowed);
 #endif
index aa1713b..e03dcb8 100644 (file)
@@ -33,7 +33,7 @@ public:
     void invalidateRequests();
 
     // Create a request to be presented to the user.
-    PassRefPtr<UserMediaPermissionRequestProxy> createRequest(uint64_t userMediaID, bool audio, bool video);
+    PassRefPtr<UserMediaPermissionRequestProxy> createRequest(uint64_t userMediaID, bool audio, bool video, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio);
 
     // Called by UserMediaPermissionRequestProxy when a decision is made by the user.
     void didReceiveUserMediaPermissionDecision(uint64_t, bool allow);
index 6e18027..570c4d2 100644 (file)
 
 namespace WebKit {
 
-UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy(UserMediaPermissionRequestManagerProxy& manager, uint64_t userMediaID, bool requiresAudio, bool requiresVideo)
+UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy(UserMediaPermissionRequestManagerProxy& manager, uint64_t userMediaID, bool requiresAudio, bool requiresVideo, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio)
     : m_manager(manager)
     , m_userMediaID(userMediaID)
     , m_requiresAudio(requiresAudio)
     , m_requiresVideo(requiresVideo)
+    , m_deviceUIDsVideo(deviceUIDsVideo)
+    , m_deviceUIDsAudio(deviceUIDsAudio)
 {
 }
 
index 93d1cb9..b2d8811 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "APIObject.h"
 #include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebKit {
 
@@ -28,9 +30,9 @@ class UserMediaPermissionRequestManagerProxy;
 
 class UserMediaPermissionRequestProxy : public API::ObjectImpl<API::Object::Type::UserMediaPermissionRequest> {
 public:
-    static PassRefPtr<UserMediaPermissionRequestProxy> create(UserMediaPermissionRequestManagerProxy& manager, uint64_t userMediaID, bool requiresAudio, bool requiresVideo)
+    static PassRefPtr<UserMediaPermissionRequestProxy> create(UserMediaPermissionRequestManagerProxy& manager, uint64_t userMediaID, bool requiresAudio, bool requiresVideo, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio)
     {
-        return adoptRef(new UserMediaPermissionRequestProxy(manager, userMediaID, requiresAudio, requiresVideo));
+        return adoptRef(new UserMediaPermissionRequestProxy(manager, userMediaID, requiresAudio, requiresVideo, deviceUIDsVideo, deviceUIDsAudio));
     }
 
     void allow();
@@ -40,14 +42,19 @@ public:
 
     bool requiresAudio() const { return m_requiresAudio; }
     bool requiresVideo() const { return m_requiresVideo; }
+    
+    const Vector<String>& deviceUIDsVideo() const { return m_deviceUIDsVideo; }
+    const Vector<String>& deviceUIDsAudio() const { return m_deviceUIDsAudio; }
 
 private:
-    UserMediaPermissionRequestProxy(UserMediaPermissionRequestManagerProxy&, uint64_t userMediaID, bool requiresAudio, bool requiresVideo);
+    UserMediaPermissionRequestProxy(UserMediaPermissionRequestManagerProxy&, uint64_t userMediaID, bool requiresAudio, bool requiresVideo, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio);
 
     UserMediaPermissionRequestManagerProxy& m_manager;
     uint64_t m_userMediaID;
     bool m_requiresAudio;
     bool m_requiresVideo;
+    Vector<String> m_deviceUIDsVideo;
+    Vector<String> m_deviceUIDsAudio;
 };
 
 } // namespace WebKit
index 2e67321..b786006 100644 (file)
@@ -5313,13 +5313,13 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
     request->deny();
 }
 
-void WebPageProxy::requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video)
+void WebPageProxy::requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio)
 {
     WebFrameProxy* frame = m_process->webFrame(frameID);
     MESSAGE_CHECK(frame);
 
     RefPtr<API::SecurityOrigin> origin = API::SecurityOrigin::create(SecurityOrigin::createFromDatabaseIdentifier(originIdentifier));
-    RefPtr<UserMediaPermissionRequestProxy> request = m_userMediaPermissionRequestManager.createRequest(userMediaID, audio, video);
+    RefPtr<UserMediaPermissionRequestProxy> request = m_userMediaPermissionRequestManager.createRequest(userMediaID, audio, video, deviceUIDsVideo, deviceUIDsAudio);
 
     if (!m_uiClient->decidePolicyForUserMediaPermissionRequest(*this, *frame, *origin.get(), *request.get()))
         request->deny();
index c06648e..9d8e909 100644 (file)
@@ -1207,7 +1207,7 @@ private:
     void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply>);
     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
 
-    void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video);
+    void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video, const Vector<String>& deviceUIDsVideo, const Vector<String>& deviceUIDsAudio);
 
     void runModal();
     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
index 23c64df..c03db54 100644 (file)
@@ -267,7 +267,7 @@ messages -> WebPageProxy {
     
 #if ENABLE(MEDIA_STREAM)
     # MediaSteam messages
-    RequestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video)
+    RequestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video, Vector<String> deviceUIDsVideo, Vector<String> deviceUIDsAudio)
 #endif
 
     # Notification messages
index 10f3f99..9148d6c 100644 (file)
@@ -63,7 +63,7 @@ void UserMediaPermissionRequestManager::startRequest(UserMediaRequest& request)
     ASSERT(webFrame);
 
     SecurityOrigin* origin = request.securityOrigin();
-    m_page.send(Messages::WebPageProxy::RequestUserMediaPermissionForFrame(requestID, webFrame->frameID(), origin->databaseIdentifier(), request.requiresAudio(), request.requiresVideo()));
+    m_page.send(Messages::WebPageProxy::RequestUserMediaPermissionForFrame(requestID, webFrame->frameID(), origin->databaseIdentifier(), request.requiresAudio(), request.requiresVideo(), request.deviceUIDsVideo(), request.deviceUIDsAudio()));
 }
 
 void UserMediaPermissionRequestManager::cancelRequest(UserMediaRequest& request)
@@ -74,7 +74,7 @@ void UserMediaPermissionRequestManager::cancelRequest(UserMediaRequest& request)
     m_idToRequestMap.remove(requestID);
 }
 
-void UserMediaPermissionRequestManager::didReceiveUserMediaPermissionDecision(uint64_t requestID, bool allowed)
+void UserMediaPermissionRequestManager::didReceiveUserMediaPermissionDecision(uint64_t requestID, bool allowed, const String& deviceUIDVideo, const String& deviceUIDAudio)
 {
     RefPtr<UserMediaRequest> request = m_idToRequestMap.take(requestID);
     if (!request)
index 0c3b6e3..39176d2 100644 (file)
@@ -37,7 +37,7 @@ public:
     void startRequest(WebCore::UserMediaRequest&);
     void cancelRequest(WebCore::UserMediaRequest&);
 
-    void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
+    void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed, const String& deviceUIDVideo, const String& deviceUIDAudio);
 
 private:
     WebPage& m_page;
index e9ab646..c53eb9d 100644 (file)
@@ -3361,9 +3361,9 @@ void WebPage::didReceiveNotificationPermissionDecision(uint64_t notificationID,
 }
 
 #if ENABLE(MEDIA_STREAM)
-void WebPage::didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed)
+void WebPage::didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed, const String& deviceUIDVideo, const String& deviceUIDAudio)
 {
-    m_userMediaPermissionRequestManager.didReceiveUserMediaPermissionDecision(userMediaID, allowed);
+    m_userMediaPermissionRequestManager.didReceiveUserMediaPermissionDecision(userMediaID, allowed, deviceUIDVideo, deviceUIDAudio);
 }
 #endif
 
index f9960b7..eaa70e3 100644 (file)
@@ -1092,7 +1092,7 @@ private:
     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
 
 #if ENABLE(MEDIA_STREAM)
-    WK_EXPORT void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
+    WK_EXPORT void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed, const String& deviceUIDVideo, const String& deviceUIDAudio);
 #endif
 
     void advanceToNextMisspelling(bool startBeforeSelection);
index e56a0de..918e7de 100644 (file)
@@ -288,7 +288,7 @@ messages -> WebPage LegacyReceiver {
 
 #if ENABLE(MEDIA_STREAM)
     # MediaSteam
-    DidReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed)
+    DidReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed, String deviceUIDVideo, String deviceUIDAudio)
 #endif
 
     # Notification