summaryrefslogtreecommitdiffstats
path: root/extensions/browser/api/cast_channel/logger_util.h
blob: 2b5de5b41f4840f386a27d17e1ea4b49eeff7442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_UTIL_H_
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_UTIL_H_

#include "extensions/common/api/cast_channel.h"
#include "extensions/common/api/cast_channel/logging.pb.h"

namespace extensions {
namespace api {
namespace cast_channel {
// Converts an IDL "ChannelError" to a proto enum "ErrorState".
proto::ErrorState ErrorStateToProto(ChannelError state);

// Converts an IDL "ReadyState" to a proto enum "ReadyState".
proto::ReadyState ReadyStateToProto(ReadyState state);

// Holds the most recent errors encountered by a CastSocket.
struct LastErrors {
 public:
  LastErrors();
  ~LastErrors();

  // The most recent event that occurred at the time of the error.
  proto::EventType event_type;

  // The most recent ChallengeReplyErrorType logged for the socket.
  proto::ChallengeReplyErrorType challenge_reply_error_type;

  // The most recent net_return_value logged for the socket.
  int net_return_value;
};

}  // namespace cast_channel
}  // namespace api
}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_API_CAST_CHANNEL_LOGGER_UTIL_H_