Backed out changeset 5d81f5f84779
authorScott Johnson <sjohnson@mozilla.com>
Mon, 30 Jan 2012 18:44:40 -0600
changeset 85774 f8ea7f4307ca47cd5ed10c78d9132793b369d5bc
parent 85773 5d81f5f84779072a87fb9a3714a767dfaaf3a4ed
child 85775 15ca5d162a81dad7cd563c338dfce6ea7f603aca
push id21960
push userbmo@edmorley.co.uk
push dateTue, 31 Jan 2012 10:53:23 +0000
treeherdermozilla-central@060de47a1822 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone12.0a1
backs out5d81f5f84779072a87fb9a3714a767dfaaf3a4ed
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 5d81f5f84779
dom/power/Makefile.in
dom/power/PowerManager.cpp
dom/power/PowerManagerService.cpp
--- a/dom/power/Makefile.in
+++ b/dom/power/Makefile.in
@@ -63,9 +63,11 @@ XPIDLSRCS = \
   nsIDOMPowerManager.idl \
   nsIPowerManagerService.idl \
   $(NULL)
 
 ifdef ENABLE_TESTS
 DIRS += test
 endif
 
+include $(topsrcdir)/config/config.mk
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
--- a/dom/power/PowerManager.cpp
+++ b/dom/power/PowerManager.cpp
@@ -30,19 +30,21 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "PowerManager.h"
+#include "nsContentUtils.h"
 #include "nsDOMClassInfoID.h"
-
-#include "PowerManager.h"
+#include "nsIPowerManagerService.h"
+#include "nsServiceManagerUtils.h"
 
 DOMCI_DATA(MozPowerManager, mozilla::dom::power::PowerManager)
 
 namespace mozilla {
 namespace dom {
 namespace power {
 
 NS_INTERFACE_MAP_BEGIN(PowerManager)
@@ -52,20 +54,36 @@ NS_INTERFACE_MAP_BEGIN(PowerManager)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(PowerManager)
 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
 } // dom
 } // mozilla
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -30,16 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
+#include "mozilla/Hal.h"
 #include "PowerManagerService.h"
 
 namespace mozilla {
 namespace dom {
 namespace power {
 
 NS_IMPL_ISUPPORTS1(PowerManagerService, nsIPowerManagerService)
 
@@ -51,20 +52,22 @@ PowerManagerService::GetInstance()
   pmService = new PowerManagerService();
 
   return pmService.forget();
 }
 
 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
 } // dom
 } // mozilla