OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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_ROUTE_H_ | |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/gtest_prod_util.h" | |
11 #include "base/logging.h" | |
12 #include "base/values.h" | |
13 #include "chrome/browser/media/router/media_route_id.h" | |
14 #include "chrome/browser/media/router/media_sink.h" | |
15 #include "chrome/browser/media/router/media_source.h" | |
16 #include "url/gurl.h" | |
17 | |
18 namespace media_router { | |
19 | |
20 using RouteRequestId = int64; | |
21 | |
22 extern const RouteRequestId kInvalidRouteRequestId; | |
xhwang
2015/03/05 22:28:49
kInvalidRouteRequestId is not used in this CL. How
Kevin M
2015/03/06 23:12:44
Done.
| |
23 | |
24 class MediaRouteFactory; | |
25 | |
26 // For now, a simple transition graph: NEW -> CONNECTED -> CLOSED. | |
27 enum MediaRouteState { | |
28 // The route is new and not yet connected to a sink. | |
29 MEDIA_ROUTE_STATE_NEW, | |
30 // The route is active and connected to a sink. | |
31 MEDIA_ROUTE_STATE_CONNECTED, | |
32 // The route has been disconnected. | |
33 MEDIA_ROUTE_STATE_CLOSED | |
34 }; | |
35 | |
36 // MediaRoute objects contain the status and metadata of a routing | |
37 // operation. The fields are immutable and reflect the route status | |
38 // only at the time of object creation. Updated route statuses must | |
39 // be retrieved as new MediaRoute objects from the Media Router. | |
40 class MediaRoute { | |
xhwang
2015/03/05 22:28:49
It seems this class only carries data. How about u
Kevin M
2015/03/06 23:12:44
Done.
| |
41 public: | |
42 ~MediaRoute(); | |
43 | |
44 // The media route identifier. | |
45 const MediaRouteId& media_route_id() const { return media_route_id_; } | |
46 | |
47 // The state of the media route. | |
48 MediaRouteState state() const { return state_; } | |
49 | |
50 // The media source being routed. | |
51 const MediaSource& media_source() const { return media_source_; } | |
52 | |
53 // The ID of the sink being routed to. | |
54 const MediaSinkId& sink_id() const { return sink_id_; } | |
55 | |
56 // The description of the media route activity, for example | |
57 // "Playing Foo Bar Music All Access." | |
58 // TODO(kmarshall): Do we need to pass locale for bidi rendering? | |
59 const std::string& description() const { return description_; } | |
60 | |
61 // Returns |true| if the route is created locally (versus discovered | |
62 // by a media route provider.) | |
63 bool is_local() const { return is_local_; } | |
64 | |
65 bool operator==(const MediaRoute& other) const; | |
66 bool operator!=(const MediaRoute& other) const; | |
xhwang
2015/03/05 22:28:49
operator overloading is not recommended by the sty
Kevin M
2015/03/06 23:12:44
Done.
| |
67 | |
68 private: | |
69 friend class MediaRouteFactory; | |
70 FRIEND_TEST_ALL_PREFIXES(MediaRouteTest, Equals); | |
71 | |
72 MediaRoute(const MediaRouteId& media_route_id, | |
73 const MediaSource& media_source, | |
74 const MediaSinkId& sink_id, | |
75 const std::string& description, | |
76 bool is_local); | |
77 | |
78 const MediaRouteId media_route_id_; | |
79 const MediaSource media_source_; | |
80 const MediaSinkId sink_id_; | |
81 const std::string description_; | |
82 const bool is_local_; | |
83 const MediaRouteState state_; | |
84 }; | |
85 | |
86 } // namespace media_router | |
87 | |
88 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ | |
OLD | NEW |