27 #ifndef __SB_IPD_UTILS_H__
28 #define __SB_IPD_UTILS_H__
53 #include <sbIDevice.h>
56 #include <nsComponentManagerUtils.h>
57 #include <nsIIOService.h>
59 #include <nsIVariant.h>
60 #include <nsServiceManagerUtils.h>
61 #include <nsStringAPI.h>
85 SB_AUTO_CLASS(sbAutoGMemPtr,
void*, mValue, g_free(mValue), mValue = NULL);
89 itdb_track_free(mValue),
118 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
119 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
120 rv = mVariant->SetAsISupports(aValue);
121 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
127 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
128 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
129 rv = mVariant->SetAsInterface(aIID, aValue);
130 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
136 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
137 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
138 rv = mVariant->SetAsAString(aValue);
139 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
143 PRUint16 aType = nsIDataType::VTYPE_CSTRING)
146 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
147 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
148 if (aType == nsIDataType::VTYPE_UTF8STRING)
149 rv = mVariant->SetAsAUTF8String(aValue);
151 rv = mVariant->SetAsACString(aValue);
152 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
158 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
159 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
160 rv = mVariant->SetAsAString(NS_ConvertASCIItoUTF16(aValue));
161 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
167 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
168 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
169 rv = mVariant->SetAsChar(aValue);
170 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
176 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
177 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
178 rv = mVariant->SetAsInt16(aValue);
179 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
185 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
186 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
187 rv = mVariant->SetAsInt32(aValue);
188 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
192 PRUint16 aType = nsIDataType::VTYPE_UINT32)
195 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
196 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
197 if (aType == nsIDataType::VTYPE_BOOL)
198 rv = mVariant->SetAsBool(aValue);
200 rv = mVariant->SetAsUint32(aValue);
201 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
207 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
208 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
209 rv = mVariant->SetAsInt64(aValue);
210 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
216 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
217 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
218 rv = mVariant->SetAsUint64(aValue);
219 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
225 mVariant = do_CreateInstance(
"@songbirdnest.com/Songbird/Variant;1", &rv);
226 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to create variant.");
227 rv = mVariant->SetAsDouble(aValue);
228 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to write variant.");
231 nsIVariant*
get() {
return (mVariant); }
234 return aVariant->GetAsInt16(aValue);
238 nsCOMPtr<nsIWritableVariant> mVariant;
259 do_GetService(
"@mozilla.org/network/io-service;1",
261 NS_ENSURE_SUCCESS(rv, );
262 rv = ioService->NewURI(nsCAutoString(aValue),
265 getter_AddRefs(mURI));
266 NS_ENSURE_SUCCESS(rv, );
269 nsIURI*
get() {
return (mURI); }
272 nsCOMPtr<nsIURI> mURI;
284 nsIVariant*
aData = nsnull,
287 PRBool aAsync = PR_FALSE);
nsresult CreateAndDispatchDeviceManagerEvent(PRUint32 aType, nsIVariant *aData=nsnull, nsISupports *aOrigin=nsnull, PRUint32 aDeviceState=sbIDevice::STATE_IDLE, PRBool aAsync=PR_FALSE)
sbIPDVariant(REFNSIID aIID, nsISupports *aValue)
sbIPDVariant(const nsACString &aValue, PRUint16 aType=nsIDataType::VTYPE_CSTRING)
sbIPDVariant(const nsAString &aValue)
sbIPDVariant(PRUint64 aValue)
sbIPDVariant(const char *aValue)
sbIPDVariant(char aValue)
sbIPDURI(const char *aValue)
sbIPDVariant(PRInt64 aValue)
const unsigned long STATE_IDLE
sbIPDVariant(double aValue)
sbIPDVariant(PRUint32 aValue, PRUint16 aType=nsIDataType::VTYPE_UINT32)
SB_AUTO_CLASS(sbAutoGMemPtr, void *, mValue, g_free(mValue), mValue=NULL)
sbIPDVariant(PRInt32 aValue)
_updateTextAndScrollDataForFrame aData
sbIPDVariant(nsISupports *aValue)
static nsresult GetValue(nsIVariant *aVariant, PRInt16 *aValue)
sbIPDVariant(PRInt16 aValue)