| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/callback_list.h" | 14 #include "base/callback_list.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/media/router/issue.h" | 17 #include "chrome/browser/media/router/issue.h" |
| 18 #include "chrome/browser/media/router/media_route.h" | 18 #include "chrome/browser/media/router/media_route.h" |
| 19 #include "chrome/browser/media/router/media_sink.h" | 19 #include "chrome/browser/media/router/media_sink.h" |
| 20 #include "chrome/browser/media/router/media_source.h" | 20 #include "chrome/browser/media/router/media_source.h" |
| 21 #include "chrome/browser/media/router/route_message_observer.h" | 21 #include "chrome/browser/media/router/route_message_observer.h" |
| 22 #include "components/keyed_service/core/keyed_service.h" | 22 #include "components/keyed_service/core/keyed_service.h" |
| 23 #include "content/public/browser/presentation_service_delegate.h" | 23 #include "content/public/browser/presentation_service_delegate.h" |
| 24 #include "url/origin.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class WebContents; | 27 class WebContents; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace media_router { | 30 namespace media_router { |
| 30 | 31 |
| 31 class IssuesObserver; | 32 class IssuesObserver; |
| 32 class MediaRoutesObserver; | 33 class MediaRoutesObserver; |
| 33 class MediaSinksObserver; | 34 class MediaSinksObserver; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // CreateRoute()). | 72 // CreateRoute()). |
| 72 // The caller may pass in nullptr for |web_contents| if tab is not applicable. | 73 // The caller may pass in nullptr for |web_contents| if tab is not applicable. |
| 73 // Each callback in |callbacks| is invoked with a response indicating | 74 // Each callback in |callbacks| is invoked with a response indicating |
| 74 // success or failure, in the order they are listed. | 75 // success or failure, in the order they are listed. |
| 75 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 76 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
| 76 // with a timeout error after the timeout expires. | 77 // with a timeout error after the timeout expires. |
| 77 // If |incognito| is true, the request was made by an incognito profile. | 78 // If |incognito| is true, the request was made by an incognito profile. |
| 78 virtual void CreateRoute( | 79 virtual void CreateRoute( |
| 79 const MediaSource::Id& source_id, | 80 const MediaSource::Id& source_id, |
| 80 const MediaSink::Id& sink_id, | 81 const MediaSink::Id& sink_id, |
| 81 const GURL& origin, | 82 const url::Origin& origin, |
| 82 content::WebContents* web_contents, | 83 content::WebContents* web_contents, |
| 83 const std::vector<MediaRouteResponseCallback>& callbacks, | 84 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 84 base::TimeDelta timeout, | 85 base::TimeDelta timeout, |
| 85 bool incognito) = 0; | 86 bool incognito) = 0; |
| 86 | 87 |
| 87 // Creates a route and connects it to an existing route identified by | 88 // Creates a route and connects it to an existing route identified by |
| 88 // |route_id|. |route_id| must refer to a non-local route, unnassociated with | 89 // |route_id|. |route_id| must refer to a non-local route, unnassociated with |
| 89 // a Presentation ID, because a new Presentation ID will be created. | 90 // a Presentation ID, because a new Presentation ID will be created. |
| 90 // |source|: The source to route to the existing route. | 91 // |source|: The source to route to the existing route. |
| 91 // |route_id|: Route ID of the existing route. | 92 // |route_id|: Route ID of the existing route. |
| 92 // |origin|, |web_contents|: Origin and WebContents of the join route request. | 93 // |origin|, |web_contents|: Origin and WebContents of the join route request. |
| 93 // Used for validation when enforcing same-origin and/or same-tab scope. | 94 // Used for validation when enforcing same-origin and/or same-tab scope. |
| 94 // (See CreateRoute documentation). | 95 // (See CreateRoute documentation). |
| 95 // Each callback in |callbacks| is invoked with a response indicating | 96 // Each callback in |callbacks| is invoked with a response indicating |
| 96 // success or failure, in the order they are listed. | 97 // success or failure, in the order they are listed. |
| 97 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 98 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
| 98 // with a timeout error after the timeout expires. | 99 // with a timeout error after the timeout expires. |
| 99 // If |incognito| is true, the request was made by an incognito profile. | 100 // If |incognito| is true, the request was made by an incognito profile. |
| 100 virtual void ConnectRouteByRouteId( | 101 virtual void ConnectRouteByRouteId( |
| 101 const MediaSource::Id& source_id, | 102 const MediaSource::Id& source_id, |
| 102 const MediaRoute::Id& route_id, | 103 const MediaRoute::Id& route_id, |
| 103 const GURL& origin, | 104 const url::Origin& origin, |
| 104 content::WebContents* web_contents, | 105 content::WebContents* web_contents, |
| 105 const std::vector<MediaRouteResponseCallback>& callbacks, | 106 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 106 base::TimeDelta timeout, | 107 base::TimeDelta timeout, |
| 107 bool incognito) = 0; | 108 bool incognito) = 0; |
| 108 | 109 |
| 109 // Joins an existing route identified by |presentation_id|. | 110 // Joins an existing route identified by |presentation_id|. |
| 110 // |source|: The source to route to the existing route. | 111 // |source|: The source to route to the existing route. |
| 111 // |presentation_id|: Presentation ID of the existing route. | 112 // |presentation_id|: Presentation ID of the existing route. |
| 112 // |origin|, |web_contents|: Origin and WebContents of the join route request. | 113 // |origin|, |web_contents|: Origin and WebContents of the join route request. |
| 113 // Used for validation when enforcing same-origin and/or same-tab scope. | 114 // Used for validation when enforcing same-origin and/or same-tab scope. |
| 114 // (See CreateRoute documentation). | 115 // (See CreateRoute documentation). |
| 115 // Each callback in |callbacks| is invoked with a response indicating | 116 // Each callback in |callbacks| is invoked with a response indicating |
| 116 // success or failure, in the order they are listed. | 117 // success or failure, in the order they are listed. |
| 117 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 118 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
| 118 // with a timeout error after the timeout expires. | 119 // with a timeout error after the timeout expires. |
| 119 // If |incognito| is true, the request was made by an incognito profile. | 120 // If |incognito| is true, the request was made by an incognito profile. |
| 120 virtual void JoinRoute( | 121 virtual void JoinRoute( |
| 121 const MediaSource::Id& source, | 122 const MediaSource::Id& source, |
| 122 const std::string& presentation_id, | 123 const std::string& presentation_id, |
| 123 const GURL& origin, | 124 const url::Origin& origin, |
| 124 content::WebContents* web_contents, | 125 content::WebContents* web_contents, |
| 125 const std::vector<MediaRouteResponseCallback>& callbacks, | 126 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 126 base::TimeDelta timeout, | 127 base::TimeDelta timeout, |
| 127 bool incognito) = 0; | 128 bool incognito) = 0; |
| 128 | 129 |
| 129 // Terminates the media route specified by |route_id|. | 130 // Terminates the media route specified by |route_id|. |
| 130 virtual void TerminateRoute(const MediaRoute::Id& route_id) = 0; | 131 virtual void TerminateRoute(const MediaRoute::Id& route_id) = 0; |
| 131 | 132 |
| 132 // Detaches the media route specified by |route_id|. The request might come | 133 // Detaches the media route specified by |route_id|. The request might come |
| 133 // from the page or from an event like navigation or garbage collection. | 134 // from the page or from an event like navigation or garbage collection. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 242 |
| 242 // Unregisters a previously registered RouteMessagesObserver. |observer| will | 243 // Unregisters a previously registered RouteMessagesObserver. |observer| will |
| 243 // stop receiving further updates. | 244 // stop receiving further updates. |
| 244 virtual void UnregisterRouteMessageObserver( | 245 virtual void UnregisterRouteMessageObserver( |
| 245 RouteMessageObserver* observer) = 0; | 246 RouteMessageObserver* observer) = 0; |
| 246 }; | 247 }; |
| 247 | 248 |
| 248 } // namespace media_router | 249 } // namespace media_router |
| 249 | 250 |
| 250 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 251 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
| OLD | NEW |