Replace WTF::move with WTFMove
[WebKit-https.git] / Source / WebCore / Modules / battery / NavigatorBattery.cpp
index 6ae0c9d..412ebe2 100644 (file)
@@ -25,7 +25,6 @@
 #include "BatteryController.h"
 #include "BatteryManager.h"
 #include "Navigator.h"
-#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 
@@ -37,14 +36,14 @@ NavigatorBattery::~NavigatorBattery()
 {
 }
 
-BatteryManager* NavigatorBattery::webkitBattery(Navigator* navigator)
+BatteryManager* NavigatorBattery::webkitBattery(Navigator& navigator)
 {
-    if (!navigator->frame())
-        return 0;
+    if (!navigator.frame())
+        return nullptr;
 
-    NavigatorBattery* navigatorBattery = NavigatorBattery::from(navigator);
+    NavigatorBattery* navigatorBattery = NavigatorBattery::from(&navigator);
     if (!navigatorBattery->m_batteryManager)
-        navigatorBattery->m_batteryManager = BatteryManager::create(navigator);
+        navigatorBattery->m_batteryManager = BatteryManager::create(&navigator);
     return navigatorBattery->m_batteryManager.get();
 }
 
@@ -57,19 +56,13 @@ NavigatorBattery* NavigatorBattery::from(Navigator* navigator)
 {
     NavigatorBattery* supplement = static_cast<NavigatorBattery*>(Supplement<Navigator>::from(navigator, supplementName()));
     if (!supplement) {
-        supplement = new NavigatorBattery();
-        provideTo(navigator, supplementName(), adoptPtr(supplement));
+        auto newSupplement = std::make_unique<NavigatorBattery>();
+        supplement = newSupplement.get();
+        provideTo(navigator, supplementName(), WTFMove(newSupplement));
     }
     return supplement;
 }
 
-BatteryManager* NavigatorBattery::batteryManager()
-{
-    return m_batteryManager.get();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(BATTERY_STATUS)
-
-