Chromium Code Reviews| Index: chromeos/dbus/update_engine_client.cc |
| diff --git a/chromeos/dbus/update_engine_client.cc b/chromeos/dbus/update_engine_client.cc |
| index fcd6ab192fc00b0c92232933d9597dbf3960bd97..f9dffa6869b1fa52fdf8ea0b456b06fe52de89e6 100644 |
| --- a/chromeos/dbus/update_engine_client.cc |
| +++ b/chromeos/dbus/update_engine_client.cc |
| @@ -207,6 +207,17 @@ class UpdateEngineClientImpl : public UpdateEngineClient { |
| callback)); |
| } |
| + void GetEolStatus(const GetEolStatusCallback& callback) override { |
| + dbus::MethodCall method_call(update_engine::kUpdateEngineInterface, |
| + update_engine::kGetEolStatus); |
| + |
| + VLOG(1) << "Requesting to get end of life status"; |
| + update_engine_proxy_->CallMethod( |
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| + base::Bind(&UpdateEngineClientImpl::OnGetEolStatus, |
| + weak_ptr_factory_.GetWeakPtr(), callback)); |
| + } |
| + |
| protected: |
| void Init(dbus::Bus* bus) override { |
| update_engine_proxy_ = bus->GetObjectProxy( |
| @@ -349,6 +360,25 @@ class UpdateEngineClientImpl : public UpdateEngineClient { |
| callback.Run(channel); |
| } |
| + // Called when a response for GetEolStatus() is received. |
| + void OnGetEolStatus(const GetEolStatusCallback& callback, |
| + dbus::Response* response) { |
| + if (!response) { |
| + LOG(ERROR) << "Failed to request getting eol status"; |
| + callback.Run(update_engine::EndOfLifeStatus::kSupported); |
| + return; |
| + } |
| + dbus::MessageReader reader(response); |
| + int status; |
| + if (!reader.PopInt32(&status)) { |
| + LOG(ERROR) << "Incorrect response: " << response->ToString(); |
| + callback.Run(update_engine::EndOfLifeStatus::kSupported); |
| + return; |
| + } |
| + VLOG(1) << "Eol status received: " << status; |
| + callback.Run(status); |
|
stevenjb
2016/06/18 00:52:58
We should cast status to the correct enum type (an
xiaoyinh(OOO Sep 11-29)
2016/06/18 02:09:39
Added validation Check.
Steven, mind if I change t
|
| + } |
| + |
| // Called when a status update signal is received. |
| void StatusUpdateReceived(dbus::Signal* signal) { |
| VLOG(1) << "Status update signal received: " << signal->ToString(); |
| @@ -437,6 +467,10 @@ class UpdateEngineClientStubImpl : public UpdateEngineClient { |
| callback.Run(target_channel_); |
| } |
| + void GetEolStatus(const GetEolStatusCallback& callback) override { |
| + callback.Run(update_engine::EndOfLifeStatus::kSupported); |
| + } |
| + |
| std::string current_channel_; |
| std::string target_channel_; |
| }; |