|
@@ -84,19 +84,19 @@ void PowerMonitor::OnResume() {
|
|
|
Emit("resume");
|
|
|
}
|
|
|
|
|
|
-void PowerMonitor::QuerySystemIdleState(v8::Isolate* isolate,
|
|
|
- int idle_threshold,
|
|
|
- const ui::IdleCallback& callback) {
|
|
|
+ui::IdleState PowerMonitor::QuerySystemIdleState(v8::Isolate* isolate,
|
|
|
+ int idle_threshold) {
|
|
|
if (idle_threshold > 0) {
|
|
|
- ui::CalculateIdleState(idle_threshold, callback);
|
|
|
+ return ui::CalculateIdleState(idle_threshold);
|
|
|
} else {
|
|
|
isolate->ThrowException(v8::Exception::TypeError(mate::StringToV8(
|
|
|
isolate, "Invalid idle threshold, must be greater than 0")));
|
|
|
+ return ui::IDLE_STATE_UNKNOWN;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void PowerMonitor::QuerySystemIdleTime(const ui::IdleTimeCallback& callback) {
|
|
|
- ui::CalculateIdleTime(callback);
|
|
|
+int PowerMonitor::QuerySystemIdleTime() {
|
|
|
+ return ui::CalculateIdleTime();
|
|
|
}
|
|
|
|
|
|
// static
|
|
@@ -122,8 +122,8 @@ void PowerMonitor::BuildPrototype(v8::Isolate* isolate,
|
|
|
.SetMethod("blockShutdown", &PowerMonitor::BlockShutdown)
|
|
|
.SetMethod("unblockShutdown", &PowerMonitor::UnblockShutdown)
|
|
|
#endif
|
|
|
- .SetMethod("querySystemIdleState", &PowerMonitor::QuerySystemIdleState)
|
|
|
- .SetMethod("querySystemIdleTime", &PowerMonitor::QuerySystemIdleTime);
|
|
|
+ .SetMethod("_querySystemIdleState", &PowerMonitor::QuerySystemIdleState)
|
|
|
+ .SetMethod("_querySystemIdleTime", &PowerMonitor::QuerySystemIdleTime);
|
|
|
}
|
|
|
|
|
|
} // namespace api
|