Bug 790393 - Add MozPower.factoryReset() for factory reset. r=cjones, r=vingtetun, sr=sicking

This commit is contained in:
Shih-Chiang Chien 2012-10-04 17:28:34 +08:00
parent 8e09a03964
commit 6b7b4abb12
3 changed files with 26 additions and 1 deletions

View File

@ -16,6 +16,10 @@
#include "nsServiceManagerUtils.h"
#include "nsError.h"
#ifdef MOZ_WIDGET_GONK
#include "b2g.h"
#endif
DOMCI_DATA(MozPowerManager, mozilla::dom::power::PowerManager)
namespace mozilla {
@ -70,6 +74,21 @@ PowerManager::Reboot()
return NS_OK;
}
NS_IMETHODIMP
PowerManager::FactoryReset()
{
#ifdef MOZ_WIDGET_GONK
nsCOMPtr<nsIRecoveryService> recoveryService =
do_GetService("@mozilla.org/recovery-service;1");
NS_ENSURE_STATE(recoveryService);
recoveryService->FactoryReset();
return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
NS_IMETHODIMP
PowerManager::PowerOff()
{

View File

@ -10,11 +10,12 @@ interface nsIDOMMozWakeLockListener;
/**
* This interface implements navigator.mozPower
*/
[scriptable, uuid(256a3287-f528-45b5-9ba8-2b3650c056e6)]
[scriptable, uuid(7b181fef-2757-4198-89a0-8c426b8439ea)]
interface nsIDOMMozPowerManager : nsISupports
{
void powerOff();
void reboot();
void factoryReset();
/**
* The listeners are notified when a resource changes its lock state to:

View File

@ -173,6 +173,11 @@ ifdef ENABLE_TESTS
tier_platform_dirs += testing/specialpowers
endif
# b2g headers need to be built before dom headers
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
tier_platform_dirs += b2g
endif
tier_platform_dirs += \
uriloader \
caps \