gecko-dev/layout/style/nsFontFaceLoader.h

67 строки
1.8 KiB
C
Исходник Обычный вид История

2008-10-01 07:04:10 +04:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// vim:cindent:ts=2:et:sw=2:
2012-05-21 15:12:37 +04: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/. */
2008-10-01 07:04:10 +04:00
/* code for loading in @font-face defined font data */
#ifndef nsFontFaceLoader_h_
#define nsFontFaceLoader_h_
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsIStreamLoader.h"
#include "nsIChannel.h"
2008-10-01 07:04:10 +04:00
#include "gfxUserFontSet.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
#include "nsCSSRules.h"
2008-10-01 07:04:10 +04:00
class nsPresContext;
class nsIPrincipal;
2008-10-01 07:04:10 +04:00
class nsFontFaceLoader : public nsIStreamLoaderObserver
2008-10-01 07:04:10 +04:00
{
public:
nsFontFaceLoader(gfxUserFontEntry* aFontToLoad, nsIURI* aFontURI,
mozilla::dom::FontFaceSet* aFontFaceSet,
nsIChannel* aChannel);
2008-10-01 07:04:10 +04:00
NS_DECL_ISUPPORTS
NS_DECL_NSISTREAMLOADEROBSERVER
2008-10-01 07:04:10 +04:00
// initiate the load
nsresult Init();
// cancel the load and remove its reference to mFontFaceSet
void Cancel();
2008-10-01 07:04:10 +04:00
void DropChannel() { mChannel = nullptr; }
void StartedLoading(nsIStreamLoader* aStreamLoader);
static void LoadTimerCallback(nsITimer* aTimer, void* aClosure);
static nsresult CheckLoadAllowed(nsIPrincipal* aSourcePrincipal,
nsIURI* aTargetURI,
nsISupports* aContext);
#ifdef PR_LOGGING
static PRLogModuleInfo* GetFontDownloaderLog();
#endif
protected:
virtual ~nsFontFaceLoader();
private:
nsRefPtr<gfxUserFontEntry> mUserFontEntry;
nsCOMPtr<nsIURI> mFontURI;
nsRefPtr<mozilla::dom::FontFaceSet> mFontFaceSet;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsITimer> mLoadTimer;
nsIStreamLoader* mStreamLoader;
2008-10-01 07:04:10 +04:00
};
#endif /* !defined(nsFontFaceLoader_h_) */