summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/router/media_source.h
blob: 8943f3f9079d42a0bf824f97ecd63753c24e0d26 (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
// Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_

#include <ostream>
#include <string>

#include "base/hash.h"

namespace media_router {


class MediaSource {
 public:
  using Id = std::string;

  explicit MediaSource(const MediaSource::Id& id);
  MediaSource();
  ~MediaSource();

  // Gets the ID of the media source.
  MediaSource::Id id() const;

  // Returns true if two MediaSource objects use the same media ID.
  bool Equals(const MediaSource& other) const;

  // Returns true if a MediaSource is empty or uninitialized.
  bool Empty() const;

  // Used for logging.
  std::string ToString() const;

  // Hash operator for hash containers.
  struct Hash {
    size_t operator()(const MediaSource& source) const {
      return base::Hash(source.id());
    }
  };

 private:
  MediaSource::Id id_;
};

}  // namespace media_router

#endif  // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_H_