Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / api / cast_channel / cast_message_util.h
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
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
7
8 #include <string>
9
10 namespace extensions {
11 namespace core_api {
12 namespace cast_channel {
13
14 class CastMessage;
15 class DeviceAuthMessage;
16 struct MessageInfo;
17
18 // Fills |message_proto| from |message| and returns true on success.
19 bool MessageInfoToCastMessage(const MessageInfo& message,
20                               CastMessage* message_proto);
21
22 // Checks if the contents of |message_proto| are semantically valid.
23 bool IsCastMessageValid(const CastMessage& message_proto);
24
25 // Fills |message| from |message_proto| and returns true on success.
26 bool CastMessageToMessageInfo(const CastMessage& message_proto,
27                               MessageInfo* message);
28
29 // Returns a human readable string for |message_proto|.
30 std::string CastMessageToString(const CastMessage& message_proto);
31
32 // Returns a human readable string for |message|.
33 std::string AuthMessageToString(const DeviceAuthMessage& message);
34
35 // Fills |message_proto| appropriately for an auth challenge request message.
36 void CreateAuthChallengeMessage(CastMessage* message_proto);
37
38 // Returns whether the given message is an auth handshake message.
39 bool IsAuthMessage(const CastMessage& message);
40
41 }  // namespace cast_channel
42 }  // namespace core_api
43 }  // namespace extensions
44
45 #endif  // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_