/src/mozilla-central/image/decoders/icon/nsIconURI.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
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/. */ |
6 | | |
7 | | #ifndef mozilla_image_decoders_icon_nsIconURI_h |
8 | | #define mozilla_image_decoders_icon_nsIconURI_h |
9 | | |
10 | | #include "nsIIconURI.h" |
11 | | #include "nsCOMPtr.h" |
12 | | #include "nsString.h" |
13 | | #include "nsIIPCSerializableURI.h" |
14 | | #include "nsINestedURI.h" |
15 | | #include "nsIURIMutator.h" |
16 | | |
17 | | namespace mozilla { |
18 | | class Encoding; |
19 | | } |
20 | | |
21 | | class nsMozIconURI final |
22 | | : public nsIMozIconURI |
23 | | , public nsIIPCSerializableURI |
24 | | , public nsINestedURI |
25 | | { |
26 | | public: |
27 | | NS_DECL_THREADSAFE_ISUPPORTS |
28 | | NS_DECL_NSIURI |
29 | | NS_DECL_NSIMOZICONURI |
30 | | NS_DECL_NSIIPCSERIALIZABLEURI |
31 | | NS_DECL_NSINESTEDURI |
32 | | |
33 | | protected: |
34 | | nsMozIconURI(); |
35 | | virtual ~nsMozIconURI(); |
36 | | nsCOMPtr<nsIURL> mIconURL; // a URL that we want the icon for |
37 | | uint32_t mSize; // the # of pixels in a row that we want for this image. |
38 | | // Typically 16, 32, 128, etc. |
39 | | nsCString mContentType; // optional field explicitly specifying the content |
40 | | // type |
41 | | nsCString mFileName; // for if we don't have an actual file path, we're just |
42 | | // given a filename with an extension |
43 | | nsCString mStockIcon; |
44 | | int32_t mIconSize; // -1 if not specified, otherwise index into |
45 | | // kSizeStrings |
46 | | int32_t mIconState; // -1 if not specified, otherwise index into |
47 | | // kStateStrings |
48 | | |
49 | | private: |
50 | | nsresult Clone(nsIURI** aURI); |
51 | | nsresult SetSpecInternal(const nsACString &input); |
52 | | nsresult SetScheme(const nsACString &input); |
53 | | nsresult SetUserPass(const nsACString &input); |
54 | | nsresult SetUsername(const nsACString &input); |
55 | | nsresult SetPassword(const nsACString &input); |
56 | | nsresult SetHostPort(const nsACString &aValue); |
57 | | nsresult SetHost(const nsACString &input); |
58 | | nsresult SetPort(int32_t port); |
59 | | nsresult SetPathQueryRef(const nsACString &input); |
60 | | nsresult SetRef(const nsACString &input); |
61 | | nsresult SetFilePath(const nsACString &input); |
62 | | nsresult SetQuery(const nsACString &input); |
63 | | nsresult SetQueryWithEncoding(const nsACString &input, const mozilla::Encoding* encoding); |
64 | | bool Deserialize(const mozilla::ipc::URIParams&); |
65 | | |
66 | | public: |
67 | | class Mutator final |
68 | | : public nsIURIMutator |
69 | | , public BaseURIMutator<nsMozIconURI> |
70 | | { |
71 | | NS_DECL_ISUPPORTS |
72 | | NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI) |
73 | | |
74 | | NS_IMETHOD Deserialize(const mozilla::ipc::URIParams& aParams) override |
75 | 0 | { |
76 | 0 | return InitFromIPCParams(aParams); |
77 | 0 | } |
78 | | |
79 | | NS_IMETHOD Finalize(nsIURI** aURI) override |
80 | 0 | { |
81 | 0 | mURI.forget(aURI); |
82 | 0 | return NS_OK; |
83 | 0 | } |
84 | | |
85 | | NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override |
86 | 0 | { |
87 | 0 | if (aMutator) { |
88 | 0 | nsCOMPtr<nsIURIMutator> mutator = this; |
89 | 0 | mutator.forget(aMutator); |
90 | 0 | } |
91 | 0 | return InitFromSpec(aSpec); |
92 | 0 | } |
93 | | |
94 | 0 | explicit Mutator() { } |
95 | | private: |
96 | 0 | virtual ~Mutator() { } |
97 | | |
98 | | friend class nsMozIconURI; |
99 | | }; |
100 | | |
101 | | friend BaseURIMutator<nsMozIconURI>; |
102 | | }; |
103 | | |
104 | | #endif // mozilla_image_decoders_icon_nsIconURI_h |