Bug 1109592 - Move |NfcConnector| to a more public place. r=allstars.chh

|NfcConnector| is required to listen for connections from within
|NfcService|. This patch makes it available.
This commit is contained in:
Thomas Zimmermann 2015-03-11 03:33:00 -04:00
parent 3f04f600c1
commit 89907aac54
2 changed files with 28 additions and 20 deletions

View File

@ -22,7 +22,6 @@
#include "jsfriendapi.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/ipc/UnixSocketConnector.h"
#include "nsThreadUtils.h" // For NS_IsMainThread.
using namespace mozilla::ipc;
@ -62,22 +61,14 @@ private:
nsAutoPtr<UnixSocketRawData> mRawData;
};
class NfcConnector MOZ_FINAL : public mozilla::ipc::UnixSocketConnector
{
public:
NfcConnector()
{ }
} // anonymous namespace
int Create() MOZ_OVERRIDE;
bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress) MOZ_OVERRIDE;
bool SetUp(int aFd) MOZ_OVERRIDE;
bool SetUpListenSocket(int aFd) MOZ_OVERRIDE;
void GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr) MOZ_OVERRIDE;
};
namespace mozilla {
namespace ipc {
//
// NfcConnector
//
int
NfcConnector::Create()
@ -162,10 +153,9 @@ NfcConnector::GetSocketAddr(const sockaddr_any& aAddr,
MOZ_CRASH("This should never be called!");
}
} // anonymous namespace
namespace mozilla {
namespace ipc {
//
// NfcConsumer
//
NfcConsumer::NfcConsumer(NfcSocketListener* aListener)
: mListener(aListener)

View File

@ -10,6 +10,7 @@
#define mozilla_ipc_Nfc_h 1
#include <mozilla/ipc/StreamSocket.h>
#include <mozilla/ipc/UnixSocketConnector.h>
namespace mozilla {
namespace ipc {
@ -28,6 +29,23 @@ public:
virtual void OnDisconnect(enum SocketType aSocketType) = 0;
};
class NfcConnector MOZ_FINAL : public mozilla::ipc::UnixSocketConnector
{
public:
NfcConnector()
{ }
int Create() MOZ_OVERRIDE;
bool CreateAddr(bool aIsServer,
socklen_t& aAddrSize,
sockaddr_any& aAddr,
const char* aAddress) MOZ_OVERRIDE;
bool SetUp(int aFd) MOZ_OVERRIDE;
bool SetUpListenSocket(int aFd) MOZ_OVERRIDE;
void GetSocketAddr(const sockaddr_any& aAddr,
nsAString& aAddrStr) MOZ_OVERRIDE;
};
class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket
{
public: