Bug 709585 - Part 6/6, Connect DOM and hal. r=sicking

--HG--
extra : rebase_source : e8810a8ad310b888cf6e329fce5e0ddcbd94070f
This commit is contained in:
Kan-Ru Chen 2012-01-30 17:02:53 -06:00
parent b6bf636f26
commit 1fd380c81a
3 changed files with 29 additions and 6 deletions

View File

@ -68,4 +68,6 @@ ifdef ENABLE_TESTS
DIRS += test DIRS += test
endif endif
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

View File

@ -35,9 +35,11 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsDOMClassInfoID.h"
#include "PowerManager.h" #include "PowerManager.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
#include "nsIPowerManagerService.h"
#include "nsServiceManagerUtils.h"
DOMCI_DATA(MozPowerManager, mozilla::dom::power::PowerManager) DOMCI_DATA(MozPowerManager, mozilla::dom::power::PowerManager)
@ -57,13 +59,29 @@ NS_IMPL_RELEASE(PowerManager)
NS_IMETHODIMP NS_IMETHODIMP
PowerManager::Reboot() PowerManager::Reboot()
{ {
return NS_ERROR_NOT_IMPLEMENTED; NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
nsCOMPtr<nsIPowerManagerService> pmService =
do_GetService(POWERMANAGERSERVICE_CONTRACTID);
NS_ENSURE_TRUE(pmService, NS_OK);
pmService->Reboot();
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
PowerManager::PowerOff() PowerManager::PowerOff()
{ {
return NS_ERROR_NOT_IMPLEMENTED; NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
nsCOMPtr<nsIPowerManagerService> pmService =
do_GetService(POWERMANAGERSERVICE_CONTRACTID);
NS_ENSURE_TRUE(pmService, NS_OK);
pmService->PowerOff();
return NS_OK;
} }
} // power } // power

View File

@ -35,6 +35,7 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "mozilla/Hal.h"
#include "PowerManagerService.h" #include "PowerManagerService.h"
namespace mozilla { namespace mozilla {
@ -56,13 +57,15 @@ PowerManagerService::GetInstance()
NS_IMETHODIMP NS_IMETHODIMP
PowerManagerService::Reboot() PowerManagerService::Reboot()
{ {
return NS_ERROR_NOT_IMPLEMENTED; hal::Reboot();
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
PowerManagerService::PowerOff() PowerManagerService::PowerOff()
{ {
return NS_ERROR_NOT_IMPLEMENTED; hal::PowerOff();
return NS_OK;
} }
} // power } // power