feat: add powerMonitor.onBatteryPower (#26494)
This commit is contained in:
parent
8594b55dee
commit
a9924e1c32
4 changed files with 38 additions and 2 deletions
|
@ -136,6 +136,10 @@ int GetSystemIdleTime() {
|
|||
return ui::CalculateIdleTime();
|
||||
}
|
||||
|
||||
bool IsOnBatteryPower() {
|
||||
return base::PowerMonitor::IsOnBatteryPower();
|
||||
}
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
|
@ -147,6 +151,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
dict.SetMethod("getSystemIdleState",
|
||||
base::BindRepeating(&GetSystemIdleState));
|
||||
dict.SetMethod("getSystemIdleTime", base::BindRepeating(&GetSystemIdleTime));
|
||||
dict.SetMethod("isOnBatteryPower", base::BindRepeating(&IsOnBatteryPower));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue