mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 780693 - IPC VolumeManager on Gonk. r=bent
This commit is contained in:
parent
b31db82fc3
commit
b394c88f97
@ -73,6 +73,10 @@
|
||||
#include "APKOpen.h"
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
#include "nsVolume.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <process.h>
|
||||
#define getpid _getpid
|
||||
@ -99,6 +103,9 @@ using namespace mozilla::ipc;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::net;
|
||||
using namespace mozilla::places;
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
using namespace mozilla::system;
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -212,10 +219,11 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
|
||||
ContentChild* ContentChild::sSingleton;
|
||||
|
||||
ContentChild::ContentChild()
|
||||
: mID(PRUint64(-1))
|
||||
:
|
||||
#ifdef ANDROID
|
||||
, mScreenSize(0, 0)
|
||||
mScreenSize(0, 0),
|
||||
#endif
|
||||
mID(PRUint64(-1))
|
||||
{
|
||||
// This process is a content process, so it's clearly running in
|
||||
// multiprocess mode!
|
||||
@ -941,5 +949,18 @@ ContentChild::RecvFilePathUpdate(const nsString& path, const nsCString& aReason)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvFileSystemUpdate(const nsString& aFsName, const nsString& aName, const PRInt32 &aState)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsRefPtr<nsVolume> volume = new nsVolume(aFsName, aName, aState);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
nsString stateStr(NS_ConvertUTF8toUTF16(volume->StateStr()));
|
||||
obs->NotifyObservers(volume, NS_VOLUME_STATE_CHANGED, stateStr.get());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -163,6 +163,7 @@ public:
|
||||
virtual bool RecvLastPrivateDocShellDestroyed();
|
||||
|
||||
virtual bool RecvFilePathUpdate(const nsString& path, const nsCString& reason);
|
||||
virtual bool RecvFileSystemUpdate(const nsString& aFsName, const nsString& aName, const PRInt32& aState);
|
||||
|
||||
#ifdef ANDROID
|
||||
gfxIntSize GetScreenSize() { return mScreenSize; }
|
||||
|
@ -96,6 +96,11 @@
|
||||
# include "AndroidBridge.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsIVolume.h"
|
||||
#include "nsIVolumeService.h"
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static const char* sClipboardTextFlavors[] = { kUnicodeMime };
|
||||
|
||||
@ -270,6 +275,9 @@ ContentParent::Init()
|
||||
obs->AddObserver(this, "child-gc-request", false);
|
||||
obs->AddObserver(this, "child-cc-request", false);
|
||||
obs->AddObserver(this, "last-pb-context-exited", false);
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
obs->AddObserver(this, NS_VOLUME_STATE_CHANGED, false);
|
||||
#endif
|
||||
#ifdef ACCESSIBILITY
|
||||
obs->AddObserver(this, "a11y-init-or-shutdown", false);
|
||||
#endif
|
||||
@ -431,6 +439,9 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-gc-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "child-cc-request");
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "last-pb-context-exited");
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), NS_VOLUME_STATE_CHANGED);
|
||||
#endif
|
||||
#ifdef ACCESSIBILITY
|
||||
obs->RemoveObserver(static_cast<nsIObserver*>(this), "a11y-init-or-shutdown");
|
||||
#endif
|
||||
@ -873,6 +884,24 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
else if (!strcmp(aTopic, "last-pb-context-exited")) {
|
||||
unused << SendLastPrivateDocShellDestroyed();
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
else if(!strcmp(aTopic, NS_VOLUME_STATE_CHANGED)) {
|
||||
nsCOMPtr<nsIVolume> vol = do_QueryInterface(aSubject);
|
||||
if (!vol) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsString volName;
|
||||
nsString mountPoint;
|
||||
PRInt32 state;
|
||||
|
||||
vol->GetName(volName);
|
||||
vol->GetMountPoint(mountPoint);
|
||||
vol->GetState(&state);
|
||||
|
||||
unused << SendFileSystemUpdate(volName, mountPoint, state);
|
||||
}
|
||||
#endif
|
||||
#ifdef ACCESSIBILITY
|
||||
// Make sure accessibility is running in content process when accessibility
|
||||
// gets initiated in chrome process.
|
||||
|
@ -206,6 +206,8 @@ child:
|
||||
|
||||
FilePathUpdate(nsString filepath, nsCString reasons);
|
||||
|
||||
FileSystemUpdate(nsString fsName, nsString mountPoint, PRInt32 fsState);
|
||||
|
||||
parent:
|
||||
PAudio(PRInt32 aNumChannels, PRInt32 aRate, PRInt32 aFormat);
|
||||
|
||||
|
@ -69,6 +69,7 @@ CPPSRCS += \
|
||||
$(NULL)
|
||||
# for our local copy of AudioSystem.h
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/media/libsydneyaudio/src
|
||||
EXPORTS = nsVolume.h
|
||||
endif
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsIVolume.h"
|
||||
#include "nsVolumeStat.h"
|
||||
#include "Volume.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace system {
|
||||
@ -30,6 +31,13 @@ NS_VolumeStateStr(PRInt32 aState)
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsVolume, nsIVolume)
|
||||
|
||||
nsVolume::nsVolume(const Volume *aVolume)
|
||||
: mName(NS_ConvertUTF8toUTF16(aVolume->Name())),
|
||||
mMountPoint(NS_ConvertUTF8toUTF16(aVolume->MountPoint())),
|
||||
mState(aVolume->State())
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsVolume::GetName(nsAString &aName)
|
||||
{
|
||||
aName = mName;
|
||||
|
@ -5,22 +5,24 @@
|
||||
#ifndef mozilla_system_nsvolume_h__
|
||||
#define mozilla_system_nsvolume_h__
|
||||
|
||||
#include "Volume.h"
|
||||
#include "nsIVolume.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace system {
|
||||
|
||||
class Volume;
|
||||
|
||||
class nsVolume : public nsIVolume
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIVOLUME
|
||||
|
||||
nsVolume(const Volume *aVolume)
|
||||
: mName(NS_ConvertUTF8toUTF16(aVolume->Name())),
|
||||
mMountPoint(NS_ConvertUTF8toUTF16(aVolume->MountPoint())),
|
||||
mState(aVolume->State())
|
||||
nsVolume(const Volume *aVolume);
|
||||
|
||||
nsVolume(const nsAString &aName, const nsAString &aMountPoint, const PRInt32 &aState)
|
||||
: mName(aName), mMountPoint(aMountPoint), mState(aState)
|
||||
{
|
||||
}
|
||||
|
||||
@ -50,8 +52,8 @@ public:
|
||||
const nsString &MountPoint() const { return mMountPoint; }
|
||||
const char *MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint).get(); }
|
||||
|
||||
long State() const { return mState; }
|
||||
const char *StateStr() const { return Volume::StateStr((Volume::STATE)mState); }
|
||||
PRInt32 State() const { return mState; }
|
||||
const char *StateStr() const { return NS_VolumeStateStr(mState); }
|
||||
|
||||
typedef nsTArray<nsRefPtr<nsVolume> > Array;
|
||||
|
||||
@ -61,7 +63,7 @@ private:
|
||||
protected:
|
||||
nsString mName;
|
||||
nsString mMountPoint;
|
||||
long mState;
|
||||
PRInt32 mState;
|
||||
};
|
||||
|
||||
} // system
|
||||
|
Loading…
Reference in New Issue
Block a user