Index: chromeos/dbus/power_manager_client.cc |
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc |
index 8b0adb8145da4cba16467c0e58a7b2bc6e76a0d6..f3df80190cad2cc3af54adbe60c0959a03ab9daa 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" |
@@ -806,7 +807,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( |
@@ -869,6 +878,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_; |