sbBaseDeviceFirmwareHandler.cpp
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
26 
27 #include <nsIChromeRegistry.h>
28 #include <nsIFileURL.h>
29 #include <nsIHttpChannel.h>
30 #include <nsIIOService.h>
31 #include <nsIScriptSecurityManager.h>
32 
33 #include <nsArrayUtils.h>
34 #include <nsAutoLock.h>
35 #include <nsServiceManagerUtils.h>
36 #include <nsThreadUtils.h>
37 #include <prlog.h>
38 
39 #include <sbIDevice.h>
40 #include <sbIDeviceEventTarget.h>
41 
43 
45 #include "sbDeviceFirmwareUpdate.h"
46 
51 #ifdef PR_LOGGING
52  static PRLogModuleInfo* gBaseDeviceFirmwareHandlerLog = nsnull;
53 # define TRACE(args) PR_LOG(gBaseDeviceFirmwareHandlerLog, PR_LOG_DEBUG, args)
54 # define LOG(args) PR_LOG(gBaseDeviceFirmwareHandlerLog, PR_LOG_WARN, args)
55 # ifdef __GNUC__
56 # define __FUNCTION__ __PRETTY_FUNCTION__
57 # endif /* __GNUC__ */
58 #else
59 # define TRACE(args) /* nothing */
60 # define LOG(args) /* nothing */
61 #endif
62 
63 static const PRInt32 HTTP_STATE_UNINITIALIZED = 0;
64 static const PRInt32 HTTP_STATE_LOADING = 1;
65 static const PRInt32 HTTP_STATE_LOADED = 2;
66 static const PRInt32 HTTP_STATE_INTERACTIVE = 3;
67 static const PRInt32 HTTP_STATE_COMPLETED = 4;
68 
72 
74 : mMonitor(nsnull)
75 , mHandlerState(HANDLER_IDLE)
76 , mFirmwareVersion(0)
77 , mDefaultFirmwareVersion(0)
78 , mNeedsRecoveryMode(PR_FALSE)
79 , mRecoveryMode(PR_FALSE)
80 {
81 #ifdef PR_LOGGING
82  if(!gBaseDeviceFirmwareHandlerLog) {
83  gBaseDeviceFirmwareHandlerLog =
84  PR_NewLogModule("sbBaseDeviceFirmwareHandler");
85  }
86 #endif
87 }
88 
90 {
91  if(mMonitor) {
92  nsAutoMonitor::DestroyMonitor(mMonitor);
93  }
94 }
95 
96 // ----------------------------------------------------------------------------
97 // sbBaseDeviceFirmwareHandler
98 // ----------------------------------------------------------------------------
99 nsresult
101 {
102  TRACE(("[%s]", __FUNCTION__));
103  mMonitor = nsAutoMonitor::NewMonitor("sbBaseDeviceFirmwareHandler::mMonitor");
104  NS_ENSURE_TRUE(mMonitor, NS_ERROR_OUT_OF_MEMORY);
105 
106  nsresult rv = NS_ERROR_UNEXPECTED;
107  mXMLHttpRequest = do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
108  NS_ENSURE_SUCCESS(rv, rv);
109 
110  nsCOMPtr<nsIScriptSecurityManager> ssm =
111  do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
112  NS_ENSURE_SUCCESS(rv, rv);
113 
114  nsCOMPtr<nsIPrincipal> principal;
115  rv = ssm->GetSystemPrincipal(getter_AddRefs(principal));
116  NS_ENSURE_SUCCESS(rv, rv);
117 
118  rv = mXMLHttpRequest->Init(principal, nsnull, nsnull, nsnull);
119  NS_ENSURE_SUCCESS(rv, rv);
120 
121  rv = mXMLHttpRequest->SetMozBackgroundRequest(PR_TRUE);
122  NS_ENSURE_SUCCESS(rv, rv);
123 
125  do_CreateInstance("@songbirdnest.com/moz/xpcom/threadsafe-array;1", &rv);
126  NS_ENSURE_SUCCESS(rv, rv);
127 
128  mRecoveryModeKeyCombination.Truncate();
129 
130  rv = OnInit();
131  NS_ENSURE_SUCCESS(rv, rv);
132 
133  return NS_OK;
134 }
135 
136 nsresult
138  const nsAString &aDeviceFriendlyName,
139  const PRUint32 aDeviceVendorID,
140  const PRUint32 aDeviceProductID)
141 {
142  nsresult rv = NS_ERROR_UNEXPECTED;
143  nsCOMPtr<sbIDeviceFirmwareSupport> deviceSupport =
144  do_CreateInstance(SB_DEVICEFIRMWARESUPPORT_CONTRACTID, &rv);
145  NS_ENSURE_SUCCESS(rv, rv);
146 
147  rv = deviceSupport->SimpleInit(aDeviceFriendlyName,
148  aDeviceVendorID,
149  aDeviceProductID);
150  NS_ENSURE_SUCCESS(rv, rv);
151 
152  rv = mSupportedDevices->AppendElement(deviceSupport, PR_FALSE);
153  NS_ENSURE_SUCCESS(rv, rv);
154 
155  return NS_OK;
156 }
157 
158 nsresult
160  const nsAString &aDeviceFriendlyName,
161  const PRUint32 aDeviceProductID)
162 {
163  PRUint32 length = 0;
164  nsresult rv = mSupportedDevices->GetLength(&length);
165  NS_ENSURE_SUCCESS(rv, rv);
166 
167  nsCOMPtr<nsIArray> array = do_QueryInterface(mSupportedDevices, &rv);
168  NS_ENSURE_SUCCESS(rv, rv);
169 
170  for(PRUint32 current = 0; current < length; current++) {
171  nsCOMPtr<sbIDeviceFirmwareSupport> deviceSupport =
172  do_QueryElementAt(array, current, &rv);
173  NS_ENSURE_SUCCESS(rv, rv);
174 
175  nsAutoString friendlyName;
176  rv = deviceSupport->GetDeviceFriendlyName(friendlyName);
177  NS_ENSURE_SUCCESS(rv, rv);
178 
179  if(friendlyName.Equals(aDeviceFriendlyName)) {
180  rv = deviceSupport->AppendProductID(aDeviceProductID);
181  NS_ENSURE_SUCCESS(rv, rv);
182 
183  return NS_OK;
184  }
185  }
186 
187  return NS_OK;
188 }
189 
190 nsresult
192  nsIURI **aURI)
193 {
194  TRACE(("[%s]", __FUNCTION__));
195  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
196  NS_ENSURE_ARG_POINTER(aURI);
197 
198  nsresult rv = NS_ERROR_UNEXPECTED;
199  nsCOMPtr<nsIIOService> ioService;
200 
201  if(NS_IsMainThread()) {
202  ioService = do_GetService("@mozilla.org/network/io-service;1", &rv);
203  NS_ENSURE_SUCCESS(rv, rv);
204  }
205  else {
206  ioService = do_ProxiedGetService("@mozilla.org/network/io-service;1", &rv);
207  NS_ENSURE_SUCCESS(rv, rv);
208  }
209 
210  //LOG(("[%s] Creating proxied URI for '%s'", aURISpec.BeginReading()));
211 
212  nsCOMPtr<nsIURI> uri;
213  rv = ioService->NewURI(aURISpec,
214  nsnull,
215  nsnull,
216  getter_AddRefs(uri));
217  NS_ENSURE_SUCCESS(rv, rv);
218 
219  nsCOMPtr<nsIThread> mainThread;
220  rv = NS_GetMainThread(getter_AddRefs(mainThread));
221  NS_ENSURE_SUCCESS(rv, rv);
222 
223  rv = do_GetProxyForObject(mainThread,
224  NS_GET_IID(nsIURI),
225  uri,
226  NS_PROXY_ALWAYS | NS_PROXY_SYNC,
227  (void **) aURI);
228  NS_ENSURE_SUCCESS(rv, rv);
229 
230  return NS_OK;
231 }
232 
233 nsresult
235  const nsACString &aUrl,
236  const nsAString &aUsername /*= EmptyString()*/,
237  const nsAString &aPassword /*= EmptyString()*/,
238  const nsACString &aContentType /*= EmptyCString()*/,
239  nsIVariant *aRequestBody /*= nsnull*/)
240 {
241  TRACE(("[%s]", __FUNCTION__));
242  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
243  NS_ENSURE_STATE(mXMLHttpRequest);
244 
245  NS_ENSURE_TRUE(!aMethod.IsEmpty(), NS_ERROR_INVALID_ARG);
246  NS_ENSURE_TRUE(!aUrl.IsEmpty(), NS_ERROR_INVALID_ARG);
247 
248  PRInt32 state = 0;
249  nsresult rv = mXMLHttpRequest->GetReadyState(&state);
250  NS_ENSURE_SUCCESS(rv, rv);
251 
252  // Only one request at a time.
253  if(state != HTTP_STATE_UNINITIALIZED &&
254  state != HTTP_STATE_COMPLETED) {
255  TRACE(("[%s] - can't do parallel requests (in state %08x)", __FUNCTION__, state));
256  return NS_ERROR_ABORT;
257  }
258 
259  TRACE(("[%s] - sending %s request to %s", __FUNCTION__,
260  nsCString(aMethod).get(), nsCString(aUrl).get()));
261 
262  rv = mXMLHttpRequest->OpenRequest(aMethod, aUrl, PR_TRUE,
263  aUsername, aPassword);
264  NS_ENSURE_SUCCESS(rv, rv);
265 
266  if (!aContentType.IsEmpty()) {
267  rv = mXMLHttpRequest->SetRequestHeader(NS_LITERAL_CSTRING("Content-Type"),
268  aContentType);
269  NS_ENSURE_SUCCESS(rv, rv);
270  }
271 
272  if(!mXMLHttpRequestTimer) {
273  mXMLHttpRequestTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
274  NS_ENSURE_SUCCESS(rv, rv);
275  }
276 
277  // Send the request asynchronously. aRequestBody may be null here.
278  rv = mXMLHttpRequest->Send(aRequestBody);
279  NS_ENSURE_SUCCESS(rv, rv);
280 
281  nsCOMPtr<nsITimerCallback> callback =
282  do_QueryInterface(NS_ISUPPORTS_CAST(nsITimerCallback*, this), &rv);
283  NS_ASSERTION(NS_SUCCEEDED(rv),
284  "sbBaseDeviceFirmwareHandler doesn't implement nsITimerCallback!");
285  rv = mXMLHttpRequestTimer->InitWithCallback(callback,
286  100,
287  nsITimer::TYPE_REPEATING_SLACK);
288  NS_ENSURE_SUCCESS(rv, rv);
289 
290  return NS_OK;
291 }
292 
293 nsresult
295 {
296  TRACE(("[%s]", __FUNCTION__));
297  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
298  NS_ENSURE_STATE(mXMLHttpRequest);
299 
300  PRInt32 state = 0;
301  nsresult rv = mXMLHttpRequest->GetReadyState(&state);
302  NS_ENSURE_SUCCESS(rv, rv);
303 
304  if(state != HTTP_STATE_UNINITIALIZED &&
305  state != HTTP_STATE_COMPLETED) {
306  rv = mXMLHttpRequest->Abort();
307  NS_ENSURE_SUCCESS(rv, rv);
308  }
309 
311  rv = mXMLHttpRequestTimer->Cancel();
312  NS_ENSURE_SUCCESS(rv, rv);
313  }
314 
315  return NS_OK;
316 }
317 
318 nsresult
320  nsIVariant *aData,
321  sbIDeviceEvent **aEvent)
322 {
323  TRACE(("[%s]", __FUNCTION__));
324  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
325 
326  NS_ENSURE_ARG_POINTER(aEvent);
327 
328  nsAutoMonitor mon(mMonitor);
329  NS_ENSURE_STATE(mDevice);
330  nsCOMPtr<sbIDevice> device = mDevice;
331  mon.Exit();
332 
333  nsresult rv = NS_ERROR_UNEXPECTED;
334 
335  nsCOMPtr<sbIDeviceManager2> deviceManager =
336  do_GetService("@songbirdnest.com/Songbird/DeviceManager;2", &rv);
337  NS_ENSURE_SUCCESS(rv, rv);
338 
339  rv = deviceManager->CreateEvent(aType,
340  aData,
341  device,
344  aEvent);
345  NS_ENSURE_SUCCESS(rv, rv);
346 
347  return NS_OK;
348 }
349 
350 nsresult
352  PRBool aAsync /*= PR_TRUE*/)
353 {
354  TRACE(("[%s]", __FUNCTION__));
355  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
356  NS_ENSURE_ARG_POINTER(aEvent);
357 
358  nsresult rv = NS_ERROR_UNEXPECTED;
359 
360  nsAutoMonitor mon(mMonitor);
361 
362  nsCOMPtr<sbIDeviceEventListener> listener = mListener;
363 
364  if(!NS_IsMainThread() && listener) {
365  if(!mProxiedListener) {
366  mon.Exit();
367 
368  nsCOMPtr<nsIThread> mainThread;
369  rv = NS_GetMainThread(getter_AddRefs(mainThread));
370  NS_ENSURE_SUCCESS(rv, rv);
371 
372  nsCOMPtr<sbIDeviceEventListener> proxiedListener;
373  rv = do_GetProxyForObject(mainThread,
374  NS_GET_IID(sbIDeviceEventListener),
375  listener,
376  NS_PROXY_ALWAYS | NS_PROXY_ASYNC,
377  getter_AddRefs(proxiedListener));
378  NS_ENSURE_SUCCESS(rv, rv);
379 
380  mon.Enter();
381  mProxiedListener = proxiedListener;
382  }
383 
384  listener = mProxiedListener;
385  }
386 
387  NS_ENSURE_STATE(mDevice);
388  nsCOMPtr<sbIDeviceEventTarget> target = do_QueryInterface(mDevice, &rv);
389  NS_ENSURE_SUCCESS(rv, rv);
390 
391  mon.Exit();
392 
393  PRBool dispatched = PR_FALSE;
394  rv = target->DispatchEvent(aEvent, aAsync, &dispatched);
395  NS_ENSURE_SUCCESS(rv, rv);
396 
397  NS_WARN_IF_FALSE(dispatched, "Event not dispatched");
398 
399  if(listener) {
400  rv = listener->OnDeviceEvent(aEvent);
401  NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Error while calling listener.");
402  }
403 
404  return NS_OK;
405 }
406 
407 nsresult
409  nsIVariant *aData,
410  PRBool aAsync /*= PR_TRUE*/)
411 {
412  TRACE(("[%s]", __FUNCTION__));
413  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
414 
415  nsCOMPtr<sbIDeviceEvent> deviceEvent;
416  nsresult rv = CreateDeviceEvent(aType, aData, getter_AddRefs(deviceEvent));
417  NS_ENSURE_SUCCESS(rv, rv);
418 
419  rv = SendDeviceEvent(deviceEvent, aAsync);
420  NS_ENSURE_SUCCESS(rv, rv);
421 
422  return NS_OK;
423 }
424 
427 {
428  TRACE(("[%s]", __FUNCTION__));
429  nsAutoMonitor mon(mMonitor);
430  return mHandlerState;
431 }
432 
433 nsresult
435 {
436  TRACE(("[%s]", __FUNCTION__));
437  NS_ENSURE_ARG_RANGE(aState, HANDLER_IDLE, HANDLER_X);
438 
439  nsAutoMonitor mon(mMonitor);
441 
442  return NS_OK;
443 }
444 
445 nsresult
447  PRUint32 aEventType,
448  nsIVariant *aData /*= nsnull*/)
449 {
450  TRACE(("[%s]", __FUNCTION__));
451  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
452 
453  if(NS_FAILED(aResult)) {
454  nsresult rv = SendDeviceEvent(aEventType, aData);
455  NS_ENSURE_SUCCESS(rv, rv);
456  }
457 
458  return aResult;
459 }
460 
461 // ----------------------------------------------------------------------------
462 // Overridable methods for users of this base class.
463 // ----------------------------------------------------------------------------
464 
465 /*virtual*/ nsresult
467 {
468  TRACE(("[%s]", __FUNCTION__));
490  return NS_ERROR_NOT_IMPLEMENTED;
491 }
492 
493 /*virtual*/ nsresult
495 {
500  return NS_ERROR_NOT_IMPLEMENTED;
501 }
502 
503 /*virtual*/ nsresult
504 sbBaseDeviceFirmwareHandler::OnGetCurrentFirmwareReadableVersion(nsAString &aCurrentFirmwareReadableVersion)
505 {
511  return NS_ERROR_NOT_IMPLEMENTED;
512 }
513 
514 /*virtual*/ nsresult
516 {
521  return NS_ERROR_NOT_IMPLEMENTED;
522 }
523 
524 /*virtual*/ nsresult
526 {
527  TRACE(("[%s]", __FUNCTION__));
528 
536  aModelNumber.SetIsVoid(PR_TRUE);
537 
538  return NS_OK;
539 }
540 
541 /*virtual*/ nsresult
543 {
544  TRACE(("[%s]", __FUNCTION__));
545 
553  aModelVersion.SetIsVoid(PR_TRUE);
554 
555  return NS_OK;
556 
557 }
558 
559 /*virtual*/ nsresult
561 {
562  TRACE(("[%s]", __FUNCTION__));
563 
571  aDeviceVendor.SetIsVoid(PR_TRUE);
572 
573  return NS_OK;
574 }
575 
576 /*virtual*/ nsresult
578 {
584  return NS_OK;
585 }
586 
587 /*virtual*/ nsresult
589  PRUint32 aDeviceVendorID,
590  PRUint32 aDeviceProductID,
591  PRBool *_retval)
592 {
593  TRACE(("[%s]", __FUNCTION__));
601  return NS_ERROR_NOT_IMPLEMENTED;
602 }
603 
604 /*virtual*/ nsresult
606  PRUint32 aDeviceVendorID,
607  PRUint32 aDeviceProductID)
608 {
609  TRACE(("[%s]", __FUNCTION__));
617  return NS_OK;
618 }
619 
620 /*virtual*/ nsresult
622 {
623  TRACE(("[%s]", __FUNCTION__));
632  return NS_OK;
633 }
634 
635 /*virtual*/ nsresult
637  sbIDeviceEventListener *aListener,
638  PRBool *_retval)
639 {
651  return NS_ERROR_NOT_IMPLEMENTED;
652 }
653 
654 /*virtual*/ nsresult
656 {
657  TRACE(("[%s]", __FUNCTION__));
663  return NS_ERROR_NOT_IMPLEMENTED;
664 }
665 
666 /*virtual*/ nsresult
668 {
669  TRACE(("[%s]", __FUNCTION__));
689  return NS_ERROR_NOT_IMPLEMENTED;
690 }
691 
692 /*virtual*/ nsresult
694 {
695  TRACE(("[%s]", __FUNCTION__));
714  return NS_ERROR_NOT_IMPLEMENTED;
715 }
716 
717 /*virtual*/ nsresult
719 {
720  TRACE(("[%s]", __FUNCTION__));
747  return NS_ERROR_NOT_IMPLEMENTED;
748 }
749 
750 /*virtual*/ nsresult
752 {
753  TRACE(("[%s]", __FUNCTION__));
772  return NS_ERROR_NOT_IMPLEMENTED;
773 }
774 
775 /*virtual*/ nsresult
777 {
778  TRACE(("[%s]", __FUNCTION__));
797  return NS_ERROR_NOT_IMPLEMENTED;
798 }
799 
800 /*virtual*/ nsresult
802 {
803  TRACE(("[%s]", __FUNCTION__));
804  return NS_ERROR_NOT_IMPLEMENTED;
805 }
806 
807 // ----------------------------------------------------------------------------
808 // sbIDeviceFirmwareHandler
809 // ----------------------------------------------------------------------------
810 
811 NS_IMETHODIMP
812 sbBaseDeviceFirmwareHandler::GetBoundDevice(sbIDevice **aDevice)
813 {
814  TRACE(("[%s]", __FUNCTION__));
815  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
816  NS_ENSURE_ARG_POINTER(aDevice);
817 
818  nsAutoMonitor mon(mMonitor);
819 
820  NS_IF_ADDREF(*aDevice = mDevice);
821  return NS_OK;
822 }
823 
824 NS_IMETHODIMP
825 sbBaseDeviceFirmwareHandler::GetContractId(nsAString & aContractId)
826 {
827  TRACE(("[%s]", __FUNCTION__));
828  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
829 
830  nsAutoMonitor mon(mMonitor);
831  aContractId = mContractId;
832 
833  return NS_OK;
834 }
835 
836 NS_IMETHODIMP
837 sbBaseDeviceFirmwareHandler::GetLatestFirmwareLocation(nsIURI * *aLatestFirmwareLocation)
838 {
839  TRACE(("[%s]", __FUNCTION__));
840  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
841  NS_ENSURE_ARG_POINTER(aLatestFirmwareLocation);
842 
843  *aLatestFirmwareLocation = nsnull;
844 
845  nsAutoMonitor mon(mMonitor);
846 
847  if(!mFirmwareLocation) {
848  return NS_ERROR_NOT_AVAILABLE;
849  }
850 
851  nsresult rv = mFirmwareLocation->Clone(aLatestFirmwareLocation);
852  NS_ENSURE_SUCCESS(rv, rv);
853 
854  return NS_OK;
855 }
856 
857 NS_IMETHODIMP
858 sbBaseDeviceFirmwareHandler::GetLatestFirmwareVersion(PRUint32 *aLatestFirmwareVersion)
859 {
860  TRACE(("[%s]", __FUNCTION__));
861  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
862  NS_ENSURE_ARG_POINTER(aLatestFirmwareVersion);
863 
864  nsAutoMonitor mon(mMonitor);
865  *aLatestFirmwareVersion = mFirmwareVersion;
866 
867  return NS_OK;
868 }
869 
870 NS_IMETHODIMP
871 sbBaseDeviceFirmwareHandler::GetLatestFirmwareReadableVersion(nsAString & aLatestFirmwareReadableVersion)
872 {
873  TRACE(("[%s]", __FUNCTION__));
874  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
875 
876  nsAutoMonitor mon(mMonitor);
877  aLatestFirmwareReadableVersion = mReadableFirmwareVersion;
878 
879  return NS_OK;
880 }
881 
882 NS_IMETHODIMP
883 sbBaseDeviceFirmwareHandler::GetCurrentFirmwareVersion(PRUint32 *aCurrentFirmwareVersion)
884 {
885  TRACE(("[%s]", __FUNCTION__));
886  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
887  NS_ENSURE_TRUE(mDevice, NS_ERROR_NOT_INITIALIZED);
888  NS_ENSURE_ARG_POINTER(aCurrentFirmwareVersion);
889 
890  nsAutoMonitor mon(mMonitor);
891 
892  nsresult rv = OnGetCurrentFirmwareVersion(aCurrentFirmwareVersion);
893  NS_ENSURE_SUCCESS(rv, rv);
894 
895  return NS_OK;
896 }
897 
898 NS_IMETHODIMP
899 sbBaseDeviceFirmwareHandler::GetCurrentFirmwareReadableVersion(nsAString &aCurrentFirmwareReadableVersion)
900 {
901  TRACE(("[%s]", __FUNCTION__));
902  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
903  NS_ENSURE_TRUE(mDevice, NS_ERROR_NOT_INITIALIZED);
904 
905  nsAutoMonitor mon(mMonitor);
906 
907  nsresult rv =
908  OnGetCurrentFirmwareReadableVersion(aCurrentFirmwareReadableVersion);
909  NS_ENSURE_SUCCESS(rv, rv);
910 
911  return NS_OK;
912 }
913 
914 NS_IMETHODIMP
915 sbBaseDeviceFirmwareHandler::GetReleaseNotesLocation(nsIURI * *aReleaseNotesLocation)
916 {
917  TRACE(("[%s]", __FUNCTION__));
918  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
919  NS_ENSURE_ARG_POINTER(aReleaseNotesLocation);
920 
921  *aReleaseNotesLocation = nsnull;
922 
923  nsAutoMonitor mon(mMonitor);
924 
925  if(!mReleaseNotesLocation) {
926  return NS_ERROR_NOT_AVAILABLE;
927  }
928 
929  nsresult rv = mReleaseNotesLocation->Clone(aReleaseNotesLocation);
930  NS_ENSURE_SUCCESS(rv, rv);
931 
932  return NS_OK;
933 }
934 
935 NS_IMETHODIMP
936 sbBaseDeviceFirmwareHandler::GetResetInstructionsLocation(nsIURI * *aResetInstructionsLocation)
937 {
938  TRACE(("[%s]", __FUNCTION__));
939  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
940  NS_ENSURE_ARG_POINTER(aResetInstructionsLocation);
941 
942  *aResetInstructionsLocation = nsnull;
943 
944  nsAutoMonitor mon(mMonitor);
945 
947  return NS_ERROR_NOT_AVAILABLE;
948  }
949 
950  nsresult rv = mResetInstructionsLocation->Clone(aResetInstructionsLocation);
951  NS_ENSURE_SUCCESS(rv, rv);
952 
953  return NS_OK;
954 }
955 
956 NS_IMETHODIMP
957 sbBaseDeviceFirmwareHandler::GetRecoveryModeKeyCombination(
958  nsAString &aRecoveryModeKeyCombination)
959 {
960  TRACE(("[%s]", __FUNCTION__));
961  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
962 
963  aRecoveryModeKeyCombination.Truncate();
964 
965  nsAutoMonitor mon(mMonitor);
966  aRecoveryModeKeyCombination.Assign(mRecoveryModeKeyCombination);
967 
968  return NS_OK;
969 }
970 
971 NS_IMETHODIMP
972 sbBaseDeviceFirmwareHandler::GetCustomerSupportLocation(nsIURI * *aSupportLocation)
973 {
974  TRACE(("[%s]", __FUNCTION__));
975  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
976  NS_ENSURE_ARG_POINTER(aSupportLocation);
977 
978  *aSupportLocation = nsnull;
979 
980  nsAutoMonitor mon(mMonitor);
981 
982  if(!mSupportLocation) {
983  return NS_OK;
984  }
985 
986  nsresult rv = mSupportLocation->Clone(aSupportLocation);
987  NS_ENSURE_SUCCESS(rv, rv);
988 
989  return NS_OK;
990 }
991 
992 NS_IMETHODIMP
993 sbBaseDeviceFirmwareHandler::GetRegisterLocation(nsIURI * *aRegisterLocation)
994 {
995  TRACE(("[%s]", __FUNCTION__));
996  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
997  NS_ENSURE_ARG_POINTER(aRegisterLocation);
998 
999  *aRegisterLocation = nsnull;
1000 
1001  nsAutoMonitor mon(mMonitor);
1002 
1003  if(!mRegisterLocation) {
1004  return NS_OK;
1005  }
1006 
1007  nsresult rv = mRegisterLocation->Clone(aRegisterLocation);
1008  NS_ENSURE_SUCCESS(rv, rv);
1009 
1010  return NS_OK;
1011 }
1012 
1013 NS_IMETHODIMP
1014 sbBaseDeviceFirmwareHandler::GetNeedsRecoveryMode(PRBool *aNeedsRecoveryMode)
1015 {
1016  TRACE(("[%s]", __FUNCTION__));
1017  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1018  NS_ENSURE_ARG_POINTER(aNeedsRecoveryMode);
1019 
1020  nsAutoMonitor mon(mMonitor);
1021  *aNeedsRecoveryMode = mNeedsRecoveryMode;
1022 
1023  return NS_OK;
1024 }
1025 
1026 NS_IMETHODIMP
1027 sbBaseDeviceFirmwareHandler::GetRecoveryMode(PRBool *aRecoveryMode)
1028 {
1029  TRACE(("[%s]", __FUNCTION__));
1030  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1031  NS_ENSURE_ARG_POINTER(aRecoveryMode);
1032 
1033  nsAutoMonitor mon(mMonitor);
1034 
1035  nsresult rv = OnGetRecoveryMode(aRecoveryMode);
1036  NS_ENSURE_SUCCESS(rv, rv);
1037 
1038  return NS_OK;
1039 }
1040 
1041 NS_IMETHODIMP
1042 sbBaseDeviceFirmwareHandler::GetDefaultFirmwareUpdate(sbIDeviceFirmwareUpdate **aFirmwareUpdate)
1043 {
1044  TRACE(("[%s]", __FUNCTION__));
1045  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1046  NS_ENSURE_ARG_POINTER(aFirmwareUpdate);
1047 
1048  *aFirmwareUpdate = nsnull;
1049 
1050  nsAutoMonitor mon(mMonitor);
1051 
1052  // No default firmware available. Return nsnull.
1053  NS_ENSURE_TRUE(mDefaultFirmwareLocation, NS_OK);
1054 
1055  PRBool schemeIsChrome = PR_FALSE;
1056  nsresult rv = mDefaultFirmwareLocation->SchemeIs("chrome",
1057  &schemeIsChrome);
1058  NS_ENSURE_SUCCESS(rv, rv);
1059 
1060  PRBool schemeIsFile = PR_FALSE;
1061  rv = mDefaultFirmwareLocation->SchemeIs("file",
1062  &schemeIsFile);
1063  NS_ENSURE_SUCCESS(rv, rv);
1064 
1065  nsCOMPtr<nsIFile> file;
1066  if(schemeIsChrome) {
1067  nsCOMPtr<nsIChromeRegistry> chromeRegistry =
1068  do_GetService("@mozilla.org/chrome/chrome-registry;1", &rv);
1069  NS_ENSURE_SUCCESS(rv, rv);
1070 
1071  nsCOMPtr<nsIURI> fileURI;
1072  rv = chromeRegistry->ConvertChromeURL(mDefaultFirmwareLocation,
1073  getter_AddRefs(fileURI));
1074  NS_ENSURE_SUCCESS(rv, rv);
1075 
1076  nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(fileURI, &rv);
1077  NS_ENSURE_SUCCESS(rv, rv);
1078 
1079  rv = fileURL->GetFile(getter_AddRefs(file));
1080  NS_ENSURE_SUCCESS(rv, rv);
1081  }
1082  else if(schemeIsFile) {
1083  nsCOMPtr<nsIFileURL> fileURL =
1084  do_QueryInterface(mDefaultFirmwareLocation, &rv);
1085  NS_ENSURE_SUCCESS(rv, rv);
1086 
1087  rv = fileURL->GetFile(getter_AddRefs(file));
1088  NS_ENSURE_SUCCESS(rv, rv);
1089  }
1090  else {
1091  // :(
1092  return NS_ERROR_INVALID_ARG;
1093  }
1094 
1095  nsCOMPtr<sbIDeviceFirmwareUpdate> firmwareUpdate =
1096  do_CreateInstance(SB_DEVICEFIRMWAREUPDATE_CONTRACTID, &rv);
1097  NS_ENSURE_SUCCESS(rv, rv);
1098 
1099  rv = firmwareUpdate->Init(file,
1102  NS_ENSURE_SUCCESS(rv, rv);
1103 
1104  firmwareUpdate.forget(aFirmwareUpdate);
1105 
1106  return NS_OK;
1107 }
1108 
1109 NS_IMETHODIMP
1110 sbBaseDeviceFirmwareHandler::GetDeviceModelNumber(nsAString &aModelNumber)
1111 {
1112  TRACE(("[%s]", __FUNCTION__));
1113  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1114 
1115  nsAutoMonitor mon(mMonitor);
1116 
1117  nsresult rv = OnGetDeviceModelNumber(aModelNumber);
1118  NS_ENSURE_SUCCESS(rv, rv);
1119 
1120  return NS_OK;
1121 }
1122 
1123 NS_IMETHODIMP
1124 sbBaseDeviceFirmwareHandler::GetDeviceModelVersion(nsAString &aModelVersion)
1125 {
1126  TRACE(("[%s]", __FUNCTION__));
1127  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1128 
1129  nsAutoMonitor mon(mMonitor);
1130 
1131  nsresult rv = OnGetDeviceModelVersion(aModelVersion);
1132  NS_ENSURE_SUCCESS(rv, rv);
1133 
1134  return NS_OK;
1135 }
1136 
1137 NS_IMETHODIMP
1138 sbBaseDeviceFirmwareHandler::GetDeviceVendor(nsAString &aDeviceVendor)
1139 {
1140  TRACE(("[%s]", __FUNCTION__));
1141  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1142 
1143  nsAutoMonitor mon(mMonitor);
1144 
1145  nsresult rv = OnGetDeviceVendor(aDeviceVendor);
1146  NS_ENSURE_SUCCESS(rv, rv);
1147 
1148  return NS_OK;
1149 }
1150 
1151 NS_IMETHODIMP
1152 sbBaseDeviceFirmwareHandler::GetSupportedDevices(
1153  nsISimpleEnumerator **aSupportedDevices)
1154 {
1155  nsAutoMonitor mon(mMonitor);
1156 
1157  *aSupportedDevices = nsnull;
1158 
1159  nsresult rv = OnGetSupportedDevices(aSupportedDevices);
1160  NS_ENSURE_SUCCESS(rv, rv);
1161 
1162  return NS_OK;
1163 }
1164 
1165 NS_IMETHODIMP
1166 sbBaseDeviceFirmwareHandler::CanUpdate(sbIDevice *aDevice,
1167  PRUint32 aDeviceVendorID,
1168  PRUint32 aDeviceProductID,
1169  PRBool *_retval)
1170 {
1171  TRACE(("[%s]", __FUNCTION__));
1172  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1173  NS_ENSURE_ARG_POINTER(_retval);
1174 
1175  nsAutoMonitor mon(mMonitor);
1176 
1177  nsresult rv = OnCanUpdate(aDevice,
1178  aDeviceVendorID,
1179  aDeviceProductID,
1180  _retval);
1181  NS_ENSURE_SUCCESS(rv, rv);
1182 
1183  return NS_OK;
1184 }
1185 
1186 NS_IMETHODIMP
1187 sbBaseDeviceFirmwareHandler::InitiateRecoveryModeSwitch(
1188  PRUint32 aDeviceVendorID,
1189  PRUint32 aDeviceProductID)
1190 {
1191  TRACE(("[%s]", __FUNCTION__));
1192  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1193 
1194  nsresult rv;
1195 
1196  nsAutoMonitor mon(mMonitor);
1197 
1198  rv = OnBeginRecoveryModeSwitch(aDeviceVendorID,
1199  aDeviceProductID);
1200  NS_ENSURE_SUCCESS(rv, rv);
1201 
1202  return NS_OK;
1203 }
1204 
1205 NS_IMETHODIMP
1206 sbBaseDeviceFirmwareHandler::Bind(sbIDevice *aDevice,
1207  sbIDeviceEventListener *aListener)
1208 {
1209  TRACE(("[%s]", __FUNCTION__));
1210  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1211  NS_ENSURE_ARG_POINTER(aDevice);
1212 
1213  nsAutoMonitor mon(mMonitor);
1214 
1215  NS_ENSURE_FALSE(mDevice, NS_ERROR_ALREADY_INITIALIZED);
1216  NS_ENSURE_FALSE(mListener, NS_ERROR_ALREADY_INITIALIZED);
1217 
1218  mDevice = aDevice;
1219  mListener = aListener;
1220 
1221  nsresult rv = OnEndRecoveryModeSwitch();
1222  NS_ENSURE_SUCCESS(rv, rv);
1223 
1224  return NS_OK;
1225 }
1226 
1227 NS_IMETHODIMP
1228 sbBaseDeviceFirmwareHandler::Rebind(sbIDevice *aDevice,
1229  sbIDeviceEventListener *aListener,
1230  PRBool *_retval)
1231 {
1232  TRACE(("[%s]", __FUNCTION__));
1233  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1234  NS_ENSURE_ARG_POINTER(aDevice);
1235  NS_ENSURE_ARG_POINTER(_retval);
1236 
1237  *_retval = PR_FALSE;
1238 
1239  nsAutoMonitor mon(mMonitor);
1240 
1241  nsresult rv = OnRebind(aDevice, aListener, _retval);
1242  NS_ENSURE_SUCCESS(rv, rv);
1243 
1244  return NS_OK;
1245 }
1246 
1247 NS_IMETHODIMP
1248 sbBaseDeviceFirmwareHandler::Unbind()
1249 {
1250  TRACE(("[%s]", __FUNCTION__));
1251  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1252 
1253  nsAutoMonitor mon(mMonitor);
1254 
1255  mDevice = nsnull;
1256  mListener = nsnull;
1257 
1258  return NS_OK;
1259 }
1260 
1261 NS_IMETHODIMP
1262 sbBaseDeviceFirmwareHandler::Cancel()
1263 {
1264  TRACE(("[%s]", __FUNCTION__));
1265  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1266 
1267  nsresult rv = OnCancel();
1268  NS_ENSURE_SUCCESS(rv, rv);
1269 
1270  return NS_OK;
1271 }
1272 
1273 NS_IMETHODIMP
1274 sbBaseDeviceFirmwareHandler::RefreshInfo()
1275 {
1276  TRACE(("[%s]", __FUNCTION__));
1277  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1278 
1279  nsresult rv = OnRefreshInfo();
1280  NS_ENSURE_SUCCESS(rv, rv);
1281 
1282  return NS_OK;
1283 }
1284 
1285 NS_IMETHODIMP
1286 sbBaseDeviceFirmwareHandler::Update(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
1287 {
1288  TRACE(("[%s]", __FUNCTION__));
1289  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1290  NS_ENSURE_ARG_POINTER(aFirmwareUpdate);
1291 
1292  nsresult rv = OnUpdate(aFirmwareUpdate);
1293  NS_ENSURE_SUCCESS(rv, rv);
1294 
1295  return NS_OK;
1296 }
1297 
1298 NS_IMETHODIMP
1299 sbBaseDeviceFirmwareHandler::Recover(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
1300 {
1301  TRACE(("[%s]", __FUNCTION__));
1302  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1303 
1304  nsresult rv = OnRecover(aFirmwareUpdate);
1305  NS_ENSURE_SUCCESS(rv, rv);
1306 
1307  return NS_OK;
1308 }
1309 
1310 NS_IMETHODIMP
1311 sbBaseDeviceFirmwareHandler::VerifyDevice()
1312 {
1313  TRACE(("[%s]", __FUNCTION__));
1314  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1315 
1316  nsresult rv = OnVerifyDevice();
1317  NS_ENSURE_SUCCESS(rv, rv);
1318 
1319  return NS_OK;
1320 }
1321 
1322 NS_IMETHODIMP
1323 sbBaseDeviceFirmwareHandler::VerifyUpdate(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
1324 {
1325  TRACE(("[%s]", __FUNCTION__));
1326  NS_ENSURE_TRUE(mMonitor, NS_ERROR_NOT_INITIALIZED);
1327 
1328  nsresult rv = OnVerifyUpdate(aFirmwareUpdate);
1329  NS_ENSURE_SUCCESS(rv, rv);
1330 
1331  return NS_OK;
1332 }
1333 
1334 // ----------------------------------------------------------------------------
1335 // nsITimerCallback
1336 // ----------------------------------------------------------------------------
1337 
1338 NS_IMETHODIMP
1339 sbBaseDeviceFirmwareHandler::Notify(nsITimer *aTimer)
1340 {
1341  TRACE(("[%s]", __FUNCTION__));
1342  NS_ENSURE_ARG_POINTER(aTimer);
1343  nsresult rv = NS_ERROR_UNEXPECTED;
1344 
1345  if(aTimer == mXMLHttpRequestTimer) {
1346  NS_ENSURE_STATE(mXMLHttpRequest);
1347 
1348  PRInt32 state = 0;
1349  rv = mXMLHttpRequest->GetReadyState(&state);
1350  NS_ENSURE_SUCCESS(rv, rv);
1351 
1352  if(state == HTTP_STATE_COMPLETED) {
1353  rv = mXMLHttpRequestTimer->Cancel();
1354  NS_ENSURE_SUCCESS(rv, rv);
1355 
1356 #ifdef PR_LOGGING
1357  nsCOMPtr<nsIChannel> channel;
1358  rv = mXMLHttpRequest->GetChannel(getter_AddRefs(channel));
1359  NS_ENSURE_SUCCESS(rv, rv);
1360 
1361  nsCOMPtr<nsIHttpChannel> httpChannel =
1362  do_QueryInterface(channel, &rv);
1363 
1364  if(NS_SUCCEEDED(rv) && httpChannel) {
1365  PRUint32 status = 0;
1366  rv = httpChannel->GetResponseStatus(&status);
1367  NS_ENSURE_SUCCESS(rv, rv);
1368 
1369  LOG(("HTTP Request Status Code: %i", status));
1370 
1371  nsCString statusText;
1372  rv = httpChannel->GetResponseStatusText(statusText);
1373  NS_ENSURE_SUCCESS(rv, rv);
1374 
1375  LOG(("HTTP Request Status Text: %s", statusText.BeginReading()));
1376  }
1377  else {
1378  LOG(("No HTTP Channel available!"));
1379  }
1380 #endif
1381 
1382  rv = OnHttpRequestCompleted();
1383  NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "OnHttpRequestCompleted failed");
1384  }
1385  }
1386 
1387  return NS_OK;
1388 }
static const PRInt32 HTTP_STATE_UNINITIALIZED
NS_IMPL_THREADSAFE_ISUPPORTS2(sbBaseDeviceFirmwareHandler, sbIDeviceFirmwareHandler, nsITimerCallback) sbBaseDeviceFirmwareHandler
virtual nsresult OnCanUpdate(sbIDevice *aDevice, PRUint32 aDeviceVendorID, PRUint32 aDeviceProductID, PRBool *_retval)
return NS_OK
virtual nsresult OnBeginRecoveryModeSwitch(PRUint32 aDeviceVendorID, PRUint32 aDeviceProductID)
inArray array
nsresult AppendSupportedDeviceProductID(const nsAString &aDeviceFriendlyName, const PRUint32 aDeviceProductID)
#define SB_DEVICEFIRMWAREUPDATE_CONTRACTID
nsCOMPtr< sbIDeviceEventListener > mProxiedListener
const NS_ERROR_ABORT
nsresult do_GetProxyForObject(nsIEventTarget *aTarget, REFNSIID aIID, nsISupports *aObj, PRInt32 aProxyType, void **aProxyObject)
var ioService
#define TRACE(args)
nsresult SetState(handlerstate_t aState)
Get internal state.
virtual nsresult OnRebind(sbIDevice *aDevice, sbIDeviceEventListener *aListener, PRBool *_retval)
nsresult CheckForError(const nsresult &aResult, PRUint32 aEventType, nsIVariant *aData=nsnull)
Check nsresult value, send error event if nsresult value is an error.
virtual nsresult OnGetCurrentFirmwareVersion(PRUint32 *aCurrentFirmwareVersion)
virtual nsresult OnGetRecoveryMode(PRBool *aRecoveryMode)
static const PRInt32 HTTP_STATE_LOADED
handlerstate_t GetState()
Set internal state.
nsresult AbortHttpRequest()
Abort an HTTP request.
nsresult SendDeviceEvent(sbIDeviceEvent *aEvent, PRBool aAsync=PR_TRUE)
Send a device event.
const sbCreateProxiedComponent do_ProxiedGetService(const nsCID &aCID, nsresult *error=0)
virtual nsresult OnGetDeviceVendor(nsAString &aDeviceVendor)
static const PRInt32 HTTP_STATE_COMPLETED
nsresult AppendSupportedDevice(const nsAString &aDeviceFriendlyName, const PRUint32 aDeviceVendorID, const PRUint32 aDeviceProductID)
Append an entry to the list of supported devices.
static const PRInt32 HTTP_STATE_LOADING
const unsigned long STATE_IDLE
Definition: sbIDevice.idl:220
grep callback
nsCOMPtr< nsIXMLHttpRequest > mXMLHttpRequest
#define SB_DEVICEFIRMWARESUPPORT_CONTRACTID
virtual nsresult OnGetDeviceModelVersion(nsAString &aModelVersion)
virtual nsresult OnVerifyUpdate(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
var uri
Definition: FeedWriter.js:1135
nsCOMPtr< nsIMutableArray > mSupportedDevices
virtual nsresult OnGetSupportedDevices(nsISimpleEnumerator **aSupportedDevices)
virtual nsresult OnRecover(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
nsresult CreateDeviceEvent(PRUint32 aType, nsIVariant *aData, sbIDeviceEvent **aEvent)
Create a device event.
static const PRInt32 HTTP_STATE_INTERACTIVE
nsresult CreateProxiedURI(const nsACString &aURISpec, nsIURI **aURI)
Create an nsIURI from a spec string (e.g. http://some.url.com/path) in a thread-safe manner...
virtual nsresult OnGetCurrentFirmwareReadableVersion(nsAString &aCurrentFirmwareReadableVersion)
nsCOMPtr< sbIDeviceEventListener > mListener
virtual nsresult OnGetDeviceModelNumber(nsAString &aModelNumber)
virtual nsresult OnUpdate(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
#define LOG(args)
restoreWindow aState
nsITimerCallback
nsresult SendHttpRequest(const nsACString &aMethod, const nsACString &aUrl, const nsAString &aUsername=EmptyString(), const nsAString &aPassword=EmptyString(), const nsACString &aContentType=EmptyCString(), nsIVariant *aRequestBody=nsnull)
Send an HTTP request.
_updateTextAndScrollDataForFrame aData
var file