Chromium Code Reviews| 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, |