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

--HG--
extra : rebase_source : 8c205b3d2cd706996f92604816013b4d7b41b3c7
This commit is contained in:
Kan-Ru Chen 2012-01-19 22:25:00 -05:00
Родитель f54487e0fe
Коммит 6651530141
3 изменённых файлов: 29 добавлений и 6 удалений

Просмотреть файл

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

Просмотреть файл

@ -35,9 +35,11 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsDOMClassInfoID.h"
#include "PowerManager.h"
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
#include "nsIPowerManagerService.h"
#include "nsServiceManagerUtils.h"
DOMCI_DATA(MozPowerManager, mozilla::dom::power::PowerManager)
@ -57,13 +59,29 @@ NS_IMPL_RELEASE(PowerManager)
NS_IMETHODIMP
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
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

Просмотреть файл

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