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

Unified Diff: components/pairing/proto_decoder.cc

Issue 2901653002: Bootstrapping: Reboot on enrollment failure (Closed)
Patch Set: 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
« components/pairing/pairing_api.proto ('K') | « 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..129b51c20d4ad0c0093c09dd4a71dc302c1b7a37 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,10 +113,15 @@ bool ProtoDecoder::DecodeIOBuffer(int size,
observer_->OnAddNetworkMessage(message);
}
break;
+ case MESSAGE_REBOOT: {
xdai1 2017/05/23 00:07:50 the indent is off
+ pairing_api::Reboot message;
+ message.ParseFromArray(&buffer[0], buffer.size());
+ observer_->OnRebootMessage(message);
+ } break;
- default:
- LOG(WARNING) << "Skipping unknown message type: " << next_message_type_;
- break;
+ default:
+ LOG(WARNING) << "Skipping unknown message type: " << next_message_type_;
+ break;
}
// Reset the message data.
@@ -180,6 +186,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,
« components/pairing/pairing_api.proto ('K') | « components/pairing/proto_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698