зеркало из https://github.com/mozilla/gecko-dev.git
Bug 926289 - Part 1, Add recording type and request URL in recording-device-events. r=khuey.
This commit is contained in:
Родитель
8cf2d39cf8
Коммит
11cc7925bf
|
@ -310,6 +310,8 @@ public:
|
|||
*/
|
||||
void ApplySandboxFlags(uint32_t sandboxFlags);
|
||||
|
||||
void GetURL(nsString& aURL);
|
||||
|
||||
private:
|
||||
|
||||
void SetOwnerContent(mozilla::dom::Element* aContent);
|
||||
|
@ -358,7 +360,6 @@ private:
|
|||
*/
|
||||
nsresult MaybeCreateDocShell();
|
||||
nsresult EnsureMessageManager();
|
||||
NS_HIDDEN_(void) GetURL(nsString& aURL);
|
||||
|
||||
// Properly retrieves documentSize of any subdocument type.
|
||||
nsresult GetWindowDimensions(nsRect& aRect);
|
||||
|
|
|
@ -4588,15 +4588,9 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
|||
errorPageUrl.AppendASCII(escapedDescription.get());
|
||||
|
||||
// Append the manifest URL if the error comes from an app.
|
||||
uint32_t appId;
|
||||
nsresult rv = GetAppId(&appId);
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
nsAutoString manifestURL;
|
||||
appsService->GetManifestURLByLocalId(appId, manifestURL);
|
||||
nsString manifestURL;
|
||||
nsresult rv = GetAppManifestURL(manifestURL);
|
||||
if (manifestURL.Length() > 0) {
|
||||
nsCString manifestParam;
|
||||
SAFE_ESCAPE(manifestParam,
|
||||
NS_ConvertUTF16toUTF8(manifestURL).get(),
|
||||
|
@ -12741,6 +12735,25 @@ nsDocShell::GetAppId(uint32_t* aAppId)
|
|||
return parent->GetAppId(aAppId);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAppManifestURL(nsAString& aAppManifestURL)
|
||||
{
|
||||
uint32_t appId;
|
||||
GetAppId(&appId);
|
||||
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
appsService->GetManifestURLByLocalId(appId, aAppManifestURL);
|
||||
} else {
|
||||
aAppManifestURL.SetLength(0);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ interface nsIReflowObserver;
|
|||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(4c8cd9da-4e93-42ed-9901-3781e90458d9)]
|
||||
[scriptable, builtinclass, uuid(1470A132-99B2-44C3-B37D-D8093B2E29BF)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
|
@ -742,6 +742,13 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
*/
|
||||
[infallible] readonly attribute unsigned long appId;
|
||||
|
||||
/**
|
||||
* Return the manifest URL of the app associated with this docshell.
|
||||
*
|
||||
* If there is no associated app in our hierarchy, we return empty string.
|
||||
*/
|
||||
readonly attribute DOMString appManifestURL;
|
||||
|
||||
/**
|
||||
* Like nsIDocShellTreeItem::GetSameTypeParent, except this ignores <iframe
|
||||
* mozbrowser> and <iframe mozapp> boundaries.
|
||||
|
|
|
@ -1935,23 +1935,6 @@ ContentParent::RecvBroadcastVolume(const nsString& aVolumeName)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
// recording-device-ipc-events needs to gather more information from content process
|
||||
nsRefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
|
||||
props->SetPropertyAsUint64(NS_LITERAL_STRING("childID"), mChildID);
|
||||
obs->NotifyObservers((nsIPropertyBag2*) props,
|
||||
"recording-device-ipc-events",
|
||||
aRecordingStatus.get());
|
||||
} else {
|
||||
NS_WARNING("Could not get the Observer service for ContentParent::RecvRecordingDeviceEvents.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::SendNuwaFork()
|
||||
{
|
||||
|
|
|
@ -164,6 +164,8 @@ public:
|
|||
void KillHard();
|
||||
|
||||
uint64_t ChildID() { return mChildID; }
|
||||
const nsString& AppManifestURL() const { return mAppManifestURL; }
|
||||
|
||||
bool IsPreallocated();
|
||||
|
||||
/**
|
||||
|
@ -471,8 +473,6 @@ private:
|
|||
|
||||
virtual bool RecvBroadcastVolume(const nsString& aVolumeName);
|
||||
|
||||
virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus);
|
||||
|
||||
virtual bool RecvSystemMessageHandled() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvNuwaReady() MOZ_OVERRIDE;
|
||||
|
|
|
@ -304,6 +304,14 @@ parent:
|
|||
*/
|
||||
UpdateScrollOffset(uint32_t aPresShellId, ViewID aViewId, CSSIntPoint aScrollOffset);
|
||||
|
||||
/**
|
||||
* Notifies the parent about a recording device is starting or shutdown.
|
||||
* @param recordingStatus starting or shutdown
|
||||
* @param isAudio recording start with microphone
|
||||
* @param isVideo recording start with camera
|
||||
*/
|
||||
async RecordingDeviceEvents(nsString recordingStatus, bool isAudio, bool isVideo);
|
||||
|
||||
__delete__();
|
||||
|
||||
child:
|
||||
|
|
|
@ -465,8 +465,6 @@ parent:
|
|||
// get nsIVolumeService to broadcast volume information
|
||||
async BroadcastVolume(nsString volumeName);
|
||||
|
||||
async RecordingDeviceEvents(nsString recordingStatus);
|
||||
|
||||
// Notify the parent that the child has finished handling a system message.
|
||||
async SystemMessageHandled();
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsHashPropertyBag.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
|
@ -1625,5 +1626,39 @@ TabParent::RecvContentReceivedTouch(const bool& aPreventDefault)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
|
||||
const bool& aIsAudio,
|
||||
const bool& aIsVideo)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
// recording-device-ipc-events needs to gather more information from content process
|
||||
nsRefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
|
||||
props->SetPropertyAsUint64(NS_LITERAL_STRING("childID"), Manager()->ChildID());
|
||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isApp"), Manager()->IsForApp());
|
||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isAudio"), aIsAudio);
|
||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isVideo"), aIsVideo);
|
||||
|
||||
nsString requestURL;
|
||||
if (Manager()->IsForApp()) {
|
||||
requestURL = Manager()->AppManifestURL();
|
||||
} else {
|
||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
||||
NS_ENSURE_TRUE(frameLoader, true);
|
||||
|
||||
frameLoader->GetURL(requestURL);
|
||||
}
|
||||
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), requestURL);
|
||||
|
||||
obs->NotifyObservers((nsIPropertyBag2*) props,
|
||||
"recording-device-ipc-events",
|
||||
aRecordingStatus.get());
|
||||
} else {
|
||||
NS_WARNING("Could not get the Observer service for ContentParent::RecvRecordingDeviceEvents.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace tabs
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -162,6 +162,9 @@ public:
|
|||
const CSSToScreenScale& aMaxZoom);
|
||||
virtual bool RecvUpdateScrollOffset(const uint32_t& aPresShellId, const ViewID& aViewId, const CSSIntPoint& aScrollOffset);
|
||||
virtual bool RecvContentReceivedTouch(const bool& aPreventDefault);
|
||||
virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
|
||||
const bool& aIsAudio,
|
||||
const bool& aIsVideo);
|
||||
virtual PContentDialogParent* AllocPContentDialogParent(const uint32_t& aType,
|
||||
const nsCString& aName,
|
||||
const nsCString& aFeatures,
|
||||
|
|
Загрузка…
Ссылка в новой задаче