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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 power_manager_proxy_->CallMethod( | 721 power_manager_proxy_->CallMethod( |
722 &method_call, | 722 &method_call, |
723 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 723 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
724 dbus::ObjectProxy::EmptyResponseCallback()); | 724 dbus::ObjectProxy::EmptyResponseCallback()); |
725 } | 725 } |
726 | 726 |
727 // Origin thread (i.e. the UI thread in production). | 727 // Origin thread (i.e. the UI thread in production). |
728 base::PlatformThreadId origin_thread_id_; | 728 base::PlatformThreadId origin_thread_id_; |
729 | 729 |
730 dbus::ObjectProxy* power_manager_proxy_; | 730 dbus::ObjectProxy* power_manager_proxy_; |
731 ObserverList<Observer> observers_; | 731 base::ObserverList<Observer> observers_; |
732 | 732 |
733 // The delay_id_ obtained from the RegisterSuspendDelay request. | 733 // The delay_id_ obtained from the RegisterSuspendDelay request. |
734 int32_t suspend_delay_id_; | 734 int32_t suspend_delay_id_; |
735 bool has_suspend_delay_id_; | 735 bool has_suspend_delay_id_; |
736 | 736 |
737 // The delay_id_ obtained from the RegisterDarkSuspendDelay request. | 737 // The delay_id_ obtained from the RegisterDarkSuspendDelay request. |
738 int32_t dark_suspend_delay_id_; | 738 int32_t dark_suspend_delay_id_; |
739 bool has_dark_suspend_delay_id_; | 739 bool has_dark_suspend_delay_id_; |
740 | 740 |
741 // powerd-supplied ID corresponding to an imminent suspend attempt that is | 741 // powerd-supplied ID corresponding to an imminent suspend attempt that is |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 power_cycle_delay_ = base::TimeDelta::FromSeconds(seconds); | 969 power_cycle_delay_ = base::TimeDelta::FromSeconds(seconds); |
970 } | 970 } |
971 } | 971 } |
972 | 972 |
973 base::TimeDelta power_cycle_delay_; // Time over which to cycle power state | 973 base::TimeDelta power_cycle_delay_; // Time over which to cycle power state |
974 bool discharging_; | 974 bool discharging_; |
975 int battery_percentage_; | 975 int battery_percentage_; |
976 double brightness_; | 976 double brightness_; |
977 int pause_count_; | 977 int pause_count_; |
978 int cycle_count_; | 978 int cycle_count_; |
979 ObserverList<Observer> observers_; | 979 base::ObserverList<Observer> observers_; |
980 base::RepeatingTimer<PowerManagerClientStubImpl> update_timer_; | 980 base::RepeatingTimer<PowerManagerClientStubImpl> update_timer_; |
981 power_manager::PowerSupplyProperties props_; | 981 power_manager::PowerSupplyProperties props_; |
982 | 982 |
983 // Number of callbacks returned by GetSuspendReadinessCallback() but not yet | 983 // Number of callbacks returned by GetSuspendReadinessCallback() but not yet |
984 // invoked. | 984 // invoked. |
985 int num_pending_suspend_readiness_callbacks_; | 985 int num_pending_suspend_readiness_callbacks_; |
986 | 986 |
987 // Note: This should remain the last member so it'll be destroyed and | 987 // Note: This should remain the last member so it'll be destroyed and |
988 // invalidate its weak pointers before any other members are destroyed. | 988 // invalidate its weak pointers before any other members are destroyed. |
989 base::WeakPtrFactory<PowerManagerClientStubImpl> weak_ptr_factory_; | 989 base::WeakPtrFactory<PowerManagerClientStubImpl> weak_ptr_factory_; |
990 }; | 990 }; |
991 | 991 |
992 PowerManagerClient::PowerManagerClient() { | 992 PowerManagerClient::PowerManagerClient() { |
993 } | 993 } |
994 | 994 |
995 PowerManagerClient::~PowerManagerClient() { | 995 PowerManagerClient::~PowerManagerClient() { |
996 } | 996 } |
997 | 997 |
998 // static | 998 // static |
999 PowerManagerClient* PowerManagerClient::Create( | 999 PowerManagerClient* PowerManagerClient::Create( |
1000 DBusClientImplementationType type) { | 1000 DBusClientImplementationType type) { |
1001 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 1001 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
1002 return new PowerManagerClientImpl(); | 1002 return new PowerManagerClientImpl(); |
1003 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 1003 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
1004 return new PowerManagerClientStubImpl(); | 1004 return new PowerManagerClientStubImpl(); |
1005 } | 1005 } |
1006 | 1006 |
1007 } // namespace chromeos | 1007 } // namespace chromeos |
OLD | NEW |