Bug 1057006: split window and app sharing reports so the UI can handle them separately, r=jib.

This commit is contained in:
Randell Jesup 2014-08-25 11:01:19 -04:00
parent 5babadf2b2
commit 5a13efae80
3 changed files with 16 additions and 11 deletions

View File

@ -2095,20 +2095,22 @@ MediaManager::GetActiveMediaCaptureWindows(nsISupportsArray **aArray)
NS_IMETHODIMP
MediaManager::MediaCaptureWindowState(nsIDOMWindow* aWindow, bool* aVideo,
bool* aAudio, bool *aScreenShare,
bool* aWindowShare)
bool* aWindowShare, bool *aAppShare)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
*aVideo = false;
*aAudio = false;
*aScreenShare = false;
*aWindowShare = false;
*aAppShare = false;
nsresult rv = MediaCaptureWindowStateInternal(aWindow, aVideo, aAudio, aScreenShare, aWindowShare);
nsresult rv = MediaCaptureWindowStateInternal(aWindow, aVideo, aAudio, aScreenShare, aWindowShare, aAppShare);
#ifdef DEBUG
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
LOG(("%s: window %lld capturing %s %s %s %s", __FUNCTION__, piWin ? piWin->WindowID() : -1,
LOG(("%s: window %lld capturing %s %s %s %s %s", __FUNCTION__, piWin ? piWin->WindowID() : -1,
*aVideo ? "video" : "", *aAudio ? "audio" : "",
*aScreenShare ? "screenshare" : "", *aWindowShare ? "windowshare" : ""));
*aScreenShare ? "screenshare" : "", *aWindowShare ? "windowshare" : "",
*aAppShare ? "appshare" : ""));
#endif
return rv;
}
@ -2116,7 +2118,7 @@ MediaManager::MediaCaptureWindowState(nsIDOMWindow* aWindow, bool* aVideo,
nsresult
MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVideo,
bool* aAudio, bool *aScreenShare,
bool* aWindowShare)
bool* aWindowShare, bool *aAppShare)
{
// We need to return the union of all streams in all innerwindows that
// correspond to that outerwindow.
@ -2148,10 +2150,12 @@ MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVide
if (listener->CapturingScreen()) {
*aScreenShare = true;
}
if (listener->CapturingWindow() || listener->CapturingApplication()) {
// treat window and application as the same
if (listener->CapturingWindow()) {
*aWindowShare = true;
}
if (listener->CapturingApplication()) {
*aAppShare = true;
}
}
}
}
@ -2166,7 +2170,7 @@ MediaManager::MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVide
docShell->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsPIDOMWindow> win = item ? item->GetWindow() : nullptr;
MediaCaptureWindowStateInternal(win, aVideo, aAudio, aScreenShare, aWindowShare);
MediaCaptureWindowStateInternal(win, aVideo, aAudio, aScreenShare, aWindowShare, aAppShare);
}
}
}

View File

@ -605,7 +605,7 @@ private:
nsresult MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVideo,
bool* aAudio, bool *aScreenShare,
bool* aWindowShare);
bool* aWindowShare, bool *aAppShare);
void StopScreensharing(uint64_t aWindowID);
void StopScreensharing(nsPIDOMWindow *aWindow);

View File

@ -12,7 +12,7 @@ interface nsIDOMWindow;
#define MEDIAMANAGERSERVICE_CONTRACTID "@mozilla.org/mediaManagerService;1"
%}
[scriptable, builtinclass, uuid(f431b523-4536-4ba7-a2c1-7e1bf670d32a)]
[scriptable, builtinclass, uuid(2ab0e6f7-9a5b-4b9a-901d-145531f47a6b)]
interface nsIMediaManagerService : nsISupports
{
/* return a array of inner windows that have active captures */
@ -20,5 +20,6 @@ interface nsIMediaManagerService : nsISupports
/* Get the capture state for the given window and all descendant windows (iframes, etc) */
void mediaCaptureWindowState(in nsIDOMWindow aWindow, out boolean aVideo, out boolean aAudio,
[optional] out boolean aScreenShare, [optional] out boolean aWindowShare);
[optional] out boolean aScreenShare, [optional] out boolean aWindowShare,
[optional] out boolean aAppShare);
};