| 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 COMPONENTS_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
| 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 6 #define COMPONENTS_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace extensions { | |
| 11 namespace api { | |
| 12 namespace cast_channel { | 10 namespace cast_channel { |
| 13 | 11 |
| 14 class AuthContext; | 12 class AuthContext; |
| 15 class CastMessage; | 13 class CastMessage; |
| 16 class DeviceAuthMessage; | 14 class DeviceAuthMessage; |
| 17 struct MessageInfo; | |
| 18 | |
| 19 // Fills |message_proto| from |message| and returns true on success. | |
| 20 bool MessageInfoToCastMessage(const MessageInfo& message, | |
| 21 CastMessage* message_proto); | |
| 22 | 15 |
| 23 // Checks if the contents of |message_proto| are valid. | 16 // Checks if the contents of |message_proto| are valid. |
| 24 bool IsCastMessageValid(const CastMessage& message_proto); | 17 bool IsCastMessageValid(const CastMessage& message_proto); |
| 25 | 18 |
| 26 // Fills |message| from |message_proto| and returns true on success. | |
| 27 bool CastMessageToMessageInfo(const CastMessage& message_proto, | |
| 28 MessageInfo* message); | |
| 29 | |
| 30 // Returns a human readable string for |message_proto|. | 19 // Returns a human readable string for |message_proto|. |
| 31 std::string CastMessageToString(const CastMessage& message_proto); | 20 std::string CastMessageToString(const CastMessage& message_proto); |
| 32 | 21 |
| 33 // Returns a human readable string for |message|. | 22 // Returns a human readable string for |message|. |
| 34 std::string AuthMessageToString(const DeviceAuthMessage& message); | 23 std::string AuthMessageToString(const DeviceAuthMessage& message); |
| 35 | 24 |
| 36 // Fills |message_proto| appropriately for an auth challenge request message. | 25 // Fills |message_proto| appropriately for an auth challenge request message. |
| 37 // Uses the nonce challenge in |auth_context|. | 26 // Uses the nonce challenge in |auth_context|. |
| 38 void CreateAuthChallengeMessage(CastMessage* message_proto, | 27 void CreateAuthChallengeMessage(CastMessage* message_proto, |
| 39 const AuthContext& auth_context); | 28 const AuthContext& auth_context); |
| 40 | 29 |
| 41 // Returns whether the given message is an auth handshake message. | 30 // Returns whether the given message is an auth handshake message. |
| 42 bool IsAuthMessage(const CastMessage& message); | 31 bool IsAuthMessage(const CastMessage& message); |
| 43 | 32 |
| 44 } // namespace cast_channel | 33 } // namespace cast_channel |
| 45 } // namespace api | |
| 46 } // namespace extensions | |
| 47 | 34 |
| 48 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ | 35 #endif // COMPONENTS_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_ |
| OLD | NEW |