summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 17:01:47 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 17:01:47 +0000
commit6502068a36264c55059947a7c1f9f7506be52de8 (patch)
treeb5948ef57e7e6a09628cdfed52c902c5fa82935c /chromeos
parent5e29a201ab6458eba739ffe43f9659e37bd2e559 (diff)
downloadchromium_src-6502068a36264c55059947a7c1f9f7506be52de8.zip
chromium_src-6502068a36264c55059947a7c1f9f7506be52de8.tar.gz
chromium_src-6502068a36264c55059947a7c1f9f7506be52de8.tar.bz2
chromeos: Notify powerd about video activity via D-Bus.
This removes the old code that set a _CHROME_VIDEO_TIME property on the X root window and replaces it with code that makes a HandleVideoActivity method call to powerd. BUG=chromium-os:31351 TEST=manual: went to youtube and checked that powerd logs "Got HandleVideoActivity method call" every five seconds Review URL: https://chromiumcodereview.appspot.com/10456056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/mock_power_manager_client.h1
-rw-r--r--chromeos/dbus/power_manager_client.cc15
-rw-r--r--chromeos/dbus/power_manager_client.h5
3 files changed, 21 insertions, 0 deletions
diff --git a/chromeos/dbus/mock_power_manager_client.h b/chromeos/dbus/mock_power_manager_client.h
index 5d03e31..fc32e34 100644
--- a/chromeos/dbus/mock_power_manager_client.h
+++ b/chromeos/dbus/mock_power_manager_client.h
@@ -31,6 +31,7 @@ class MockPowerManagerClient : public PowerManagerClient {
MOCK_METHOD1(CalculateIdleTime, void(const CalculateIdleTimeCallback&));
MOCK_METHOD1(RequestIdleNotification, void(int64));
MOCK_METHOD0(RequestActiveNotification, void(void));
+ MOCK_METHOD1(NotifyVideoActivity, void(const base::TimeTicks&));
MOCK_METHOD4(RequestPowerStateOverrides,
void(uint32,
uint32,
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index be2440a..6a57552 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -239,6 +239,19 @@ class PowerManagerClientImpl : public PowerManagerClient {
RequestIdleNotification(0);
}
+ virtual void NotifyVideoActivity(
+ const base::TimeTicks& last_activity_time) OVERRIDE {
+ dbus::MethodCall method_call(
+ power_manager::kPowerManagerInterface,
+ power_manager::kHandleVideoActivityMethod);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendInt64(last_activity_time.ToInternalValue());
+ power_manager_proxy_->CallMethod(
+ &method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ dbus::ObjectProxy::EmptyResponseCallback());
+ }
+
virtual void RequestPowerStateOverrides(
uint32 request_id,
uint32 duration,
@@ -640,6 +653,8 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
virtual void RequestIdleNotification(int64 threshold) OVERRIDE {}
virtual void RequestActiveNotification() OVERRIDE {}
+ virtual void NotifyVideoActivity(
+ const base::TimeTicks& last_activity_time) OVERRIDE {}
virtual void RequestPowerStateOverrides(
uint32 request_id,
uint32 duration,
diff --git a/chromeos/dbus/power_manager_client.h b/chromeos/dbus/power_manager_client.h
index c52c28e..d172c93 100644
--- a/chromeos/dbus/power_manager_client.h
+++ b/chromeos/dbus/power_manager_client.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/time.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/dbus_client_implementation_type.h"
@@ -171,6 +172,10 @@ class CHROMEOS_EXPORT PowerManagerClient {
// NOTE: Like the previous request, this will also get triggered exactly once.
virtual void RequestActiveNotification() = 0;
+ // Notifies the power manager that a video is currently playing.
+ virtual void NotifyVideoActivity(
+ const base::TimeTicks& last_activity_time) = 0;
+
// Override the current power state on the machine. The overrides will be
// applied to the request ID specified. To specify a new request; use 0 as
// the request id and the method will call the provided callback with the