Commit fd6583a2 authored by tbarzic@chromium.org's avatar tbarzic@chromium.org

Increased battery time to empty sent by power manager client stub implementation.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/8555018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110013 0039d316-1c4b-4281-b951-d872f2087c98
parent 1e7ed352
......@@ -276,7 +276,7 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
if (!timer_.IsRunning()) {
timer_.Start(
FROM_HERE,
base::TimeDelta::FromMilliseconds(100),
base::TimeDelta::FromMilliseconds(1000),
this,
&PowerManagerClientStubImpl::Update);
} else {
......@@ -301,20 +301,25 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
pause_count_ = 0;
discharging_ = !discharging_;
} else {
pause_count_ = 20;
// Pause twice (i.e. skip updating the menu), including the current
// call to this function.
pause_count_ = 2;
return;
}
}
battery_percentage_ += (discharging_ ? -1 : 1);
const int kSecondsToEmptyFullBattery(3 * 60 * 60); // 3 hours.
PowerSupplyStatus status;
status.line_power_on = !discharging_;
status.battery_is_present = true;
status.battery_percentage = battery_percentage_;
status.battery_seconds_to_empty =
std::max(1, battery_percentage_ * 180 / 100);
std::max(1, battery_percentage_ * kSecondsToEmptyFullBattery / 100);
status.battery_seconds_to_full =
std::max(static_cast<int64>(1), 180 - status.battery_seconds_to_empty);
std::max(static_cast<int64>(1),
kSecondsToEmptyFullBattery - status.battery_seconds_to_empty);
FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(status));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment