OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/power_manager_client.h" | 5 #include "chromeos/dbus/power_manager_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/timer.h" | 16 #include "base/timer.h" |
17 #include "chromeos/dbus/power_state_control.pb.h" | 17 #include "chromeos/dbus/power_state_control.pb.h" |
18 #include "chromeos/dbus/power_supply_properties.pb.h" | 18 #include "chromeos/dbus/power_supply_properties.pb.h" |
19 #include "chromeos/dbus/video_detect_update.pb.h" | |
19 #include "dbus/bus.h" | 20 #include "dbus/bus.h" |
20 #include "dbus/message.h" | 21 #include "dbus/message.h" |
21 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
22 #include "dbus/object_proxy.h" | 23 #include "dbus/object_proxy.h" |
23 #include "third_party/cros_system_api/dbus/service_constants.h" | 24 #include "third_party/cros_system_api/dbus/service_constants.h" |
24 | 25 |
25 namespace chromeos { | 26 namespace chromeos { |
26 | 27 |
27 // The PowerManagerClient implementation used in production. | 28 // The PowerManagerClient implementation used in production. |
28 class PowerManagerClientImpl : public PowerManagerClient { | 29 class PowerManagerClientImpl : public PowerManagerClient { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 power_manager::kHandleUserActivityMethod); | 218 power_manager::kHandleUserActivityMethod); |
218 dbus::MessageWriter writer(&method_call); | 219 dbus::MessageWriter writer(&method_call); |
219 writer.AppendInt64(last_activity_time.ToInternalValue()); | 220 writer.AppendInt64(last_activity_time.ToInternalValue()); |
220 power_manager_proxy_->CallMethod( | 221 power_manager_proxy_->CallMethod( |
221 &method_call, | 222 &method_call, |
222 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 223 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
223 dbus::ObjectProxy::EmptyResponseCallback()); | 224 dbus::ObjectProxy::EmptyResponseCallback()); |
224 } | 225 } |
225 | 226 |
226 virtual void NotifyVideoActivity( | 227 virtual void NotifyVideoActivity( |
227 const base::TimeTicks& last_activity_time) OVERRIDE { | 228 const base::TimeTicks& last_activity_time, |
229 bool is_fullscreen) OVERRIDE { | |
228 dbus::MethodCall method_call( | 230 dbus::MethodCall method_call( |
229 power_manager::kPowerManagerInterface, | 231 power_manager::kPowerManagerInterface, |
230 power_manager::kHandleVideoActivityMethod); | 232 power_manager::kHandleVideoActivityMethod); |
231 dbus::MessageWriter writer(&method_call); | 233 dbus::MessageWriter writer(&method_call); |
232 writer.AppendInt64(last_activity_time.ToInternalValue()); | 234 |
235 VideoDetectUpdate protobuf; | |
rharrison
2012/08/30 19:16:07
I am going to change the name of this protobuf to
Daniel Erat
2012/08/30 20:33:59
agreed
| |
236 protobuf.set_last_activity_time(last_activity_time.ToInternalValue()); | |
237 protobuf.set_is_fullscreen(is_fullscreen); | |
238 | |
239 writer.AppendProtoAsArrayOfBytes(protobuf); | |
233 power_manager_proxy_->CallMethod( | 240 power_manager_proxy_->CallMethod( |
234 &method_call, | 241 &method_call, |
235 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 242 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
236 dbus::ObjectProxy::EmptyResponseCallback()); | 243 dbus::ObjectProxy::EmptyResponseCallback()); |
237 } | 244 } |
238 | 245 |
239 virtual void RequestPowerStateOverrides( | 246 virtual void RequestPowerStateOverrides( |
240 uint32 request_id, | 247 uint32 request_id, |
241 uint32 duration, | 248 uint32 duration, |
242 int overrides, | 249 int overrides, |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 | 589 |
583 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) | 590 virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) |
584 OVERRIDE { | 591 OVERRIDE { |
585 callback.Run(0); | 592 callback.Run(0); |
586 } | 593 } |
587 | 594 |
588 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} | 595 virtual void RequestIdleNotification(int64 threshold) OVERRIDE {} |
589 virtual void NotifyUserActivity( | 596 virtual void NotifyUserActivity( |
590 const base::TimeTicks& last_activity_time) OVERRIDE {} | 597 const base::TimeTicks& last_activity_time) OVERRIDE {} |
591 virtual void NotifyVideoActivity( | 598 virtual void NotifyVideoActivity( |
592 const base::TimeTicks& last_activity_time) OVERRIDE {} | 599 const base::TimeTicks& last_activity_time, |
600 bool is_fullscreen) OVERRIDE {} | |
593 virtual void RequestPowerStateOverrides( | 601 virtual void RequestPowerStateOverrides( |
594 uint32 request_id, | 602 uint32 request_id, |
595 uint32 duration, | 603 uint32 duration, |
596 int overrides, | 604 int overrides, |
597 const PowerStateRequestIdCallback& callback) OVERRIDE {} | 605 const PowerStateRequestIdCallback& callback) OVERRIDE {} |
598 virtual void SetIsProjecting(bool is_projecting) OVERRIDE {} | 606 virtual void SetIsProjecting(bool is_projecting) OVERRIDE {} |
599 | 607 |
600 virtual void NotifyScreenLockCompleted() OVERRIDE {} | 608 virtual void NotifyScreenLockCompleted() OVERRIDE {} |
601 virtual void NotifyScreenUnlockCompleted() OVERRIDE {} | 609 virtual void NotifyScreenUnlockCompleted() OVERRIDE {} |
602 | 610 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 PowerManagerClient* PowerManagerClient::Create( | 665 PowerManagerClient* PowerManagerClient::Create( |
658 DBusClientImplementationType type, | 666 DBusClientImplementationType type, |
659 dbus::Bus* bus) { | 667 dbus::Bus* bus) { |
660 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 668 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
661 return new PowerManagerClientImpl(bus); | 669 return new PowerManagerClientImpl(bus); |
662 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 670 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
663 return new PowerManagerClientStubImpl(); | 671 return new PowerManagerClientStubImpl(); |
664 } | 672 } |
665 | 673 |
666 } // namespace chromeos | 674 } // namespace chromeos |
OLD | NEW |