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 // Defines communication between the Media Router and the | |
6 // Media Router Provider Manager. | |
xhwang
2015/04/28 17:44:18
"Media Router Provider Manager" is an implementati
Kevin M
2015/04/28 21:00:26
Removed introductory comment since it seems redund
| |
7 | |
8 module media_router.interfaces; | |
9 | |
10 // Represents an output sink to which media can be routed. | |
11 struct MediaSink { | |
12 // The sink identifier, e.g. "rs71w7mFzYLFlabir_qO4NHl6SUc." | |
13 string sink_id; | |
14 // The human-readable name, e.g. "Janet's Chromecast". | |
15 string name; | |
16 }; | |
17 | |
18 // Should be kept in sync with media_route.h. | |
19 struct MediaRoute { | |
20 // The ID of this media route, e.g. "r_PR1O_blkC9dsKp-tb1ti8qurOo". | |
21 string media_route_id; | |
22 // The ID of the media source being sent through this media route. | |
23 // May be missing if route is not local. | |
24 string? media_source; | |
25 // The sink that is rendering the media content. | |
26 MediaSink media_sink; | |
27 // Human readable description of this route, e.g. | |
28 // "Tab casting". | |
29 string description; | |
30 // An icon that is associated with this media source. | |
31 string? icon_url; | |
32 // Specifies that the route is requested locally. | |
33 bool is_local; | |
34 }; | |
35 | |
36 // Notifications or an actionable events to be shown to the user. | |
37 // When is_blocking is true, media router UI shows issue only: | |
38 // | |
39 // Title | |
40 // Message | |
41 // default_action_button secondary_action_button | |
42 // | |
43 // When is_blocking is false, media router UI uses banner: | |
44 // | |
45 // Title default_action_link secondary_action_link | |
46 // | |
47 // above receiver list if route_id is not provided; otherwise it is | |
48 // above route detail and controls. | |
49 struct Issue { | |
50 enum Severity { | |
51 FATAL, | |
52 WARNING, | |
53 NOTIFICATION | |
54 }; | |
55 | |
56 enum ActionType { | |
57 OK, | |
58 CANCEL, | |
59 DISMISS, | |
60 LEARN_MORE | |
61 }; | |
62 | |
63 // If set, the ID of the route to which this issue pertains. | |
64 // If not set (default), then this is a global issue. | |
65 string? route_id; | |
66 | |
67 Severity severity; | |
68 | |
69 // When true, the issue must be presented to the user and resolved | |
70 // before other actions are allowed. | |
71 bool is_blocking; | |
72 | |
73 // Short description about the issue. | |
74 string title; | |
75 | |
76 // Message about issue detail or how to handle issue. | |
77 // Messages should be suitable for end users to decide which actions to take. | |
78 string? message; | |
79 | |
80 ActionType default_action; | |
81 | |
82 array<ActionType>? secondary_actions; | |
83 | |
84 // A help page to be opened if users select learn_more. | |
85 string? help_url; | |
86 }; | |
87 | |
88 // Interface for sending messages from the Media Router to the | |
89 // Media Router Provider Manager. | |
xhwang
2015/04/28 17:44:19
ditto
| |
90 interface MediaRouterClient { | |
xhwang
2015/04/28 17:44:19
I still feel we have the names inverted. From an d
| |
91 // Signals the provider to route the media located | |
xhwang
2015/04/28 17:44:18
Now looking at the interface, we only have MediaRo
| |
92 // at |media_source| to |sink_id|. | |
93 // If the operation was successful, |route| will be defined and | |
94 // |error_text| will be null. | |
95 // If the operation failed, |route| will be null and |error_text| | |
96 // will be set. | |
97 CreateRoute(string media_source, string sink_id) => | |
98 (MediaRoute? route, string? error_text); | |
99 | |
100 // Signals the provider to close the route specified by |route_id|. | |
101 CloseRoute(string route_id); | |
102 | |
103 // Sends |message| with optional |extra_info_json| via the media route | |
104 // |media_route_id|. | |
105 PostMessage(string media_route_id, string message); | |
106 | |
107 // Signals the provider to start querying for sinks | |
108 // capable of displaying |media_source|. | |
109 StartObservingMediaSinks(string media_source); | |
110 | |
111 // Signals the provider to stop querying for sinks | |
112 // capable of displaying |media_source|. | |
113 StopObservingMediaSinks(string media_source); | |
114 | |
115 // Signals the to start a query on all routes. Updates are received from | |
116 // |OnRoutesUpdated()|. | |
117 StartObservingMediaRoutes(); | |
118 | |
119 // Signals the to stop query on all routes. | |
120 StopObservingMediaRoutes(); | |
121 | |
122 // "Clears" an issue after it has been processed. | |
123 ClearIssue(string issue_id); | |
124 }; | |
125 | |
126 // Interface for sending messages from providers to the MR. | |
127 interface MediaRouter { | |
128 // Sets a client object so the MR can issue calls back to the | |
129 // Provider Manager. | |
xhwang
2015/04/28 17:44:18
ditto
| |
130 // Returns a string that uniquely identifies the Media Router browser | |
131 // process. | |
132 SetClient(MediaRouterClient observer) => (string instance_id); | |
133 | |
134 // Called when the Media Route Manager receives a new list of sinks. | |
135 OnSinksReceived(string media_source, array<MediaSink> sinks); | |
136 | |
137 // Called when the Media Route Manager receives a route message. | |
138 OnMessage(string media_source, string message); | |
139 | |
140 // Called when providers send an issue. | |
141 OnIssue(Issue issue); | |
142 | |
143 // Called when list of routes has been updated. | |
144 OnRoutesUpdated(array<MediaRoute> routes); | |
145 }; | |
146 | |
OLD | NEW |