Index: chromeos/dbus/power_manager_client.cc |
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc |
index 0dfa12b4e8d4b3076cd25e3a8aef93e4e1274252..811974410823ab3b64b40275ba83aa60f7252263 100644 |
--- a/chromeos/dbus/power_manager_client.cc |
+++ b/chromeos/dbus/power_manager_client.cc |
@@ -10,6 +10,7 @@ |
#include "base/callback.h" |
#include "base/format_macros.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/message_loop.h" |
#include "base/observer_list.h" |
#include "base/stringprintf.h" |
#include "base/threading/platform_thread.h" |
@@ -800,7 +801,15 @@ class PowerManagerClientStubImpl : public PowerManagerClient { |
callback.Run(0); |
} |
- virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} |
+ virtual void RequestIdleNotification(int64 threshold) OVERRIDE { |
+ MessageLoop::current()->PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&PowerManagerClientStubImpl::TriggerIdleNotify, |
+ base::Unretained(this), |
+ threshold), |
+ base::TimeDelta::FromMilliseconds(threshold)); |
+ } |
+ |
virtual void NotifyUserActivity( |
const base::TimeTicks& last_activity_time) OVERRIDE {} |
virtual void NotifyVideoActivity( |
@@ -863,6 +872,10 @@ class PowerManagerClientStubImpl : public PowerManagerClient { |
BrightnessChanged(brightness_level, user_initiated)); |
} |
+ void TriggerIdleNotify(int64 threshold) { |
+ FOR_EACH_OBSERVER(Observer, observers_, IdleNotify(threshold)); |
+ } |
+ |
bool discharging_; |
int battery_percentage_; |
double brightness_; |