| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1 | // Automatic generation of D-Bus interfaces: | 
|  | 2 | //  - org.chromium.PowerManager | 
|  | 3 | #ifndef ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_TMP_PORTAGE_CHROMEOS_BASE_POWER_MANAGER_9999_WORK_BUILD_OUT_DEFAULT_GEN_INCLUDE_POWER_MANAGER_DBUS_PROXIES_H | 
|  | 4 | #define ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_TMP_PORTAGE_CHROMEOS_BASE_POWER_MANAGER_9999_WORK_BUILD_OUT_DEFAULT_GEN_INCLUDE_POWER_MANAGER_DBUS_PROXIES_H | 
|  | 5 | #include <memory> | 
|  | 6 | #include <string> | 
|  | 7 | #include <vector> | 
|  | 8 |  | 
|  | 9 | #include <base/bind.h> | 
|  | 10 | #include <base/callback.h> | 
|  | 11 | #include <base/logging.h> | 
|  | 12 | #include <base/macros.h> | 
|  | 13 | #include <base/memory/ref_counted.h> | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 14 | #include <brillo/any.h> | 
|  | 15 | #include <brillo/dbus/dbus_method_invoker.h> | 
|  | 16 | #include <brillo/dbus/dbus_property.h> | 
|  | 17 | #include <brillo/dbus/dbus_signal_handler.h> | 
|  | 18 | #include <brillo/errors/error.h> | 
|  | 19 | #include <brillo/variant_dictionary.h> | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 20 | #include <dbus/bus.h> | 
|  | 21 | #include <dbus/message.h> | 
|  | 22 | #include <dbus/object_manager.h> | 
|  | 23 | #include <dbus/object_path.h> | 
|  | 24 | #include <dbus/object_proxy.h> | 
|  | 25 |  | 
|  | 26 | namespace org { | 
|  | 27 | namespace chromium { | 
|  | 28 |  | 
|  | 29 | // Abstract interface proxy for org::chromium::PowerManager. | 
|  | 30 | class PowerManagerProxyInterface { | 
|  | 31 | public: | 
|  | 32 | virtual ~PowerManagerProxyInterface() = default; | 
|  | 33 |  | 
|  | 34 | virtual bool RequestShutdown( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 35 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 36 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 37 |  | 
|  | 38 | virtual void RequestShutdownAsync( | 
|  | 39 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 40 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 41 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 42 |  | 
|  | 43 | // The |reason| arg is a power_manager::RequestRestartReason value. | 
|  | 44 | virtual bool RequestRestart( | 
|  | 45 | int32_t in_reason, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 46 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 47 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 48 |  | 
|  | 49 | // The |reason| arg is a power_manager::RequestRestartReason value. | 
|  | 50 | virtual void RequestRestartAsync( | 
|  | 51 | int32_t in_reason, | 
|  | 52 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 53 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 54 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 55 |  | 
|  | 56 | // The |external_wakeup_count| arg is optional, and it will call two | 
|  | 57 | // different methods in the backend. This can't be expressed in the DBus | 
|  | 58 | // Introspection XML file. | 
|  | 59 | virtual bool RequestSuspend( | 
|  | 60 | uint64_t in_external_wakeup_count, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 61 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 62 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 63 |  | 
|  | 64 | // The |external_wakeup_count| arg is optional, and it will call two | 
|  | 65 | // different methods in the backend. This can't be expressed in the DBus | 
|  | 66 | // Introspection XML file. | 
|  | 67 | virtual void RequestSuspendAsync( | 
|  | 68 | uint64_t in_external_wakeup_count, | 
|  | 69 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 70 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 71 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 72 |  | 
|  | 73 | virtual bool DecreaseScreenBrightness( | 
|  | 74 | bool in_allow_off, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 75 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 76 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 77 |  | 
|  | 78 | virtual void DecreaseScreenBrightnessAsync( | 
|  | 79 | bool in_allow_off, | 
|  | 80 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 81 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 82 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 83 |  | 
|  | 84 | virtual bool IncreaseScreenBrightness( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 85 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 86 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 87 |  | 
|  | 88 | virtual void IncreaseScreenBrightnessAsync( | 
|  | 89 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 90 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 91 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 92 |  | 
|  | 93 | virtual bool GetScreenBrightnessPercent( | 
|  | 94 | double* out_percent, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 95 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 96 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 97 |  | 
|  | 98 | virtual void GetScreenBrightnessPercentAsync( | 
|  | 99 | const base::Callback<void(double /*percent*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 100 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 101 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 102 |  | 
|  | 103 | // The |style| arg must be one of the values: | 
|  | 104 | //   power_manager::kBrightnessTransitionGradual or | 
|  | 105 | //   power_manager::kBrightnessTransitionInstant. | 
|  | 106 | virtual bool SetScreenBrightnessPercent( | 
|  | 107 | double in_percent, | 
|  | 108 | int32_t in_style, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 109 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 110 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 111 |  | 
|  | 112 | // The |style| arg must be one of the values: | 
|  | 113 | //   power_manager::kBrightnessTransitionGradual or | 
|  | 114 | //   power_manager::kBrightnessTransitionInstant. | 
|  | 115 | virtual void SetScreenBrightnessPercentAsync( | 
|  | 116 | double in_percent, | 
|  | 117 | int32_t in_style, | 
|  | 118 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 119 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 120 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 121 |  | 
|  | 122 | virtual bool DecreaseKeyboardBrightness( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 123 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 124 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 125 |  | 
|  | 126 | virtual void DecreaseKeyboardBrightnessAsync( | 
|  | 127 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 128 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 129 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 130 |  | 
|  | 131 | virtual bool IncreaseKeyboardBrightness( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 132 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 133 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 134 |  | 
|  | 135 | virtual void IncreaseKeyboardBrightnessAsync( | 
|  | 136 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 137 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 138 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 139 |  | 
|  | 140 | // The |serialized_proto| arg is a serialized | 
|  | 141 | // power_manager::PowerSupplyProperties protobuf. | 
|  | 142 | virtual bool GetPowerSupplyProperties( | 
|  | 143 | std::vector<uint8_t>* out_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 144 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 145 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 146 |  | 
|  | 147 | // The |serialized_proto| arg is a serialized | 
|  | 148 | // power_manager::PowerSupplyProperties protobuf. | 
|  | 149 | virtual void GetPowerSupplyPropertiesAsync( | 
|  | 150 | const base::Callback<void(const std::vector<uint8_t>& /*serialized_proto*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 151 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 152 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 153 |  | 
|  | 154 | virtual bool HandleVideoActivity( | 
|  | 155 | bool in_fullscreen, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 156 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 157 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 158 |  | 
|  | 159 | virtual void HandleVideoActivityAsync( | 
|  | 160 | bool in_fullscreen, | 
|  | 161 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 162 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 163 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 164 |  | 
|  | 165 | // The |type| arg is a power_manager::UserActivityType. | 
|  | 166 | virtual bool HandleUserActivity( | 
|  | 167 | int32_t in_type, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 168 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 169 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 170 |  | 
|  | 171 | // The |type| arg is a power_manager::UserActivityType. | 
|  | 172 | virtual void HandleUserActivityAsync( | 
|  | 173 | int32_t in_type, | 
|  | 174 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 175 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 176 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 177 |  | 
|  | 178 | virtual bool SetIsProjecting( | 
|  | 179 | bool in_is_projecting, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 180 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 181 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 182 |  | 
|  | 183 | virtual void SetIsProjectingAsync( | 
|  | 184 | bool in_is_projecting, | 
|  | 185 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 186 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 187 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 188 |  | 
|  | 189 | // The |serialized_proto| arg is a serialized | 
|  | 190 | // power_manager::PowerManagementPolicy protobuf. | 
|  | 191 | virtual bool SetPolicy( | 
|  | 192 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 193 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 194 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 195 |  | 
|  | 196 | // The |serialized_proto| arg is a serialized | 
|  | 197 | // power_manager::PowerManagementPolicy protobuf. | 
|  | 198 | virtual void SetPolicyAsync( | 
|  | 199 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 200 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 201 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 202 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 203 |  | 
|  | 204 | virtual bool SetPowerSource( | 
|  | 205 | const std::string& in_id, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 206 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 207 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 208 |  | 
|  | 209 | virtual void SetPowerSourceAsync( | 
|  | 210 | const std::string& in_id, | 
|  | 211 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 212 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 213 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 214 |  | 
|  | 215 | // The |timestamp_internal| arg is represented as the return value of | 
|  | 216 | // base::TimeTicks::ToInternalValue(). | 
|  | 217 | virtual bool HandlePowerButtonAcknowledgment( | 
|  | 218 | int64_t in_timestamp_internal, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 219 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 220 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 221 |  | 
|  | 222 | // The |timestamp_internal| arg is represented as the return value of | 
|  | 223 | // base::TimeTicks::ToInternalValue(). | 
|  | 224 | virtual void HandlePowerButtonAcknowledgmentAsync( | 
|  | 225 | int64_t in_timestamp_internal, | 
|  | 226 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 227 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 228 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 229 |  | 
|  | 230 | // The |serialized_request_proto| arg is a serialized | 
|  | 231 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 232 | // The |serialized_reply_proto| arg is a serialized | 
|  | 233 | // RegisterSuspendDelayReply protobuf. | 
|  | 234 | virtual bool RegisterSuspendDelay( | 
|  | 235 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 236 | std::vector<uint8_t>* out_serialized_reply_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 237 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 238 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 239 |  | 
|  | 240 | // The |serialized_request_proto| arg is a serialized | 
|  | 241 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 242 | // The |serialized_reply_proto| arg is a serialized | 
|  | 243 | // RegisterSuspendDelayReply protobuf. | 
|  | 244 | virtual void RegisterSuspendDelayAsync( | 
|  | 245 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 246 | const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 247 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 248 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 249 |  | 
|  | 250 | // The |serialized_proto| arg is a serialized | 
|  | 251 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 252 | virtual bool UnregisterSuspendDelay( | 
|  | 253 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 254 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 255 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 256 |  | 
|  | 257 | // The |serialized_proto| arg is a serialized | 
|  | 258 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 259 | virtual void UnregisterSuspendDelayAsync( | 
|  | 260 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 261 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 262 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 263 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 264 |  | 
|  | 265 | // The |serialized_proto| arg is a serialized | 
|  | 266 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 267 | virtual bool HandleSuspendReadiness( | 
|  | 268 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 269 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 270 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 271 |  | 
|  | 272 | // The |serialized_proto| arg is a serialized | 
|  | 273 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 274 | virtual void HandleSuspendReadinessAsync( | 
|  | 275 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 276 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 277 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 278 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 279 |  | 
|  | 280 | // The |serialized_request_proto| arg is a serialized | 
|  | 281 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 282 | // The |serialized_reply_proto| arg is a serialized | 
|  | 283 | // RegisterSuspendDelayReply protobuf. | 
|  | 284 | virtual bool RegisterDarkSuspendDelay( | 
|  | 285 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 286 | std::vector<uint8_t>* out_serialized_reply_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 287 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 288 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 289 |  | 
|  | 290 | // The |serialized_request_proto| arg is a serialized | 
|  | 291 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 292 | // The |serialized_reply_proto| arg is a serialized | 
|  | 293 | // RegisterSuspendDelayReply protobuf. | 
|  | 294 | virtual void RegisterDarkSuspendDelayAsync( | 
|  | 295 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 296 | const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 297 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 298 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 299 |  | 
|  | 300 | // The |serialized_proto| arg is a serialized | 
|  | 301 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 302 | virtual bool UnregisterDarkSuspendDelay( | 
|  | 303 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 304 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 305 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 306 |  | 
|  | 307 | // The |serialized_proto| arg is a serialized | 
|  | 308 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 309 | virtual void UnregisterDarkSuspendDelayAsync( | 
|  | 310 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 311 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 312 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 313 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 314 |  | 
|  | 315 | // The |serialized_proto| arg is a serialized | 
|  | 316 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 317 | virtual bool HandleDarkSuspendReadiness( | 
|  | 318 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 319 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 320 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 321 |  | 
|  | 322 | // The |serialized_proto| arg is a serialized | 
|  | 323 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 324 | virtual void HandleDarkSuspendReadinessAsync( | 
|  | 325 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 326 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 327 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 328 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 329 |  | 
|  | 330 | // The |serialized_proto| arg is a serialized | 
|  | 331 | // power_manager::DarkResumeWakeReason protobuf. | 
|  | 332 | virtual bool RecordDarkResumeWakeReason( | 
|  | 333 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 334 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 335 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 336 |  | 
|  | 337 | // The |serialized_proto| arg is a serialized | 
|  | 338 | // power_manager::DarkResumeWakeReason protobuf. | 
|  | 339 | virtual void RecordDarkResumeWakeReasonAsync( | 
|  | 340 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 341 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 342 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 343 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; | 
|  | 344 |  | 
|  | 345 | virtual void RegisterBrightnessChangedSignalHandler( | 
|  | 346 | const base::Callback<void(int32_t, | 
|  | 347 | bool)>& signal_callback, | 
|  | 348 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 349 |  | 
|  | 350 | virtual void RegisterKeyboardBrightnessChangedSignalHandler( | 
|  | 351 | const base::Callback<void(int32_t, | 
|  | 352 | bool)>& signal_callback, | 
|  | 353 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 354 |  | 
|  | 355 | virtual void RegisterPeripheralBatteryStatusSignalHandler( | 
|  | 356 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 357 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 358 |  | 
|  | 359 | virtual void RegisterPowerSupplyPollSignalHandler( | 
|  | 360 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 361 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 362 |  | 
|  | 363 | virtual void RegisterSuspendImminentSignalHandler( | 
|  | 364 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 365 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 366 |  | 
|  | 367 | virtual void RegisterSuspendDoneSignalHandler( | 
|  | 368 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 369 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 370 |  | 
|  | 371 | virtual void RegisterDarkSuspendImminentSignalHandler( | 
|  | 372 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 373 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 374 |  | 
|  | 375 | virtual void RegisterInputEventSignalHandler( | 
|  | 376 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 377 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 378 |  | 
|  | 379 | virtual void RegisterIdleActionImminentSignalHandler( | 
|  | 380 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 381 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 382 |  | 
|  | 383 | virtual void RegisterIdleActionDeferredSignalHandler( | 
|  | 384 | const base::Closure& signal_callback, | 
|  | 385 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; | 
|  | 386 | }; | 
|  | 387 |  | 
|  | 388 | }  // namespace chromium | 
|  | 389 | }  // namespace org | 
|  | 390 |  | 
|  | 391 | namespace org { | 
|  | 392 | namespace chromium { | 
|  | 393 |  | 
|  | 394 | // Interface proxy for org::chromium::PowerManager. | 
|  | 395 | class PowerManagerProxy final : public PowerManagerProxyInterface { | 
|  | 396 | public: | 
|  | 397 | PowerManagerProxy(const scoped_refptr<dbus::Bus>& bus) : | 
|  | 398 | bus_{bus}, | 
|  | 399 | dbus_object_proxy_{ | 
|  | 400 | bus_->GetObjectProxy(service_name_, object_path_)} { | 
|  | 401 | } | 
|  | 402 |  | 
|  | 403 | ~PowerManagerProxy() override { | 
|  | 404 | bus_->RemoveObjectProxy( | 
|  | 405 | service_name_, object_path_, base::Bind(&base::DoNothing)); | 
|  | 406 | } | 
|  | 407 |  | 
|  | 408 | void RegisterBrightnessChangedSignalHandler( | 
|  | 409 | const base::Callback<void(int32_t, | 
|  | 410 | bool)>& signal_callback, | 
|  | 411 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 412 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 413 | dbus_object_proxy_, | 
|  | 414 | "org.chromium.PowerManager", | 
|  | 415 | "BrightnessChanged", | 
|  | 416 | signal_callback, | 
|  | 417 | on_connected_callback); | 
|  | 418 | } | 
|  | 419 |  | 
|  | 420 | void RegisterKeyboardBrightnessChangedSignalHandler( | 
|  | 421 | const base::Callback<void(int32_t, | 
|  | 422 | bool)>& signal_callback, | 
|  | 423 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 424 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 425 | dbus_object_proxy_, | 
|  | 426 | "org.chromium.PowerManager", | 
|  | 427 | "KeyboardBrightnessChanged", | 
|  | 428 | signal_callback, | 
|  | 429 | on_connected_callback); | 
|  | 430 | } | 
|  | 431 |  | 
|  | 432 | void RegisterPeripheralBatteryStatusSignalHandler( | 
|  | 433 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 434 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 435 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 436 | dbus_object_proxy_, | 
|  | 437 | "org.chromium.PowerManager", | 
|  | 438 | "PeripheralBatteryStatus", | 
|  | 439 | signal_callback, | 
|  | 440 | on_connected_callback); | 
|  | 441 | } | 
|  | 442 |  | 
|  | 443 | void RegisterPowerSupplyPollSignalHandler( | 
|  | 444 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 445 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 446 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 447 | dbus_object_proxy_, | 
|  | 448 | "org.chromium.PowerManager", | 
|  | 449 | "PowerSupplyPoll", | 
|  | 450 | signal_callback, | 
|  | 451 | on_connected_callback); | 
|  | 452 | } | 
|  | 453 |  | 
|  | 454 | void RegisterSuspendImminentSignalHandler( | 
|  | 455 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 456 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 457 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 458 | dbus_object_proxy_, | 
|  | 459 | "org.chromium.PowerManager", | 
|  | 460 | "SuspendImminent", | 
|  | 461 | signal_callback, | 
|  | 462 | on_connected_callback); | 
|  | 463 | } | 
|  | 464 |  | 
|  | 465 | void RegisterSuspendDoneSignalHandler( | 
|  | 466 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 467 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 468 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 469 | dbus_object_proxy_, | 
|  | 470 | "org.chromium.PowerManager", | 
|  | 471 | "SuspendDone", | 
|  | 472 | signal_callback, | 
|  | 473 | on_connected_callback); | 
|  | 474 | } | 
|  | 475 |  | 
|  | 476 | void RegisterDarkSuspendImminentSignalHandler( | 
|  | 477 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 478 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 479 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 480 | dbus_object_proxy_, | 
|  | 481 | "org.chromium.PowerManager", | 
|  | 482 | "DarkSuspendImminent", | 
|  | 483 | signal_callback, | 
|  | 484 | on_connected_callback); | 
|  | 485 | } | 
|  | 486 |  | 
|  | 487 | void RegisterInputEventSignalHandler( | 
|  | 488 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 489 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 490 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 491 | dbus_object_proxy_, | 
|  | 492 | "org.chromium.PowerManager", | 
|  | 493 | "InputEvent", | 
|  | 494 | signal_callback, | 
|  | 495 | on_connected_callback); | 
|  | 496 | } | 
|  | 497 |  | 
|  | 498 | void RegisterIdleActionImminentSignalHandler( | 
|  | 499 | const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, | 
|  | 500 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 501 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 502 | dbus_object_proxy_, | 
|  | 503 | "org.chromium.PowerManager", | 
|  | 504 | "IdleActionImminent", | 
|  | 505 | signal_callback, | 
|  | 506 | on_connected_callback); | 
|  | 507 | } | 
|  | 508 |  | 
|  | 509 | void RegisterIdleActionDeferredSignalHandler( | 
|  | 510 | const base::Closure& signal_callback, | 
|  | 511 | dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 512 | brillo::dbus_utils::ConnectToSignal( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 513 | dbus_object_proxy_, | 
|  | 514 | "org.chromium.PowerManager", | 
|  | 515 | "IdleActionDeferred", | 
|  | 516 | signal_callback, | 
|  | 517 | on_connected_callback); | 
|  | 518 | } | 
|  | 519 |  | 
|  | 520 | void ReleaseObjectProxy(const base::Closure& callback) { | 
|  | 521 | bus_->RemoveObjectProxy(service_name_, object_path_, callback); | 
|  | 522 | } | 
|  | 523 |  | 
|  | 524 | const dbus::ObjectPath& GetObjectPath() const { | 
|  | 525 | return object_path_; | 
|  | 526 | } | 
|  | 527 |  | 
|  | 528 | dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; } | 
|  | 529 |  | 
|  | 530 | bool RequestShutdown( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 531 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 532 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 533 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 534 | timeout_ms, | 
|  | 535 | dbus_object_proxy_, | 
|  | 536 | "org.chromium.PowerManager", | 
|  | 537 | "RequestShutdown", | 
|  | 538 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 539 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 540 | response.get(), error); | 
|  | 541 | } | 
|  | 542 |  | 
|  | 543 | void RequestShutdownAsync( | 
|  | 544 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 545 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 546 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 547 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 548 | timeout_ms, | 
|  | 549 | dbus_object_proxy_, | 
|  | 550 | "org.chromium.PowerManager", | 
|  | 551 | "RequestShutdown", | 
|  | 552 | success_callback, | 
|  | 553 | error_callback); | 
|  | 554 | } | 
|  | 555 |  | 
|  | 556 | // The |reason| arg is a power_manager::RequestRestartReason value. | 
|  | 557 | bool RequestRestart( | 
|  | 558 | int32_t in_reason, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 559 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 560 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 561 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 562 | timeout_ms, | 
|  | 563 | dbus_object_proxy_, | 
|  | 564 | "org.chromium.PowerManager", | 
|  | 565 | "RequestRestart", | 
|  | 566 | error, | 
|  | 567 | in_reason); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 568 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 569 | response.get(), error); | 
|  | 570 | } | 
|  | 571 |  | 
|  | 572 | // The |reason| arg is a power_manager::RequestRestartReason value. | 
|  | 573 | void RequestRestartAsync( | 
|  | 574 | int32_t in_reason, | 
|  | 575 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 576 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 577 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 578 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 579 | timeout_ms, | 
|  | 580 | dbus_object_proxy_, | 
|  | 581 | "org.chromium.PowerManager", | 
|  | 582 | "RequestRestart", | 
|  | 583 | success_callback, | 
|  | 584 | error_callback, | 
|  | 585 | in_reason); | 
|  | 586 | } | 
|  | 587 |  | 
|  | 588 | // The |external_wakeup_count| arg is optional, and it will call two | 
|  | 589 | // different methods in the backend. This can't be expressed in the DBus | 
|  | 590 | // Introspection XML file. | 
|  | 591 | bool RequestSuspend( | 
|  | 592 | uint64_t in_external_wakeup_count, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 593 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 594 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 595 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 596 | timeout_ms, | 
|  | 597 | dbus_object_proxy_, | 
|  | 598 | "org.chromium.PowerManager", | 
|  | 599 | "RequestSuspend", | 
|  | 600 | error, | 
|  | 601 | in_external_wakeup_count); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 602 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 603 | response.get(), error); | 
|  | 604 | } | 
|  | 605 |  | 
|  | 606 | // The |external_wakeup_count| arg is optional, and it will call two | 
|  | 607 | // different methods in the backend. This can't be expressed in the DBus | 
|  | 608 | // Introspection XML file. | 
|  | 609 | void RequestSuspendAsync( | 
|  | 610 | uint64_t in_external_wakeup_count, | 
|  | 611 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 612 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 613 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 614 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 615 | timeout_ms, | 
|  | 616 | dbus_object_proxy_, | 
|  | 617 | "org.chromium.PowerManager", | 
|  | 618 | "RequestSuspend", | 
|  | 619 | success_callback, | 
|  | 620 | error_callback, | 
|  | 621 | in_external_wakeup_count); | 
|  | 622 | } | 
|  | 623 |  | 
|  | 624 | bool DecreaseScreenBrightness( | 
|  | 625 | bool in_allow_off, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 626 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 627 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 628 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 629 | timeout_ms, | 
|  | 630 | dbus_object_proxy_, | 
|  | 631 | "org.chromium.PowerManager", | 
|  | 632 | "DecreaseScreenBrightness", | 
|  | 633 | error, | 
|  | 634 | in_allow_off); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 635 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 636 | response.get(), error); | 
|  | 637 | } | 
|  | 638 |  | 
|  | 639 | void DecreaseScreenBrightnessAsync( | 
|  | 640 | bool in_allow_off, | 
|  | 641 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 642 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 643 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 644 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 645 | timeout_ms, | 
|  | 646 | dbus_object_proxy_, | 
|  | 647 | "org.chromium.PowerManager", | 
|  | 648 | "DecreaseScreenBrightness", | 
|  | 649 | success_callback, | 
|  | 650 | error_callback, | 
|  | 651 | in_allow_off); | 
|  | 652 | } | 
|  | 653 |  | 
|  | 654 | bool IncreaseScreenBrightness( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 655 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 656 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 657 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 658 | timeout_ms, | 
|  | 659 | dbus_object_proxy_, | 
|  | 660 | "org.chromium.PowerManager", | 
|  | 661 | "IncreaseScreenBrightness", | 
|  | 662 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 663 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 664 | response.get(), error); | 
|  | 665 | } | 
|  | 666 |  | 
|  | 667 | void IncreaseScreenBrightnessAsync( | 
|  | 668 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 669 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 670 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 671 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 672 | timeout_ms, | 
|  | 673 | dbus_object_proxy_, | 
|  | 674 | "org.chromium.PowerManager", | 
|  | 675 | "IncreaseScreenBrightness", | 
|  | 676 | success_callback, | 
|  | 677 | error_callback); | 
|  | 678 | } | 
|  | 679 |  | 
|  | 680 | bool GetScreenBrightnessPercent( | 
|  | 681 | double* out_percent, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 682 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 683 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 684 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 685 | timeout_ms, | 
|  | 686 | dbus_object_proxy_, | 
|  | 687 | "org.chromium.PowerManager", | 
|  | 688 | "GetScreenBrightnessPercent", | 
|  | 689 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 690 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 691 | response.get(), error, out_percent); | 
|  | 692 | } | 
|  | 693 |  | 
|  | 694 | void GetScreenBrightnessPercentAsync( | 
|  | 695 | const base::Callback<void(double /*percent*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 696 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 697 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 698 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 699 | timeout_ms, | 
|  | 700 | dbus_object_proxy_, | 
|  | 701 | "org.chromium.PowerManager", | 
|  | 702 | "GetScreenBrightnessPercent", | 
|  | 703 | success_callback, | 
|  | 704 | error_callback); | 
|  | 705 | } | 
|  | 706 |  | 
|  | 707 | // The |style| arg must be one of the values: | 
|  | 708 | //   power_manager::kBrightnessTransitionGradual or | 
|  | 709 | //   power_manager::kBrightnessTransitionInstant. | 
|  | 710 | bool SetScreenBrightnessPercent( | 
|  | 711 | double in_percent, | 
|  | 712 | int32_t in_style, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 713 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 714 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 715 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 716 | timeout_ms, | 
|  | 717 | dbus_object_proxy_, | 
|  | 718 | "org.chromium.PowerManager", | 
|  | 719 | "SetScreenBrightnessPercent", | 
|  | 720 | error, | 
|  | 721 | in_percent, | 
|  | 722 | in_style); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 723 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 724 | response.get(), error); | 
|  | 725 | } | 
|  | 726 |  | 
|  | 727 | // The |style| arg must be one of the values: | 
|  | 728 | //   power_manager::kBrightnessTransitionGradual or | 
|  | 729 | //   power_manager::kBrightnessTransitionInstant. | 
|  | 730 | void SetScreenBrightnessPercentAsync( | 
|  | 731 | double in_percent, | 
|  | 732 | int32_t in_style, | 
|  | 733 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 734 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 735 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 736 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 737 | timeout_ms, | 
|  | 738 | dbus_object_proxy_, | 
|  | 739 | "org.chromium.PowerManager", | 
|  | 740 | "SetScreenBrightnessPercent", | 
|  | 741 | success_callback, | 
|  | 742 | error_callback, | 
|  | 743 | in_percent, | 
|  | 744 | in_style); | 
|  | 745 | } | 
|  | 746 |  | 
|  | 747 | bool DecreaseKeyboardBrightness( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 748 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 749 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 750 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 751 | timeout_ms, | 
|  | 752 | dbus_object_proxy_, | 
|  | 753 | "org.chromium.PowerManager", | 
|  | 754 | "DecreaseKeyboardBrightness", | 
|  | 755 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 756 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 757 | response.get(), error); | 
|  | 758 | } | 
|  | 759 |  | 
|  | 760 | void DecreaseKeyboardBrightnessAsync( | 
|  | 761 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 762 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 763 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 764 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 765 | timeout_ms, | 
|  | 766 | dbus_object_proxy_, | 
|  | 767 | "org.chromium.PowerManager", | 
|  | 768 | "DecreaseKeyboardBrightness", | 
|  | 769 | success_callback, | 
|  | 770 | error_callback); | 
|  | 771 | } | 
|  | 772 |  | 
|  | 773 | bool IncreaseKeyboardBrightness( | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 774 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 775 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 776 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 777 | timeout_ms, | 
|  | 778 | dbus_object_proxy_, | 
|  | 779 | "org.chromium.PowerManager", | 
|  | 780 | "IncreaseKeyboardBrightness", | 
|  | 781 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 782 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 783 | response.get(), error); | 
|  | 784 | } | 
|  | 785 |  | 
|  | 786 | void IncreaseKeyboardBrightnessAsync( | 
|  | 787 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 788 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 789 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 790 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 791 | timeout_ms, | 
|  | 792 | dbus_object_proxy_, | 
|  | 793 | "org.chromium.PowerManager", | 
|  | 794 | "IncreaseKeyboardBrightness", | 
|  | 795 | success_callback, | 
|  | 796 | error_callback); | 
|  | 797 | } | 
|  | 798 |  | 
|  | 799 | // The |serialized_proto| arg is a serialized | 
|  | 800 | // power_manager::PowerSupplyProperties protobuf. | 
|  | 801 | bool GetPowerSupplyProperties( | 
|  | 802 | std::vector<uint8_t>* out_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 803 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 804 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 805 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 806 | timeout_ms, | 
|  | 807 | dbus_object_proxy_, | 
|  | 808 | "org.chromium.PowerManager", | 
|  | 809 | "GetPowerSupplyProperties", | 
|  | 810 | error); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 811 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 812 | response.get(), error, out_serialized_proto); | 
|  | 813 | } | 
|  | 814 |  | 
|  | 815 | // The |serialized_proto| arg is a serialized | 
|  | 816 | // power_manager::PowerSupplyProperties protobuf. | 
|  | 817 | void GetPowerSupplyPropertiesAsync( | 
|  | 818 | const base::Callback<void(const std::vector<uint8_t>& /*serialized_proto*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 819 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 820 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 821 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 822 | timeout_ms, | 
|  | 823 | dbus_object_proxy_, | 
|  | 824 | "org.chromium.PowerManager", | 
|  | 825 | "GetPowerSupplyProperties", | 
|  | 826 | success_callback, | 
|  | 827 | error_callback); | 
|  | 828 | } | 
|  | 829 |  | 
|  | 830 | bool HandleVideoActivity( | 
|  | 831 | bool in_fullscreen, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 832 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 833 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 834 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 835 | timeout_ms, | 
|  | 836 | dbus_object_proxy_, | 
|  | 837 | "org.chromium.PowerManager", | 
|  | 838 | "HandleVideoActivity", | 
|  | 839 | error, | 
|  | 840 | in_fullscreen); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 841 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 842 | response.get(), error); | 
|  | 843 | } | 
|  | 844 |  | 
|  | 845 | void HandleVideoActivityAsync( | 
|  | 846 | bool in_fullscreen, | 
|  | 847 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 848 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 849 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 850 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 851 | timeout_ms, | 
|  | 852 | dbus_object_proxy_, | 
|  | 853 | "org.chromium.PowerManager", | 
|  | 854 | "HandleVideoActivity", | 
|  | 855 | success_callback, | 
|  | 856 | error_callback, | 
|  | 857 | in_fullscreen); | 
|  | 858 | } | 
|  | 859 |  | 
|  | 860 | // The |type| arg is a power_manager::UserActivityType. | 
|  | 861 | bool HandleUserActivity( | 
|  | 862 | int32_t in_type, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 863 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 864 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 865 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 866 | timeout_ms, | 
|  | 867 | dbus_object_proxy_, | 
|  | 868 | "org.chromium.PowerManager", | 
|  | 869 | "HandleUserActivity", | 
|  | 870 | error, | 
|  | 871 | in_type); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 872 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 873 | response.get(), error); | 
|  | 874 | } | 
|  | 875 |  | 
|  | 876 | // The |type| arg is a power_manager::UserActivityType. | 
|  | 877 | void HandleUserActivityAsync( | 
|  | 878 | int32_t in_type, | 
|  | 879 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 880 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 881 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 882 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 883 | timeout_ms, | 
|  | 884 | dbus_object_proxy_, | 
|  | 885 | "org.chromium.PowerManager", | 
|  | 886 | "HandleUserActivity", | 
|  | 887 | success_callback, | 
|  | 888 | error_callback, | 
|  | 889 | in_type); | 
|  | 890 | } | 
|  | 891 |  | 
|  | 892 | bool SetIsProjecting( | 
|  | 893 | bool in_is_projecting, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 894 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 895 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 896 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 897 | timeout_ms, | 
|  | 898 | dbus_object_proxy_, | 
|  | 899 | "org.chromium.PowerManager", | 
|  | 900 | "SetIsProjecting", | 
|  | 901 | error, | 
|  | 902 | in_is_projecting); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 903 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 904 | response.get(), error); | 
|  | 905 | } | 
|  | 906 |  | 
|  | 907 | void SetIsProjectingAsync( | 
|  | 908 | bool in_is_projecting, | 
|  | 909 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 910 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 911 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 912 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 913 | timeout_ms, | 
|  | 914 | dbus_object_proxy_, | 
|  | 915 | "org.chromium.PowerManager", | 
|  | 916 | "SetIsProjecting", | 
|  | 917 | success_callback, | 
|  | 918 | error_callback, | 
|  | 919 | in_is_projecting); | 
|  | 920 | } | 
|  | 921 |  | 
|  | 922 | // The |serialized_proto| arg is a serialized | 
|  | 923 | // power_manager::PowerManagementPolicy protobuf. | 
|  | 924 | bool SetPolicy( | 
|  | 925 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 926 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 927 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 928 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 929 | timeout_ms, | 
|  | 930 | dbus_object_proxy_, | 
|  | 931 | "org.chromium.PowerManager", | 
|  | 932 | "SetPolicy", | 
|  | 933 | error, | 
|  | 934 | in_serialized_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 935 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 936 | response.get(), error); | 
|  | 937 | } | 
|  | 938 |  | 
|  | 939 | // The |serialized_proto| arg is a serialized | 
|  | 940 | // power_manager::PowerManagementPolicy protobuf. | 
|  | 941 | void SetPolicyAsync( | 
|  | 942 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 943 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 944 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 945 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 946 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 947 | timeout_ms, | 
|  | 948 | dbus_object_proxy_, | 
|  | 949 | "org.chromium.PowerManager", | 
|  | 950 | "SetPolicy", | 
|  | 951 | success_callback, | 
|  | 952 | error_callback, | 
|  | 953 | in_serialized_proto); | 
|  | 954 | } | 
|  | 955 |  | 
|  | 956 | bool SetPowerSource( | 
|  | 957 | const std::string& in_id, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 958 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 959 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 960 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 961 | timeout_ms, | 
|  | 962 | dbus_object_proxy_, | 
|  | 963 | "org.chromium.PowerManager", | 
|  | 964 | "SetPowerSource", | 
|  | 965 | error, | 
|  | 966 | in_id); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 967 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 968 | response.get(), error); | 
|  | 969 | } | 
|  | 970 |  | 
|  | 971 | void SetPowerSourceAsync( | 
|  | 972 | const std::string& in_id, | 
|  | 973 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 974 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 975 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 976 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 977 | timeout_ms, | 
|  | 978 | dbus_object_proxy_, | 
|  | 979 | "org.chromium.PowerManager", | 
|  | 980 | "SetPowerSource", | 
|  | 981 | success_callback, | 
|  | 982 | error_callback, | 
|  | 983 | in_id); | 
|  | 984 | } | 
|  | 985 |  | 
|  | 986 | // The |timestamp_internal| arg is represented as the return value of | 
|  | 987 | // base::TimeTicks::ToInternalValue(). | 
|  | 988 | bool HandlePowerButtonAcknowledgment( | 
|  | 989 | int64_t in_timestamp_internal, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 990 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 991 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 992 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 993 | timeout_ms, | 
|  | 994 | dbus_object_proxy_, | 
|  | 995 | "org.chromium.PowerManager", | 
|  | 996 | "HandlePowerButtonAcknowledgment", | 
|  | 997 | error, | 
|  | 998 | in_timestamp_internal); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 999 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1000 | response.get(), error); | 
|  | 1001 | } | 
|  | 1002 |  | 
|  | 1003 | // The |timestamp_internal| arg is represented as the return value of | 
|  | 1004 | // base::TimeTicks::ToInternalValue(). | 
|  | 1005 | void HandlePowerButtonAcknowledgmentAsync( | 
|  | 1006 | int64_t in_timestamp_internal, | 
|  | 1007 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1008 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1009 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1010 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1011 | timeout_ms, | 
|  | 1012 | dbus_object_proxy_, | 
|  | 1013 | "org.chromium.PowerManager", | 
|  | 1014 | "HandlePowerButtonAcknowledgment", | 
|  | 1015 | success_callback, | 
|  | 1016 | error_callback, | 
|  | 1017 | in_timestamp_internal); | 
|  | 1018 | } | 
|  | 1019 |  | 
|  | 1020 | // The |serialized_request_proto| arg is a serialized | 
|  | 1021 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 1022 | // The |serialized_reply_proto| arg is a serialized | 
|  | 1023 | // RegisterSuspendDelayReply protobuf. | 
|  | 1024 | bool RegisterSuspendDelay( | 
|  | 1025 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 1026 | std::vector<uint8_t>* out_serialized_reply_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1027 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1028 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1029 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1030 | timeout_ms, | 
|  | 1031 | dbus_object_proxy_, | 
|  | 1032 | "org.chromium.PowerManager", | 
|  | 1033 | "RegisterSuspendDelay", | 
|  | 1034 | error, | 
|  | 1035 | in_serialized_request_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1036 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1037 | response.get(), error, out_serialized_reply_proto); | 
|  | 1038 | } | 
|  | 1039 |  | 
|  | 1040 | // The |serialized_request_proto| arg is a serialized | 
|  | 1041 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 1042 | // The |serialized_reply_proto| arg is a serialized | 
|  | 1043 | // RegisterSuspendDelayReply protobuf. | 
|  | 1044 | void RegisterSuspendDelayAsync( | 
|  | 1045 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 1046 | const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1047 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1048 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1049 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1050 | timeout_ms, | 
|  | 1051 | dbus_object_proxy_, | 
|  | 1052 | "org.chromium.PowerManager", | 
|  | 1053 | "RegisterSuspendDelay", | 
|  | 1054 | success_callback, | 
|  | 1055 | error_callback, | 
|  | 1056 | in_serialized_request_proto); | 
|  | 1057 | } | 
|  | 1058 |  | 
|  | 1059 | // The |serialized_proto| arg is a serialized | 
|  | 1060 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 1061 | bool UnregisterSuspendDelay( | 
|  | 1062 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1063 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1064 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1065 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1066 | timeout_ms, | 
|  | 1067 | dbus_object_proxy_, | 
|  | 1068 | "org.chromium.PowerManager", | 
|  | 1069 | "UnregisterSuspendDelay", | 
|  | 1070 | error, | 
|  | 1071 | in_serialized_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1072 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1073 | response.get(), error); | 
|  | 1074 | } | 
|  | 1075 |  | 
|  | 1076 | // The |serialized_proto| arg is a serialized | 
|  | 1077 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 1078 | void UnregisterSuspendDelayAsync( | 
|  | 1079 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 1080 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1081 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1082 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1083 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1084 | timeout_ms, | 
|  | 1085 | dbus_object_proxy_, | 
|  | 1086 | "org.chromium.PowerManager", | 
|  | 1087 | "UnregisterSuspendDelay", | 
|  | 1088 | success_callback, | 
|  | 1089 | error_callback, | 
|  | 1090 | in_serialized_proto); | 
|  | 1091 | } | 
|  | 1092 |  | 
|  | 1093 | // The |serialized_proto| arg is a serialized | 
|  | 1094 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 1095 | bool HandleSuspendReadiness( | 
|  | 1096 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1097 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1098 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1099 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1100 | timeout_ms, | 
|  | 1101 | dbus_object_proxy_, | 
|  | 1102 | "org.chromium.PowerManager", | 
|  | 1103 | "HandleSuspendReadiness", | 
|  | 1104 | error, | 
|  | 1105 | in_serialized_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1106 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1107 | response.get(), error); | 
|  | 1108 | } | 
|  | 1109 |  | 
|  | 1110 | // The |serialized_proto| arg is a serialized | 
|  | 1111 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 1112 | void HandleSuspendReadinessAsync( | 
|  | 1113 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 1114 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1115 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1116 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1117 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1118 | timeout_ms, | 
|  | 1119 | dbus_object_proxy_, | 
|  | 1120 | "org.chromium.PowerManager", | 
|  | 1121 | "HandleSuspendReadiness", | 
|  | 1122 | success_callback, | 
|  | 1123 | error_callback, | 
|  | 1124 | in_serialized_proto); | 
|  | 1125 | } | 
|  | 1126 |  | 
|  | 1127 | // The |serialized_request_proto| arg is a serialized | 
|  | 1128 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 1129 | // The |serialized_reply_proto| arg is a serialized | 
|  | 1130 | // RegisterSuspendDelayReply protobuf. | 
|  | 1131 | bool RegisterDarkSuspendDelay( | 
|  | 1132 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 1133 | std::vector<uint8_t>* out_serialized_reply_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1134 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1135 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1136 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1137 | timeout_ms, | 
|  | 1138 | dbus_object_proxy_, | 
|  | 1139 | "org.chromium.PowerManager", | 
|  | 1140 | "RegisterDarkSuspendDelay", | 
|  | 1141 | error, | 
|  | 1142 | in_serialized_request_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1143 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1144 | response.get(), error, out_serialized_reply_proto); | 
|  | 1145 | } | 
|  | 1146 |  | 
|  | 1147 | // The |serialized_request_proto| arg is a serialized | 
|  | 1148 | // power_manager::RegisterSuspendDelayRequest protobuf. | 
|  | 1149 | // The |serialized_reply_proto| arg is a serialized | 
|  | 1150 | // RegisterSuspendDelayReply protobuf. | 
|  | 1151 | void RegisterDarkSuspendDelayAsync( | 
|  | 1152 | const std::vector<uint8_t>& in_serialized_request_proto, | 
|  | 1153 | const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1154 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1155 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1156 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1157 | timeout_ms, | 
|  | 1158 | dbus_object_proxy_, | 
|  | 1159 | "org.chromium.PowerManager", | 
|  | 1160 | "RegisterDarkSuspendDelay", | 
|  | 1161 | success_callback, | 
|  | 1162 | error_callback, | 
|  | 1163 | in_serialized_request_proto); | 
|  | 1164 | } | 
|  | 1165 |  | 
|  | 1166 | // The |serialized_proto| arg is a serialized | 
|  | 1167 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 1168 | bool UnregisterDarkSuspendDelay( | 
|  | 1169 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1170 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1171 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1172 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1173 | timeout_ms, | 
|  | 1174 | dbus_object_proxy_, | 
|  | 1175 | "org.chromium.PowerManager", | 
|  | 1176 | "UnregisterDarkSuspendDelay", | 
|  | 1177 | error, | 
|  | 1178 | in_serialized_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1179 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1180 | response.get(), error); | 
|  | 1181 | } | 
|  | 1182 |  | 
|  | 1183 | // The |serialized_proto| arg is a serialized | 
|  | 1184 | // power_manager::UnregisterSuspendDelayRequest protobuf. | 
|  | 1185 | void UnregisterDarkSuspendDelayAsync( | 
|  | 1186 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 1187 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1188 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1189 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1190 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1191 | timeout_ms, | 
|  | 1192 | dbus_object_proxy_, | 
|  | 1193 | "org.chromium.PowerManager", | 
|  | 1194 | "UnregisterDarkSuspendDelay", | 
|  | 1195 | success_callback, | 
|  | 1196 | error_callback, | 
|  | 1197 | in_serialized_proto); | 
|  | 1198 | } | 
|  | 1199 |  | 
|  | 1200 | // The |serialized_proto| arg is a serialized | 
|  | 1201 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 1202 | bool HandleDarkSuspendReadiness( | 
|  | 1203 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1204 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1205 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1206 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1207 | timeout_ms, | 
|  | 1208 | dbus_object_proxy_, | 
|  | 1209 | "org.chromium.PowerManager", | 
|  | 1210 | "HandleDarkSuspendReadiness", | 
|  | 1211 | error, | 
|  | 1212 | in_serialized_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1213 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1214 | response.get(), error); | 
|  | 1215 | } | 
|  | 1216 |  | 
|  | 1217 | // The |serialized_proto| arg is a serialized | 
|  | 1218 | // power_manager::SuspendReadinessInfo protobuf. | 
|  | 1219 | void HandleDarkSuspendReadinessAsync( | 
|  | 1220 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 1221 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1222 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1223 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1224 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1225 | timeout_ms, | 
|  | 1226 | dbus_object_proxy_, | 
|  | 1227 | "org.chromium.PowerManager", | 
|  | 1228 | "HandleDarkSuspendReadiness", | 
|  | 1229 | success_callback, | 
|  | 1230 | error_callback, | 
|  | 1231 | in_serialized_proto); | 
|  | 1232 | } | 
|  | 1233 |  | 
|  | 1234 | // The |serialized_proto| arg is a serialized | 
|  | 1235 | // power_manager::DarkResumeWakeReason protobuf. | 
|  | 1236 | bool RecordDarkResumeWakeReason( | 
|  | 1237 | const std::vector<uint8_t>& in_serialized_proto, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1238 | brillo::ErrorPtr* error, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1239 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1240 | auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1241 | timeout_ms, | 
|  | 1242 | dbus_object_proxy_, | 
|  | 1243 | "org.chromium.PowerManager", | 
|  | 1244 | "RecordDarkResumeWakeReason", | 
|  | 1245 | error, | 
|  | 1246 | in_serialized_proto); | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1247 | return response && brillo::dbus_utils::ExtractMethodCallResults( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1248 | response.get(), error); | 
|  | 1249 | } | 
|  | 1250 |  | 
|  | 1251 | // The |serialized_proto| arg is a serialized | 
|  | 1252 | // power_manager::DarkResumeWakeReason protobuf. | 
|  | 1253 | void RecordDarkResumeWakeReasonAsync( | 
|  | 1254 | const std::vector<uint8_t>& in_serialized_proto, | 
|  | 1255 | const base::Callback<void()>& success_callback, | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1256 | const base::Callback<void(brillo::Error*)>& error_callback, | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1257 | int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { | 
| Alex Vakulenko | 3f39d5c | 2015-10-13 09:27:13 -0700 | [diff] [blame] | 1258 | brillo::dbus_utils::CallMethodWithTimeout( | 
| Alex Deymo | d5561a5 | 2015-09-03 23:17:52 -0700 | [diff] [blame] | 1259 | timeout_ms, | 
|  | 1260 | dbus_object_proxy_, | 
|  | 1261 | "org.chromium.PowerManager", | 
|  | 1262 | "RecordDarkResumeWakeReason", | 
|  | 1263 | success_callback, | 
|  | 1264 | error_callback, | 
|  | 1265 | in_serialized_proto); | 
|  | 1266 | } | 
|  | 1267 |  | 
|  | 1268 | private: | 
|  | 1269 | scoped_refptr<dbus::Bus> bus_; | 
|  | 1270 | const std::string service_name_{"org.chromium.PowerManager"}; | 
|  | 1271 | const dbus::ObjectPath object_path_{"/org/chromium/PowerManager"}; | 
|  | 1272 | dbus::ObjectProxy* dbus_object_proxy_; | 
|  | 1273 |  | 
|  | 1274 | DISALLOW_COPY_AND_ASSIGN(PowerManagerProxy); | 
|  | 1275 | }; | 
|  | 1276 |  | 
|  | 1277 | }  // namespace chromium | 
|  | 1278 | }  // namespace org | 
|  | 1279 |  | 
|  | 1280 | #endif  // ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_TMP_PORTAGE_CHROMEOS_BASE_POWER_MANAGER_9999_WORK_BUILD_OUT_DEFAULT_GEN_INCLUDE_POWER_MANAGER_DBUS_PROXIES_H |