Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/media/router/media_sink.h

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chunkier CL Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_
7
8 #include <string>
9
10 #include "chrome/browser/media/router/media_route_id.h"
11
12 namespace media_router {
13
14 typedef std::string MediaSinkId;
15
16 // Represents a sink to which media can be routed.
17 class MediaSink {
18 public:
19 enum Status {
20 // The sink is currently not associated with any routes.
21 IDLE,
22 // The sink is currently associated with a route.
23 ACTIVE,
24 // The sink has a pending route request.
25 REQUEST_PENDING
26 };
27
28 // |sink_id|: Unique identifier for the MediaSink.
29 // |name|: Descriptive name of the MediaSink.
30 // |route_id|: ID of the media route currently associated with the MediaSink,
31 // if any. If there are none, pass in an empty string.
32 // |status|: Current status of the MediaSink.
33 // |status| is ACTIVE iff |route_id| is non-empty.
34 MediaSink(const MediaSinkId& sink_id,
35 const std::string& name,
36 const MediaRouteId& route_id,
37 Status status);
38 ~MediaSink();
39
40 const MediaSinkId& sink_id() const { return sink_id_; }
41 const std::string& name() const { return name_; }
42 Status status() const { return status_; }
43 std::string StatusAsString() const;
44
45 // Returns an empty string if there is no route associated with the sink.
46 const MediaRouteId& route_id() const { return route_id_; }
47 bool HasRoute() const;
48
49 bool operator==(const MediaSink& other) const;
50 bool operator!=(const MediaSink& other) const;
51
52 private:
53 MediaSinkId sink_id_;
54 std::string name_;
55 MediaRouteId route_id_;
56 Status status_;
57 };
58
59 } // namespace media_router
60
61 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698