| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // |web_contents| is the WebContents of the tab in which the request was made. | 72 // |web_contents| is the WebContents of the tab in which the request was made. |
| 73 // |origin| and |web_contents| are used for enforcing same-origin and/or | 73 // |origin| and |web_contents| are used for enforcing same-origin and/or |
| 74 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page | 74 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page |
| 75 // requesting JoinRoute() must have the same origin as the page that requested | 75 // requesting JoinRoute() must have the same origin as the page that requested |
| 76 // CreateRoute()). | 76 // CreateRoute()). |
| 77 // The caller may pass in nullptr for |web_contents| if tab is not applicable. | 77 // The caller may pass in nullptr for |web_contents| if tab is not applicable. |
| 78 // Each callback in |callbacks| is invoked with a response indicating | 78 // Each callback in |callbacks| is invoked with a response indicating |
| 79 // success or failure, in the order they are listed. | 79 // success or failure, in the order they are listed. |
| 80 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 80 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
| 81 // with a timeout error after the timeout expires. | 81 // with a timeout error after the timeout expires. |
| 82 // If |off_the_record| is true, the request was made by an off the record | 82 // If |incognito| is true, the request was made by an incognito profile. |
| 83 // (incognito) profile. | |
| 84 virtual void CreateRoute( | 83 virtual void CreateRoute( |
| 85 const MediaSource::Id& source_id, | 84 const MediaSource::Id& source_id, |
| 86 const MediaSink::Id& sink_id, | 85 const MediaSink::Id& sink_id, |
| 87 const GURL& origin, | 86 const GURL& origin, |
| 88 content::WebContents* web_contents, | 87 content::WebContents* web_contents, |
| 89 const std::vector<MediaRouteResponseCallback>& callbacks, | 88 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 90 base::TimeDelta timeout, | 89 base::TimeDelta timeout, |
| 91 bool off_the_record) = 0; | 90 bool incognito) = 0; |
| 92 | 91 |
| 93 // Creates a route and connects it to an existing route identified by | 92 // Creates a route and connects it to an existing route identified by |
| 94 // |route_id|. |route_id| must refer to a non-local route, unnassociated with | 93 // |route_id|. |route_id| must refer to a non-local route, unnassociated with |
| 95 // a Presentation ID, because a new Presentation ID will be created. | 94 // a Presentation ID, because a new Presentation ID will be created. |
| 96 // |source|: The source to route to the existing route. | 95 // |source|: The source to route to the existing route. |
| 97 // |route_id|: Route ID of the existing route. | 96 // |route_id|: Route ID of the existing route. |
| 98 // |origin|, |web_contents|: Origin and WebContents of the join route request. | 97 // |origin|, |web_contents|: Origin and WebContents of the join route request. |
| 99 // Used for validation when enforcing same-origin and/or same-tab scope. | 98 // Used for validation when enforcing same-origin and/or same-tab scope. |
| 100 // (See CreateRoute documentation). | 99 // (See CreateRoute documentation). |
| 101 // Each callback in |callbacks| is invoked with a response indicating | 100 // Each callback in |callbacks| is invoked with a response indicating |
| 102 // success or failure, in the order they are listed. | 101 // success or failure, in the order they are listed. |
| 103 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 102 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
| 104 // with a timeout error after the timeout expires. | 103 // with a timeout error after the timeout expires. |
| 105 // If |off_the_record| is true, the request was made by an off the record | 104 // If |incognito| is true, the request was made by an incognito profile. |
| 106 // (incognito) profile. | |
| 107 virtual void ConnectRouteByRouteId( | 105 virtual void ConnectRouteByRouteId( |
| 108 const MediaSource::Id& source_id, | 106 const MediaSource::Id& source_id, |
| 109 const MediaRoute::Id& route_id, | 107 const MediaRoute::Id& route_id, |
| 110 const GURL& origin, | 108 const GURL& origin, |
| 111 content::WebContents* web_contents, | 109 content::WebContents* web_contents, |
| 112 const std::vector<MediaRouteResponseCallback>& callbacks, | 110 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 113 base::TimeDelta timeout, | 111 base::TimeDelta timeout, |
| 114 bool off_the_record) = 0; | 112 bool incognito) = 0; |
| 115 | 113 |
| 116 // Joins an existing route identified by |presentation_id|. | 114 // Joins an existing route identified by |presentation_id|. |
| 117 // |source|: The source to route to the existing route. | 115 // |source|: The source to route to the existing route. |
| 118 // |presentation_id|: Presentation ID of the existing route. | 116 // |presentation_id|: Presentation ID of the existing route. |
| 119 // |origin|, |web_contents|: Origin and WebContents of the join route request. | 117 // |origin|, |web_contents|: Origin and WebContents of the join route request. |
| 120 // Used for validation when enforcing same-origin and/or same-tab scope. | 118 // Used for validation when enforcing same-origin and/or same-tab scope. |
| 121 // (See CreateRoute documentation). | 119 // (See CreateRoute documentation). |
| 122 // Each callback in |callbacks| is invoked with a response indicating | 120 // Each callback in |callbacks| is invoked with a response indicating |
| 123 // success or failure, in the order they are listed. | 121 // success or failure, in the order they are listed. |
| 124 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 122 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
| 125 // with a timeout error after the timeout expires. | 123 // with a timeout error after the timeout expires. |
| 126 // If |off_the_record| is true, the request was made by an off the record | 124 // If |incognito| is true, the request was made by an incognito profile. |
| 127 // (incognito) profile. | |
| 128 virtual void JoinRoute( | 125 virtual void JoinRoute( |
| 129 const MediaSource::Id& source, | 126 const MediaSource::Id& source, |
| 130 const std::string& presentation_id, | 127 const std::string& presentation_id, |
| 131 const GURL& origin, | 128 const GURL& origin, |
| 132 content::WebContents* web_contents, | 129 content::WebContents* web_contents, |
| 133 const std::vector<MediaRouteResponseCallback>& callbacks, | 130 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 134 base::TimeDelta timeout, | 131 base::TimeDelta timeout, |
| 135 bool off_the_record) = 0; | 132 bool incognito) = 0; |
| 136 | 133 |
| 137 // Terminates the media route specified by |route_id|. | 134 // Terminates the media route specified by |route_id|. |
| 138 virtual void TerminateRoute(const MediaRoute::Id& route_id) = 0; | 135 virtual void TerminateRoute(const MediaRoute::Id& route_id) = 0; |
| 139 | 136 |
| 140 // Detaches the media route specified by |route_id|. The request might come | 137 // Detaches the media route specified by |route_id|. The request might come |
| 141 // from the page or from an event like navigation or garbage collection. | 138 // from the page or from an event like navigation or garbage collection. |
| 142 virtual void DetachRoute(const MediaRoute::Id& route_id) = 0; | 139 virtual void DetachRoute(const MediaRoute::Id& route_id) = 0; |
| 143 | 140 |
| 144 // Posts |message| to a MediaSink connected via MediaRoute with |route_id|. | 141 // Posts |message| to a MediaSink connected via MediaRoute with |route_id|. |
| 145 virtual void SendRouteMessage(const MediaRoute::Id& route_id, | 142 virtual void SendRouteMessage(const MediaRoute::Id& route_id, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 175 |
| 179 // Adds |callback| to listen for state changes for presentation connected to | 176 // Adds |callback| to listen for state changes for presentation connected to |
| 180 // |route_id|. The returned Subscription object is owned by the caller. | 177 // |route_id|. The returned Subscription object is owned by the caller. |
| 181 // |callback| will be invoked whenever there are state changes, until the | 178 // |callback| will be invoked whenever there are state changes, until the |
| 182 // caller destroys the Subscription object. | 179 // caller destroys the Subscription object. |
| 183 virtual std::unique_ptr<PresentationConnectionStateSubscription> | 180 virtual std::unique_ptr<PresentationConnectionStateSubscription> |
| 184 AddPresentationConnectionStateChangedCallback( | 181 AddPresentationConnectionStateChangedCallback( |
| 185 const MediaRoute::Id& route_id, | 182 const MediaRoute::Id& route_id, |
| 186 const content::PresentationConnectionStateChangedCallback& callback) = 0; | 183 const content::PresentationConnectionStateChangedCallback& callback) = 0; |
| 187 | 184 |
| 188 // Called when the off the record (incognito) profile for this instance is | 185 // Called when the incognito profile for this instance is being shut down. |
| 189 // being shut down. This will terminate all off the record media routes. | 186 // This will terminate all incognito media routes. |
| 190 virtual void OnOffTheRecordProfileShutdown() = 0; | 187 virtual void OnIncognitoProfileShutdown() = 0; |
| 191 | 188 |
| 192 private: | 189 private: |
| 193 friend class IssuesObserver; | 190 friend class IssuesObserver; |
| 194 friend class MediaSinksObserver; | 191 friend class MediaSinksObserver; |
| 195 friend class MediaRoutesObserver; | 192 friend class MediaRoutesObserver; |
| 196 friend class PresentationConnectionStateObserver; | 193 friend class PresentationConnectionStateObserver; |
| 197 friend class PresentationSessionMessagesObserver; | 194 friend class PresentationSessionMessagesObserver; |
| 198 | 195 |
| 199 // The following functions are called by friend Observer classes above. | 196 // The following functions are called by friend Observer classes above. |
| 200 | 197 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 244 |
| 248 // Unregisters a previously registered PresentationSessionMessagesObserver. | 245 // Unregisters a previously registered PresentationSessionMessagesObserver. |
| 249 // |observer| will stop receiving further updates. | 246 // |observer| will stop receiving further updates. |
| 250 virtual void UnregisterPresentationSessionMessagesObserver( | 247 virtual void UnregisterPresentationSessionMessagesObserver( |
| 251 PresentationSessionMessagesObserver* observer) = 0; | 248 PresentationSessionMessagesObserver* observer) = 0; |
| 252 }; | 249 }; |
| 253 | 250 |
| 254 } // namespace media_router | 251 } // namespace media_router |
| 255 | 252 |
| 256 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 253 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| OLD | NEW |