Mozilla/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp
mscott%netscape.com f263bd8b3a Bug #38374 --> more updates for external helper application support. (NOT PART OF THE BUILD)
code review will come when this is done and gets turned on.

initialize an external app handler with an nsIFile which represents the app.


git-svn-id: svn://10.0.0.236/trunk@72473 18797224-902f-48f8-a5cc-f745e15eee43
2000-06-17 02:34:24 +00:00

67 lines
2.7 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 "nsOSHelperAppService.h"
nsOSHelperAppService::nsOSHelperAppService() : nsExternalHelperAppService()
{}
nsOSHelperAppService::~nsOSHelperAppService()
{}
NS_IMETHODIMP nsExternalHelperAppService::CanHandleContent(const char *aMimeContentType, nsIURI * aURI, PRBool * aCanHandleContent)
{
// once we have user over ride stuff working, we need to first call up to our base class
// and ask the base class if we can handle the content. This will take care of looking for user specified
// apps for content types.
// for now we only have defaults to worry about...
// go look up in the windows registry to see if there is a handler for this mime type...if there is return TRUE...
*aCanHandleContent = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType, nsIURI *aURI, nsISupports *aWindowContext,
PRBool *aAbortProcess, nsIStreamListener ** aStreamListener)
{
// look up the content type and get a platform specific handle to the app we want to use for this
// download...create a nsExternalAppHandler, bind the application token to it (as a nsIFile??) and return this
// as the stream listener to use...
// this code is incomplete and just here to get things started..
nsExternalAppHandler * handler = CreateNewExternalHandler();
handler->QueryInterface(NS_GET_IID(nsIStreamListener), (void **) aStreamListener);
// eventually when we start trying to hook up some UI we may need to insert code here to throw up a dialog
// and ask the user if they wish to use this app to open this content type...
// now bind the handler to the application we want to launch when we the handler is done
// receiving all the data...
handler->Init(nsnull /* this should be a nsIFile that represents the app */);
return NS_OK;
}