| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
| 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace cast_channel { |
| 11 class CastMessage; |
| 12 } // namespace cast_channel |
| 13 |
| 10 namespace extensions { | 14 namespace extensions { |
| 11 namespace api { | 15 namespace api { |
| 12 namespace cast_channel { | 16 namespace cast_channel { |
| 13 | 17 |
| 14 class AuthContext; | |
| 15 class CastMessage; | |
| 16 class DeviceAuthMessage; | |
| 17 struct MessageInfo; | 18 struct MessageInfo; |
| 18 | 19 |
| 19 // Fills |message_proto| from |message| and returns true on success. | 20 // Fills |message_proto| from |message| and returns true on success. |
| 20 bool MessageInfoToCastMessage(const MessageInfo& message, | 21 bool MessageInfoToCastMessage(const MessageInfo& message, |
| 21 CastMessage* message_proto); | 22 ::cast_channel::CastMessage* message_proto); |
| 22 | |
| 23 // Checks if the contents of |message_proto| are valid. | |
| 24 bool IsCastMessageValid(const CastMessage& message_proto); | |
| 25 | 23 |
| 26 // Fills |message| from |message_proto| and returns true on success. | 24 // Fills |message| from |message_proto| and returns true on success. |
| 27 bool CastMessageToMessageInfo(const CastMessage& message_proto, | 25 bool CastMessageToMessageInfo(const ::cast_channel::CastMessage& message_proto, |
| 28 MessageInfo* message); | 26 MessageInfo* message); |
| 29 | 27 |
| 30 // Returns a human readable string for |message_proto|. | |
| 31 std::string CastMessageToString(const CastMessage& message_proto); | |
| 32 | |
| 33 // Returns a human readable string for |message|. | |
| 34 std::string AuthMessageToString(const DeviceAuthMessage& message); | |
| 35 | |
| 36 // Fills |message_proto| appropriately for an auth challenge request message. | |
| 37 // Uses the nonce challenge in |auth_context|. | |
| 38 void CreateAuthChallengeMessage(CastMessage* message_proto, | |
| 39 const AuthContext& auth_context); | |
| 40 | |
| 41 // Returns whether the given message is an auth handshake message. | |
| 42 bool IsAuthMessage(const CastMessage& message); | |
| 43 | |
| 44 } // namespace cast_channel | 28 } // namespace cast_channel |
| 45 } // namespace api | 29 } // namespace api |
| 46 } // namespace extensions | 30 } // namespace extensions |
| 47 | 31 |
| 48 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 32 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
| OLD | NEW |