2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsResProtocolHandler_h___
|
|
|
|
#define nsResProtocolHandler_h___
|
|
|
|
|
|
|
|
#include "nsIResProtocolHandler.h"
|
|
|
|
#include "nsInterfaceHashtable.h"
|
|
|
|
#include "nsISupportsArray.h"
|
|
|
|
#include "nsIIOService.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsStandardURL.h"
|
|
|
|
|
2010-03-10 21:33:00 -08:00
|
|
|
struct ResourceMapping;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution
|
|
|
|
class nsResURL : public nsStandardURL
|
|
|
|
{
|
|
|
|
public:
|
2011-10-17 07:59:28 -07:00
|
|
|
nsResURL() : nsStandardURL(true) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsStandardURL* StartClone();
|
|
|
|
virtual nsresult EnsureFile();
|
|
|
|
NS_IMETHOD GetClassIDNoAlloc(nsCID *aCID);
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIPROTOCOLHANDLER
|
|
|
|
NS_DECL_NSIRESPROTOCOLHANDLER
|
|
|
|
|
|
|
|
nsResProtocolHandler();
|
|
|
|
virtual ~nsResProtocolHandler();
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources);
|
2010-03-10 21:33:00 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2010-05-21 11:00:57 -07:00
|
|
|
nsresult Init(nsIFile *aOmniJar);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution);
|
|
|
|
nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions;
|
|
|
|
nsCOMPtr<nsIIOService> mIOService;
|
|
|
|
|
|
|
|
friend class nsResURL;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsResProtocolHandler_h___ */
|