| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // |observer|. |observer| should be unregistered before it is destroyed. | 170 // |observer|. |observer| should be unregistered before it is destroyed. |
| 166 // Registering the same observer more than once will result in undefined | 171 // Registering the same observer more than once will result in undefined |
| 167 // behavior. | 172 // behavior. |
| 168 virtual void RegisterPresentationSessionMessagesObserver( | 173 virtual void RegisterPresentationSessionMessagesObserver( |
| 169 PresentationSessionMessagesObserver* observer) = 0; | 174 PresentationSessionMessagesObserver* observer) = 0; |
| 170 | 175 |
| 171 // Unregisters a previously registered PresentationSessionMessagesObserver. | 176 // Unregisters a previously registered PresentationSessionMessagesObserver. |
| 172 // |observer| will stop receiving further updates. | 177 // |observer| will stop receiving further updates. |
| 173 virtual void UnregisterPresentationSessionMessagesObserver( | 178 virtual void UnregisterPresentationSessionMessagesObserver( |
| 174 PresentationSessionMessagesObserver* observer) = 0; | 179 PresentationSessionMessagesObserver* observer) = 0; |
| 180 |
| 181 // Adds the LocalMediaRoutesObserver |observer| to listen for newly created |
| 182 // MediaRoutes. |
| 183 virtual void RegisterLocalMediaRoutesObserver( |
| 184 LocalMediaRoutesObserver* observer) = 0; |
| 185 |
| 186 // Removes the LocalMediaRoutesObserver |observer|. |
| 187 virtual void UnregisterLocalMediaRoutesObserver( |
| 188 LocalMediaRoutesObserver* observer) = 0; |
| 175 }; | 189 }; |
| 176 | 190 |
| 177 } // namespace media_router | 191 } // namespace media_router |
| 178 | 192 |
| 179 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 193 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| OLD | NEW |