summaryrefslogtreecommitdiffstats
path: root/components/copresence/tokens.h
blob: c28322ebd8c32fe90897c021b1e26d1ca6a5162f (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// 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 COMPONENTS_COPRESENCE_TOKENS_H_
#define COMPONENTS_COPRESENCE_TOKENS_H_

#include <string>

#include "base/time/time.h"
#include "components/copresence/proto/enums.pb.h"

namespace copresence {

struct AudioToken final {
  AudioToken(const std::string& token, bool audible)
      : token(token),
        audible(audible) {}

  std::string token;
  bool audible;
};

// It's an error to define these constructors inline,
// so they're defined in tokens.cc.

struct TransmittedToken final {
  TransmittedToken();

  std::string id;
  TokenMedium medium;
  base::Time start_time;
  base::Time stop_time;
  bool broadcast_confirmed;
};

struct ReceivedToken final {
  enum Validity {
    UNKNOWN = 0,
    VALID = 1,
    INVALID = 2
  };

  ReceivedToken();
  ReceivedToken(const std::string& id,
                TokenMedium medium,
                base::Time last_time);

  std::string id;
  TokenMedium medium;
  base::Time start_time;
  base::Time last_time;
  Validity valid;
};

}  // namespace copresence

#endif  // COMPONENTS_COPRESENCE_TOKENS_H_