зеркало из https://github.com/mozilla/gecko-dev.git
99 строки
3.4 KiB
C++
99 строки
3.4 KiB
C++
|
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||
|
*
|
||
|
* 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 the Mozilla browser.
|
||
|
*
|
||
|
* The Initial Developer of the Original Code is Netscape
|
||
|
* Communications, Inc. Portions created by Netscape are
|
||
|
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
||
|
*
|
||
|
* Contributor(s):
|
||
|
* Scott MacGregor <mscott@netscape.com>
|
||
|
*/
|
||
|
|
||
|
#include "nsExternalHelperAppService.h"
|
||
|
#include "nsIURI.h"
|
||
|
#include "nsIFile.h"
|
||
|
#include "nsIStreamListener.h"
|
||
|
|
||
|
NS_IMPL_THREADSAFE_ADDREF(nsExternalHelperAppService)
|
||
|
NS_IMPL_THREADSAFE_RELEASE(nsExternalHelperAppService)
|
||
|
|
||
|
NS_INTERFACE_MAP_BEGIN(nsExternalHelperAppService)
|
||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIExternalHelperAppService)
|
||
|
NS_INTERFACE_MAP_ENTRY(nsIExternalHelperAppService)
|
||
|
NS_INTERFACE_MAP_END_THREADSAFE
|
||
|
|
||
|
nsExternalHelperAppService::nsExternalHelperAppService()
|
||
|
{
|
||
|
NS_INIT_ISUPPORTS();
|
||
|
}
|
||
|
|
||
|
nsExternalHelperAppService::~nsExternalHelperAppService()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/* boolean canHandleContent (in string aMimeContentType); */
|
||
|
NS_IMETHODIMP nsExternalHelperAppService::CanHandleContent(const char *aMimeContentType, PRBool *_retval)
|
||
|
{
|
||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||
|
}
|
||
|
|
||
|
/* nsIStreamListener doContent (in string aMimeContentType, in nsIURI aURI, in nsISupports aWindowContext, out boolean aAbortProcess); */
|
||
|
NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType, nsIURI *aURI, nsISupports *aWindowContext, PRBool *aAbortProcess, nsIStreamListener **_retval)
|
||
|
{
|
||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||
|
}
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
// begin external app handler implementation
|
||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
NS_IMPL_THREADSAFE_ADDREF(nsExternalAppHandler)
|
||
|
NS_IMPL_THREADSAFE_RELEASE(nsExternalAppHandler)
|
||
|
|
||
|
NS_INTERFACE_MAP_BEGIN(nsExternalAppHandler)
|
||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStreamListener)
|
||
|
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
|
||
|
NS_INTERFACE_MAP_ENTRY(nsIStreamObserver)
|
||
|
NS_INTERFACE_MAP_END_THREADSAFE
|
||
|
|
||
|
nsExternalAppHandler::nsExternalAppHandler()
|
||
|
{
|
||
|
NS_INIT_ISUPPORTS();
|
||
|
}
|
||
|
|
||
|
nsExternalAppHandler::~nsExternalAppHandler()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIChannel * aChannel, nsISupports * aCtxt)
|
||
|
{
|
||
|
// create a temp file for the data...and open it for writing.
|
||
|
return NS_OK;
|
||
|
}
|
||
|
|
||
|
NS_IMETHODIMP nsExternalAppHandler::OnDataAvailable(nsIChannel * aChannel, nsISupports * aCtxt,
|
||
|
nsIInputStream * inStr, PRUint32 sourceOffset, PRUint32 count)
|
||
|
{
|
||
|
// read the data out of the stream and write it to the temp file.
|
||
|
return NS_OK;
|
||
|
}
|
||
|
|
||
|
NS_IMETHODIMP nsExternalAppHandler::OnStopRequest(nsIChannel * aChannel, nsISupports *aCtxt,
|
||
|
nsresult aStatus, const PRUnichar * errorMsg)
|
||
|
{
|
||
|
// go ahead and execute the application passing in our temp file as an argument
|
||
|
return NS_OK;
|
||
|
}
|
||
|
|