| 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_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 static void BindToRequest( | 62 static void BindToRequest( |
| 63 const extensions::Extension* extension, | 63 const extensions::Extension* extension, |
| 64 content::BrowserContext* context, | 64 content::BrowserContext* context, |
| 65 mojo::InterfaceRequest<mojom::MediaRouter> request); | 65 mojo::InterfaceRequest<mojom::MediaRouter> request); |
| 66 | 66 |
| 67 // MediaRouter implementation. | 67 // MediaRouter implementation. |
| 68 // Execution of the requests is delegated to the Do* methods, which can be | 68 // Execution of the requests is delegated to the Do* methods, which can be |
| 69 // enqueued for later use if the extension is temporarily suspended. | 69 // enqueued for later use if the extension is temporarily suspended. |
| 70 void CreateRoute(const MediaSource::Id& source_id, | 70 void CreateRoute(const MediaSource::Id& source_id, |
| 71 const MediaSink::Id& sink_id, | 71 const MediaSink::Id& sink_id, |
| 72 const url::Origin& origin, | 72 const GURL& origin, |
| 73 content::WebContents* web_contents, | 73 content::WebContents* web_contents, |
| 74 const std::vector<MediaRouteResponseCallback>& callbacks, | 74 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 75 base::TimeDelta timeout, | 75 base::TimeDelta timeout, |
| 76 bool incognito) override; | 76 bool incognito) override; |
| 77 void JoinRoute(const MediaSource::Id& source_id, | 77 void JoinRoute(const MediaSource::Id& source_id, |
| 78 const std::string& presentation_id, | 78 const std::string& presentation_id, |
| 79 const url::Origin& origin, | 79 const GURL& origin, |
| 80 content::WebContents* web_contents, | 80 content::WebContents* web_contents, |
| 81 const std::vector<MediaRouteResponseCallback>& callbacks, | 81 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 82 base::TimeDelta timeout, | 82 base::TimeDelta timeout, |
| 83 bool incognito) override; | 83 bool incognito) override; |
| 84 void ConnectRouteByRouteId( | 84 void ConnectRouteByRouteId( |
| 85 const MediaSource::Id& source, | 85 const MediaSource::Id& source, |
| 86 const MediaRoute::Id& route_id, | 86 const MediaRoute::Id& route_id, |
| 87 const url::Origin& origin, | 87 const GURL& origin, |
| 88 content::WebContents* web_contents, | 88 content::WebContents* web_contents, |
| 89 const std::vector<MediaRouteResponseCallback>& callbacks, | 89 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 90 base::TimeDelta timeout, | 90 base::TimeDelta timeout, |
| 91 bool incognito) override; | 91 bool incognito) override; |
| 92 void TerminateRoute(const MediaRoute::Id& route_id) override; | 92 void TerminateRoute(const MediaRoute::Id& route_id) override; |
| 93 void DetachRoute(const MediaRoute::Id& route_id) override; | 93 void DetachRoute(const MediaRoute::Id& route_id) override; |
| 94 void SendRouteMessage(const MediaRoute::Id& route_id, | 94 void SendRouteMessage(const MediaRoute::Id& route_id, |
| 95 const std::string& message, | 95 const std::string& message, |
| 96 const SendRouteMessageCallback& callback) override; | 96 const SendRouteMessageCallback& callback) override; |
| 97 void SendRouteBinaryMessage( | 97 void SendRouteBinaryMessage( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 // True if the query has been sent to the MRPM. | 169 // True if the query has been sent to the MRPM. |
| 170 bool is_active = false; | 170 bool is_active = false; |
| 171 | 171 |
| 172 // True if cached result is available. | 172 // True if cached result is available. |
| 173 bool has_cached_result = false; | 173 bool has_cached_result = false; |
| 174 | 174 |
| 175 // Cached list of sinks for the query, if |has_cached_result| is true. | 175 // Cached list of sinks for the query, if |has_cached_result| is true. |
| 176 // Empty otherwise. | 176 // Empty otherwise. |
| 177 std::vector<MediaSink> cached_sink_list; | 177 std::vector<MediaSink> cached_sink_list; |
| 178 std::vector<url::Origin> origins; | 178 std::vector<GURL> origins; |
| 179 base::ObserverList<MediaSinksObserver> observers; | 179 base::ObserverList<MediaSinksObserver> observers; |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 DISALLOW_COPY_AND_ASSIGN(MediaSinksQuery); | 182 DISALLOW_COPY_AND_ASSIGN(MediaSinksQuery); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 struct MediaRoutesQuery { | 185 struct MediaRoutesQuery { |
| 186 public: | 186 public: |
| 187 MediaRoutesQuery(); | 187 MediaRoutesQuery(); |
| 188 ~MediaRoutesQuery(); | 188 ~MediaRoutesQuery(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override; | 227 void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override; |
| 228 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override; | 228 void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override; |
| 229 void RegisterIssuesObserver(IssuesObserver* observer) override; | 229 void RegisterIssuesObserver(IssuesObserver* observer) override; |
| 230 void UnregisterIssuesObserver(IssuesObserver* observer) override; | 230 void UnregisterIssuesObserver(IssuesObserver* observer) override; |
| 231 void RegisterRouteMessageObserver(RouteMessageObserver* observer) override; | 231 void RegisterRouteMessageObserver(RouteMessageObserver* observer) override; |
| 232 void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override; | 232 void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override; |
| 233 | 233 |
| 234 // These calls invoke methods in the component extension via Mojo. | 234 // These calls invoke methods in the component extension via Mojo. |
| 235 void DoCreateRoute(const MediaSource::Id& source_id, | 235 void DoCreateRoute(const MediaSource::Id& source_id, |
| 236 const MediaSink::Id& sink_id, | 236 const MediaSink::Id& sink_id, |
| 237 const url::Origin& origin, | 237 const std::string& origin, |
| 238 int tab_id, | 238 int tab_id, |
| 239 const std::vector<MediaRouteResponseCallback>& callbacks, | 239 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 240 base::TimeDelta timeout, | 240 base::TimeDelta timeout, |
| 241 bool incognito); | 241 bool incognito); |
| 242 void DoJoinRoute(const MediaSource::Id& source_id, | 242 void DoJoinRoute(const MediaSource::Id& source_id, |
| 243 const std::string& presentation_id, | 243 const std::string& presentation_id, |
| 244 const url::Origin& origin, | 244 const std::string& origin, |
| 245 int tab_id, | 245 int tab_id, |
| 246 const std::vector<MediaRouteResponseCallback>& callbacks, | 246 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 247 base::TimeDelta timeout, | 247 base::TimeDelta timeout, |
| 248 bool incognito); | 248 bool incognito); |
| 249 void DoConnectRouteByRouteId( | 249 void DoConnectRouteByRouteId( |
| 250 const MediaSource::Id& source_id, | 250 const MediaSource::Id& source_id, |
| 251 const MediaRoute::Id& route_id, | 251 const MediaRoute::Id& route_id, |
| 252 const url::Origin& origin, | 252 const std::string& origin, |
| 253 int tab_id, | 253 int tab_id, |
| 254 const std::vector<MediaRouteResponseCallback>& callbacks, | 254 const std::vector<MediaRouteResponseCallback>& callbacks, |
| 255 base::TimeDelta timeout, | 255 base::TimeDelta timeout, |
| 256 bool incognito); | 256 bool incognito); |
| 257 void DoTerminateRoute(const MediaRoute::Id& route_id); | 257 void DoTerminateRoute(const MediaRoute::Id& route_id); |
| 258 void DoDetachRoute(const MediaRoute::Id& route_id); | 258 void DoDetachRoute(const MediaRoute::Id& route_id); |
| 259 void DoSendSessionMessage(const MediaRoute::Id& route_id, | 259 void DoSendSessionMessage(const MediaRoute::Id& route_id, |
| 260 const std::string& message, | 260 const std::string& message, |
| 261 const SendRouteMessageCallback& callback); | 261 const SendRouteMessageCallback& callback); |
| 262 void DoSendSessionBinaryMessage(const MediaRoute::Id& route_id, | 262 void DoSendSessionBinaryMessage(const MediaRoute::Id& route_id, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 279 void OnConnectionError(); | 279 void OnConnectionError(); |
| 280 | 280 |
| 281 // mojom::MediaRouter implementation. | 281 // mojom::MediaRouter implementation. |
| 282 void RegisterMediaRouteProvider( | 282 void RegisterMediaRouteProvider( |
| 283 mojom::MediaRouteProviderPtr media_route_provider_ptr, | 283 mojom::MediaRouteProviderPtr media_route_provider_ptr, |
| 284 const mojom::MediaRouter::RegisterMediaRouteProviderCallback& | 284 const mojom::MediaRouter::RegisterMediaRouteProviderCallback& |
| 285 callback) override; | 285 callback) override; |
| 286 void OnIssue(const IssueInfo& issue) override; | 286 void OnIssue(const IssueInfo& issue) override; |
| 287 void OnSinksReceived(const std::string& media_source, | 287 void OnSinksReceived(const std::string& media_source, |
| 288 std::vector<mojom::MediaSinkPtr> sinks, | 288 std::vector<mojom::MediaSinkPtr> sinks, |
| 289 const std::vector<url::Origin>& origins) override; | 289 const std::vector<std::string>& origins) override; |
| 290 void OnRoutesUpdated( | 290 void OnRoutesUpdated( |
| 291 std::vector<mojom::MediaRoutePtr> routes, | 291 std::vector<mojom::MediaRoutePtr> routes, |
| 292 const std::string& media_source, | 292 const std::string& media_source, |
| 293 const std::vector<std::string>& joinable_route_ids) override; | 293 const std::vector<std::string>& joinable_route_ids) override; |
| 294 void OnSinkAvailabilityUpdated( | 294 void OnSinkAvailabilityUpdated( |
| 295 mojom::MediaRouter::SinkAvailability availability) override; | 295 mojom::MediaRouter::SinkAvailability availability) override; |
| 296 void OnPresentationConnectionStateChanged( | 296 void OnPresentationConnectionStateChanged( |
| 297 const std::string& route_id, | 297 const std::string& route_id, |
| 298 mojom::MediaRouter::PresentationConnectionState state) override; | 298 mojom::MediaRouter::PresentationConnectionState state) override; |
| 299 void OnPresentationConnectionClosed( | 299 void OnPresentationConnectionClosed( |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 #endif | 429 #endif |
| 430 | 430 |
| 431 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; | 431 base::WeakPtrFactory<MediaRouterMojoImpl> weak_factory_; |
| 432 | 432 |
| 433 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 433 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
| 434 }; | 434 }; |
| 435 | 435 |
| 436 } // namespace media_router | 436 } // namespace media_router |
| 437 | 437 |
| 438 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ | 438 #endif // CHROME_BROWSER_MEDIA_ROUTER_MOJO_MEDIA_ROUTER_MOJO_IMPL_H_ |
| OLD | NEW |