Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1961)

Unified Diff: Source/modules/battery/NavigatorBattery.cpp

Issue 329723005: Battery Status API: blink promise implementation and layout tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert to a single resolver at a time Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/battery/NavigatorBattery.h ('k') | Source/modules/battery/NavigatorBattery.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/battery/NavigatorBattery.cpp
diff --git a/Source/modules/battery/NavigatorBattery.cpp b/Source/modules/battery/NavigatorBattery.cpp
index caaff759521c652ec60c0a3cd7d7c2bc01d6a656..b72e98f728fdc6b08e889b30b84fb271ccea0751 100644
--- a/Source/modules/battery/NavigatorBattery.cpp
+++ b/Source/modules/battery/NavigatorBattery.cpp
@@ -18,16 +18,17 @@ NavigatorBattery::~NavigatorBattery()
{
}
-BatteryManager* NavigatorBattery::battery(Navigator& navigator)
+ScriptPromise NavigatorBattery::getBattery(ScriptState* scriptState, Navigator& navigator)
{
- return NavigatorBattery::from(navigator).batteryManager(navigator);
+ return NavigatorBattery::from(navigator).getBattery(scriptState);
}
-BatteryManager* NavigatorBattery::batteryManager(Navigator& navigator)
+ScriptPromise NavigatorBattery::getBattery(ScriptState* scriptState)
{
- if (!m_batteryManager && navigator.frame())
- m_batteryManager = BatteryManager::create(navigator.frame()->document());
- return m_batteryManager.get();
+ if (!m_batteryManager)
+ m_batteryManager = BatteryManager::create(scriptState->executionContext());
+
+ return m_batteryManager->startRequest(scriptState);
}
const char* NavigatorBattery::supplementName()
« no previous file with comments | « Source/modules/battery/NavigatorBattery.h ('k') | Source/modules/battery/NavigatorBattery.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698