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

Unified Diff: components/pairing/proto_decoder.cc

Issue 2901653002: Bootstrapping: Reboot on enrollment failure (Closed)
Patch Set: Fixed comments. Created 3 years, 7 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
« no previous file with comments | « components/pairing/proto_decoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/pairing/proto_decoder.cc
diff --git a/components/pairing/proto_decoder.cc b/components/pairing/proto_decoder.cc
index 52853d30cb9113958e588d9bfad82f05b109989f..c0e01a6c049234b33d1550cb6b34f9110960998f 100644
--- a/components/pairing/proto_decoder.cc
+++ b/components/pairing/proto_decoder.cc
@@ -16,6 +16,7 @@ enum {
MESSAGE_COMPLETE_SETUP,
MESSAGE_ERROR,
MESSAGE_ADD_NETWORK,
+ MESSAGE_REBOOT,
NUM_MESSAGES,
};
}
@@ -112,6 +113,12 @@ bool ProtoDecoder::DecodeIOBuffer(int size,
observer_->OnAddNetworkMessage(message);
}
break;
+ case MESSAGE_REBOOT: {
+ pairing_api::Reboot message;
+ message.ParseFromArray(&buffer[0], buffer.size());
+ observer_->OnRebootMessage(message);
+ }
+ break;
default:
LOG(WARNING) << "Skipping unknown message type: " << next_message_type_;
@@ -180,6 +187,16 @@ ProtoDecoder::IOBufferRefPtr ProtoDecoder::SendError(
return SendMessage(MESSAGE_ERROR, serialized_proto, size);
}
+ProtoDecoder::IOBufferRefPtr ProtoDecoder::SendRebootHost(
+ const pairing_api::Reboot& message,
+ int* size) {
+ std::string serialized_proto;
+ if (!message.SerializeToString(&serialized_proto))
+ NOTREACHED();
+
+ return SendMessage(MESSAGE_REBOOT, serialized_proto, size);
+}
+
ProtoDecoder::IOBufferRefPtr ProtoDecoder::SendMessage(
uint8_t message_type,
const std::string& message,
« no previous file with comments | « components/pairing/proto_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698