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; | |
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. The current status of a MediaRoute | |
39 // needs to be pulled from the Media Route Provider Manager, which is the | |
mark a. foltz
2015/03/05 16:58:41
The MRPM is a component in another process (the ex
Kevin M
2015/03/05 18:34:18
Done.
| |
40 // source of truth for route information. | |
41 class MediaRoute { | |
42 public: | |
43 ~MediaRoute(); | |
44 | |
45 // The media route identifier. | |
46 const MediaRouteId& media_route_id() const { return media_route_id_; } | |
47 | |
48 // The state of the media route. | |
49 MediaRouteState state() const { return state_; } | |
50 | |
51 // The media source being routed. | |
52 const MediaSource& media_source() const { return media_source_; } | |
53 | |
54 // The ID of the sink being routed to. | |
55 const MediaSinkId& sink_id() const { return sink_id_; } | |
56 | |
57 // The description of the media route activity, for example | |
58 // "Playing Foo Bar Music All Access." | |
59 // TODO(kmarshall): Do we need to pass locale information? | |
mark a. foltz
2015/03/05 16:58:41
pass locale information for bidi rendering?
Kevin M
2015/03/05 18:34:18
Done.
| |
60 const std::string& description() const { return description_; } | |
61 | |
62 // Returns |true| if the route is created locally (versus discovered | |
63 // by a media route provider.) | |
64 bool is_local() const { return is_local_; } | |
65 | |
66 bool operator==(const MediaRoute& other) const; | |
67 bool operator!=(const MediaRoute& other) const; | |
68 | |
69 private: | |
70 friend class MediaRouteFactory; | |
71 FRIEND_TEST_ALL_PREFIXES(MediaRouteTest, Equals); | |
72 | |
73 // |media_route_id|: Uniquely identifies the route among active | |
74 // instances for this media source. | |
75 // |type|: Type of media route. | |
76 // |media_source|: Description of source of the route. | |
77 // |sink_id|: ID of the MediaSink of the route. | |
78 // |description|: Description of the route to be displayed. | |
79 // |is_local|: true if the route was created from this browser. | |
mark a. foltz
2015/03/05 16:58:41
Since these parameters map 1:1 to the public and d
Kevin M
2015/03/05 18:34:18
I'll remove it so there's less to keep in sync.
| |
80 MediaRoute(const MediaRouteId& media_route_id, | |
81 const MediaSource& media_source, | |
82 const MediaSinkId& sink_id, | |
83 const std::string& description, | |
84 bool is_local); | |
85 | |
86 const MediaRouteId media_route_id_; | |
87 const MediaSource media_source_; | |
88 const MediaSinkId sink_id_; | |
89 const std::string description_; | |
90 const bool is_local_; | |
91 const MediaRouteState state_; | |
92 }; | |
93 | |
94 } // namespace media_router | |
95 | |
96 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ | |
OLD | NEW |