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