OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "chrome/browser/media/router/issue.h" | 13 #include "chrome/browser/media/router/issue.h" |
14 #include "chrome/browser/media/router/media_route.h" | 14 #include "chrome/browser/media/router/media_route.h" |
15 #include "chrome/browser/media/router/media_sink.h" | 15 #include "chrome/browser/media/router/media_sink.h" |
16 #include "chrome/browser/media/router/media_source.h" | 16 #include "chrome/browser/media/router/media_source.h" |
17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
18 #include "content/public/browser/presentation_session_message.h" | 18 #include "content/public/browser/presentation_session_message.h" |
19 | 19 |
20 namespace media_router { | 20 namespace media_router { |
21 | 21 |
22 class IssuesObserver; | 22 class IssuesObserver; |
| 23 class LocalMediaRoutesObserver; |
23 class MediaRoutesObserver; | 24 class MediaRoutesObserver; |
24 class MediaSinksObserver; | 25 class MediaSinksObserver; |
25 class PresentationSessionMessagesObserver; | 26 class PresentationSessionMessagesObserver; |
26 | 27 |
27 // Type of callback used in |CreateRoute()| and |JoinRoute()|. Callback is | 28 // Type of callback used in |CreateRoute()| and |JoinRoute()|. Callback is |
28 // invoked when the route request either succeeded or failed. | 29 // invoked when the route request either succeeded or failed. |
29 // On success: | 30 // On success: |
30 // |route|: The route created or joined. | 31 // |route|: The route created or joined. |
31 // |presentation_id|: | 32 // |presentation_id|: |
32 // The presentation ID of the route created or joined. In the case of | 33 // The presentation ID of the route created or joined. In the case of |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 virtual void AddIssue(const Issue& issue) = 0; | 109 virtual void AddIssue(const Issue& issue) = 0; |
109 | 110 |
110 // Clears the issue with the id |issue_id|. | 111 // Clears the issue with the id |issue_id|. |
111 virtual void ClearIssue(const Issue::Id& issue_id) = 0; | 112 virtual void ClearIssue(const Issue::Id& issue_id) = 0; |
112 | 113 |
113 // Indicates that a presentation session has detached from the underlying | 114 // Indicates that a presentation session has detached from the underlying |
114 // MediaRoute |route_id| (due to navigation, garbage collection, etc.) | 115 // MediaRoute |route_id| (due to navigation, garbage collection, etc.) |
115 virtual void OnPresentationSessionDetached( | 116 virtual void OnPresentationSessionDetached( |
116 const MediaRoute::Id& route_id) = 0; | 117 const MediaRoute::Id& route_id) = 0; |
117 | 118 |
| 119 // Returns whether or not there is currently an active local route. |
| 120 virtual bool HasLocalRoute() const = 0; |
| 121 |
118 private: | 122 private: |
119 friend class IssuesObserver; | 123 friend class IssuesObserver; |
| 124 friend class LocalMediaRoutesObserver; |
120 friend class MediaSinksObserver; | 125 friend class MediaSinksObserver; |
121 friend class MediaRoutesObserver; | 126 friend class MediaRoutesObserver; |
122 friend class PresentationSessionMessagesObserver; | 127 friend class PresentationSessionMessagesObserver; |
123 | 128 |
124 // The following functions are called by friend Observer classes above. | 129 // The following functions are called by friend Observer classes above. |
125 | 130 |
126 // Registers |observer| with this MediaRouter. |observer| specifies a media | 131 // Registers |observer| with this MediaRouter. |observer| specifies a media |
127 // source and will receive updates with media sinks that are compatible with | 132 // source and will receive updates with media sinks that are compatible with |
128 // that source. The initial update may happen synchronously. | 133 // that source. The initial update may happen synchronously. |
129 // NOTE: This class does not assume ownership of |observer|. Callers must | 134 // NOTE: This class does not assume ownership of |observer|. Callers must |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // |observer|. |observer| should be unregistered before it is destroyed. | 172 // |observer|. |observer| should be unregistered before it is destroyed. |
168 // Registering the same observer more than once will result in undefined | 173 // Registering the same observer more than once will result in undefined |
169 // behavior. | 174 // behavior. |
170 virtual void RegisterPresentationSessionMessagesObserver( | 175 virtual void RegisterPresentationSessionMessagesObserver( |
171 PresentationSessionMessagesObserver* observer) = 0; | 176 PresentationSessionMessagesObserver* observer) = 0; |
172 | 177 |
173 // Unregisters a previously registered PresentationSessionMessagesObserver. | 178 // Unregisters a previously registered PresentationSessionMessagesObserver. |
174 // |observer| will stop receiving further updates. | 179 // |observer| will stop receiving further updates. |
175 virtual void UnregisterPresentationSessionMessagesObserver( | 180 virtual void UnregisterPresentationSessionMessagesObserver( |
176 PresentationSessionMessagesObserver* observer) = 0; | 181 PresentationSessionMessagesObserver* observer) = 0; |
| 182 |
| 183 // Adds the LocalMediaRoutesObserver |observer| to listen for newly created |
| 184 // MediaRoutes. |
| 185 virtual void RegisterLocalMediaRoutesObserver( |
| 186 LocalMediaRoutesObserver* observer) = 0; |
| 187 |
| 188 // Removes the LocalMediaRoutesObserver |observer|. |
| 189 virtual void UnregisterLocalMediaRoutesObserver( |
| 190 LocalMediaRoutesObserver* observer) = 0; |
177 }; | 191 }; |
178 | 192 |
179 } // namespace media_router | 193 } // namespace media_router |
180 | 194 |
181 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 195 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
OLD | NEW |