зеркало из https://github.com/mozilla/gecko-dev.git
Changes for the QNX ( photon ) platform - it should not affect ( building/runtime ) other platforms.
These changes are necessary in order to implement the xremote protocol on our platform ( it uses PtConnection to implement the xremote ). On other platforms ( linux ) it should build/run as before.
This commit is contained in:
Родитель
331a80998b
Коммит
f17ff2192d
|
@ -35,23 +35,34 @@ REQUIRES = xpcom \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
XRemoteClient.cpp \
|
|
||||||
XRemoteClientFactory.cpp \
|
XRemoteClientFactory.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
ifdef MOZ_ENABLE_PHOTON
|
||||||
|
CPPSRCS += PhRemoteClient.cpp
|
||||||
|
else
|
||||||
|
CPPSRCS += XRemoteClient.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
EXTRA_DSO_LDOPTS = \
|
EXTRA_DSO_LDOPTS = \
|
||||||
$(XLIBS) $(XLDFLAGS) \
|
$(XLIBS) $(XLDFLAGS) \
|
||||||
$(MOZ_COMPONENT_LIBS) \
|
$(MOZ_COMPONENT_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
ifdef MOZ_ENABLE_PHOTON
|
||||||
|
EXTRA_DSO_LDOPTS += -lph
|
||||||
|
endif
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
nsXRemoteClientCID.h
|
nsXRemoteClientCID.h
|
||||||
|
|
||||||
|
ifndef MOZ_ENABLE_PHOTON
|
||||||
PROGRAM = mozilla-xremote-client$(BIN_SUFFIX)
|
PROGRAM = mozilla-xremote-client$(BIN_SUFFIX)
|
||||||
|
|
||||||
PROGOBJS = mozilla-xremote-client.$(OBJ_SUFFIX) \
|
PROGOBJS = mozilla-xremote-client.$(OBJ_SUFFIX) \
|
||||||
XRemoteClient_standalone.$(OBJ_SUFFIX) \
|
XRemoteClient_standalone.$(OBJ_SUFFIX) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
endif
|
||||||
|
|
||||||
LIBS = \
|
LIBS = \
|
||||||
$(NSPR_LIBS) \
|
$(NSPR_LIBS) \
|
||||||
|
@ -63,5 +74,7 @@ ifeq ($(OS_ARCH), OpenVMS)
|
||||||
DEFINES += -DGENERIC_MOTIF_REDEFINES
|
DEFINES += -DGENERIC_MOTIF_REDEFINES
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef MOZ_ENABLE_PHOTON
|
||||||
XRemoteClient_standalone.$(OBJ_SUFFIX): XRemoteClient.cpp
|
XRemoteClient_standalone.$(OBJ_SUFFIX): XRemoteClient.cpp
|
||||||
$(CXX) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) -DXREMOTE_STANDALONE $<
|
$(CXX) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) -DXREMOTE_STANDALONE $<
|
||||||
|
endif
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* The contents of this file are subject to the Mozilla Public
|
||||||
|
* License Version 1.1 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS
|
||||||
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
|
* implied. See the License for the specific language governing
|
||||||
|
* rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developers of the Original Code are Christopher
|
||||||
|
* Blizzard and Jamie Zawinski. Portions created Christopher Blizzard
|
||||||
|
* are Copyright (C) 2000 Christopher Blizzard. Portions created by
|
||||||
|
* Jamie Zawinski are Copyright (C) 1994 Netscape Communications
|
||||||
|
* Corporation. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): Adrian Mardare ( amardare@qnx.com )
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PhRemoteClient.h"
|
||||||
|
#include "prmem.h"
|
||||||
|
#include "prprf.h"
|
||||||
|
#include "plstr.h"
|
||||||
|
#include "prsystem.h"
|
||||||
|
#include "prlog.h"
|
||||||
|
#include "prenv.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <Pt.h>
|
||||||
|
|
||||||
|
#define BrowserRemoteServerName "MozillaBrowserRemoteServer"
|
||||||
|
#define MailRemoteServerName "MozillaMailRemoteServer"
|
||||||
|
#define MOZ_REMOTE_MSG_TYPE 100
|
||||||
|
|
||||||
|
XRemoteClient::XRemoteClient()
|
||||||
|
{
|
||||||
|
mInitialized = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
XRemoteClient::~XRemoteClient()
|
||||||
|
{
|
||||||
|
if (mInitialized)
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS1(XRemoteClient, nsIXRemoteClient)
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
XRemoteClient::Init (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (mInitialized)
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
|
/* we have to initialize the toolkit since we use PtConnection stuff to send messages */
|
||||||
|
PtInit( NULL );
|
||||||
|
|
||||||
|
mInitialized = PR_TRUE;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
XRemoteClient::SendCommand (const char *aCommand, PRBool *aWindowFound)
|
||||||
|
{
|
||||||
|
*aWindowFound = PR_TRUE;
|
||||||
|
|
||||||
|
char *RemoteServerName;
|
||||||
|
|
||||||
|
if( PL_strstr( aCommand, "mailto" ) )
|
||||||
|
RemoteServerName = MailRemoteServerName;
|
||||||
|
else RemoteServerName = BrowserRemoteServerName;
|
||||||
|
|
||||||
|
PtConnectionClient_t *cnt = PtConnectionFindName( RemoteServerName, 0, 0 );
|
||||||
|
if( !cnt ) {
|
||||||
|
/* no window has registered for the remote service */
|
||||||
|
*aWindowFound = PR_FALSE;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( PtConnectionSend( cnt, MOZ_REMOTE_MSG_TYPE, aCommand, NULL, strlen( aCommand ), 0 ) < 0 )
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
XRemoteClient::Shutdown (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!mInitialized)
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
|
// shut everything down
|
||||||
|
mInitialized = PR_FALSE;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* The contents of this file are subject to the Mozilla Public
|
||||||
|
* License Version 1.1 (the "License"); you may not use this file
|
||||||
|
* except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS
|
||||||
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
|
* implied. See the License for the specific language governing
|
||||||
|
* rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is Christopher Blizzard.
|
||||||
|
* Portions created Christopher Blizzard are Copyright (C) Christopher
|
||||||
|
* Blizzard. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s): Adrian Mardare ( amardare@qnx.com )
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "nsIXRemoteClient.h"
|
||||||
|
|
||||||
|
class XRemoteClient : public nsIXRemoteClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XRemoteClient();
|
||||||
|
virtual ~XRemoteClient();
|
||||||
|
|
||||||
|
// nsISupports
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
// nsIXRemoteClient
|
||||||
|
NS_DECL_NSIXREMOTECLIENT
|
||||||
|
|
||||||
|
private:
|
||||||
|
PRBool mInitialized;
|
||||||
|
};
|
|
@ -43,7 +43,12 @@
|
||||||
|
|
||||||
/* cfae5900-1dd1-11b2-95d0-ad454c233dc6 */
|
/* cfae5900-1dd1-11b2-95d0-ad454c233dc6 */
|
||||||
|
|
||||||
|
#ifdef MOZ_WIDGET_PHOTON
|
||||||
|
#include "PhRemoteClient.h"
|
||||||
|
#else
|
||||||
#include "XRemoteClient.h"
|
#include "XRemoteClient.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nsXRemoteClientCID.h"
|
#include "nsXRemoteClientCID.h"
|
||||||
#include "nsIGenericFactory.h"
|
#include "nsIGenericFactory.h"
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче