1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_IMAGELIB_IMAGEFACTORY_H_
8 #define MOZILLA_IMAGELIB_IMAGEFACTORY_H_
11 #include "nsProxyRelease.h"
15 class imgStatusTracker
;
27 * Registers vars with Preferences. Should only be called on the main thread.
29 static void Initialize();
32 * Creates a new image with the given properties.
33 * Can be called on or off the main thread.
35 * @param aRequest The associated request.
36 * @param aStatusTracker A status tracker for the image to use.
37 * @param aMimeType The mimetype of the image.
38 * @param aURI The URI of the image.
39 * @param aIsMultiPart Whether the image is part of a multipart request.
40 * @param aInnerWindowId The window this image belongs to.
42 static already_AddRefed
<Image
> CreateImage(nsIRequest
* aRequest
,
43 imgStatusTracker
* aStatusTracker
,
44 const nsCString
& aMimeType
,
47 uint32_t aInnerWindowId
);
49 * Creates a new image which isn't associated with a URI or loaded through
50 * the usual image loading mechanism.
52 * @param aMimeType The mimetype of the image.
54 static already_AddRefed
<Image
> CreateAnonymousImage(const nsCString
& aMimeType
);
57 // Factory functions that create specific types of image containers.
58 static already_AddRefed
<Image
> CreateRasterImage(nsIRequest
* aRequest
,
59 imgStatusTracker
* aStatusTracker
,
60 const nsCString
& aMimeType
,
63 uint32_t aInnerWindowId
);
65 static already_AddRefed
<Image
> CreateVectorImage(nsIRequest
* aRequest
,
66 imgStatusTracker
* aStatusTracker
,
67 const nsCString
& aMimeType
,
70 uint32_t aInnerWindowId
);
72 // This is a static factory class, so disallow instantiation.
73 virtual ~ImageFactory() = 0;
77 } // namespace mozilla
79 #endif // MOZILLA_IMAGELIB_IMAGEFACTORY_H_