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/logging.h" | |
11 #include "base/values.h" | |
12 #include "chrome/browser/media/router/media_sink.h" | |
13 #include "chrome/browser/media/router/media_source.h" | |
14 | |
15 namespace media_router { | |
16 | |
17 // MediaRoute objects contain the status and metadata of a routing | |
18 // operation. The fields are immutable and reflect the route status | |
19 // only at the time of object creation. Updated route statuses must | |
20 // be retrieved as new MediaRoute objects from the Media Router. | |
21 // | |
22 // TODO(mfoltz): Convert to a simple struct and remove uncommon parameters from | |
23 // the ctor. | |
24 class MediaRoute { | |
25 public: | |
26 using Id = std::string; | |
27 | |
28 // |media_route_id|: ID of the route. | |
29 // |media_source|: Description of source of the route. | |
30 // |media_sink|: The sink that is receiving the media. | |
31 // |description|: Description of the route to be displayed. | |
32 // |is_local|: true if the route was created from this browser. | |
33 // |custom_controller_path|: custom controller path if it is given by route | |
34 // provider. empty otherwise. | |
35 // |for_display|: Set to true if this route should be displayed for | |
36 // |media_sink_id| in UI. | |
37 MediaRoute(const MediaRoute::Id& media_route_id, | |
38 const MediaSource& media_source, | |
39 const MediaSink::Id& media_sink_id, | |
40 const std::string& description, | |
41 bool is_local, | |
42 const std::string& custom_controller_path, | |
43 bool for_display); | |
44 MediaRoute(const MediaRoute& other); | |
45 MediaRoute(); | |
46 | |
47 ~MediaRoute(); | |
48 | |
49 void set_media_route_id(const MediaRoute::Id& media_route_id) { | |
50 media_route_id_ = media_route_id; | |
51 } | |
52 const MediaRoute::Id& media_route_id() const { return media_route_id_; } | |
53 | |
54 void set_media_source(const MediaSource& media_source) { | |
55 media_source_ = media_source; | |
56 } | |
57 const MediaSource& media_source() const { return media_source_; } | |
58 | |
59 void set_media_sink_id(const MediaSink::Id& media_sink_id) { | |
60 media_sink_id_ = media_sink_id; | |
61 } | |
62 const MediaSink::Id& media_sink_id() const { return media_sink_id_; } | |
63 | |
64 void set_description(const std::string& description) { | |
65 description_ = description; | |
66 } | |
67 | |
68 // TODO(kmarshall): Do we need to pass locale for bidi rendering? | |
69 const std::string& description() const { return description_; } | |
70 | |
71 void set_local(bool is_local) { is_local_ = is_local; } | |
72 bool is_local() const { return is_local_; } | |
73 | |
74 void set_custom_controller_path(const std::string& custom_controller_path) { | |
75 custom_controller_path_ = custom_controller_path; | |
76 } | |
77 const std::string& custom_controller_path() const { | |
78 return custom_controller_path_; | |
79 } | |
80 | |
81 void set_for_display(bool for_display) { for_display_ = for_display; } | |
82 bool for_display() const { return for_display_; } | |
83 | |
84 void set_incognito(bool is_incognito) { is_incognito_ = is_incognito; } | |
85 bool is_incognito() const { return is_incognito_; } | |
86 | |
87 void set_offscreen_presentation(bool is_offscreen_presentation) { | |
88 is_offscreen_presentation_ = is_offscreen_presentation; | |
89 } | |
90 bool is_offscreen_presentation() const { return is_offscreen_presentation_; } | |
91 | |
92 bool Equals(const MediaRoute& other) const; | |
93 | |
94 private: | |
95 // The media route identifier. | |
96 MediaRoute::Id media_route_id_; | |
97 | |
98 // The media source being routed. | |
99 MediaSource media_source_; | |
100 | |
101 // The ID of sink being routed to. | |
102 MediaSink::Id media_sink_id_; | |
103 | |
104 // The description of the media route activity, for example | |
105 // "Playing Foo Bar Music All Access." | |
106 std::string description_; | |
107 | |
108 // |true| if the route is created locally (versus discovered by a media route | |
109 // provider.) | |
110 bool is_local_ = false; | |
111 | |
112 // The custom controller path. This allows route provider to have custom route | |
113 // detail as well as its own route control features route control features in | |
114 // the media router dialog. | |
115 std::string custom_controller_path_; | |
116 | |
117 // |true| if the route can be displayed in the UI. | |
118 bool for_display_ = false; | |
119 | |
120 // |true| if the route was created by an incognito profile. | |
121 bool is_incognito_ = false; | |
122 | |
123 // |true| if the presentation associated with this route is an offscreen | |
124 // presentation. | |
125 bool is_offscreen_presentation_ = false; | |
126 }; | |
127 | |
128 } // namespace media_router | |
129 | |
130 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_H_ | |
OLD | NEW |