Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: chromeos/dbus/update_engine_client.cc

Issue 2060623002: Implementation of Device End of Life Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify browsertest Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
+
// 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_;
};

Powered by Google App Engine
This is Rietveld 408576698