| 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_MOJO_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // |context|: The BrowserContext which owns the extension process. | 51 // |context|: The BrowserContext which owns the extension process. |
| 52 // |request|: The Mojo connection request used for binding. | 52 // |request|: The Mojo connection request used for binding. |
| 53 static void BindToRequest( | 53 static void BindToRequest( |
| 54 const std::string& extension_id, | 54 const std::string& extension_id, |
| 55 content::BrowserContext* context, | 55 content::BrowserContext* context, |
| 56 mojo::InterfaceRequest<interfaces::MediaRouter> request); | 56 mojo::InterfaceRequest<interfaces::MediaRouter> request); |
| 57 | 57 |
| 58 // MediaRouter implementation. | 58 // MediaRouter implementation. |
| 59 // Execution of the requests is delegated to the Do* methods, which can be | 59 // Execution of the requests is delegated to the Do* methods, which can be |
| 60 // enqueued for later use if the extension is temporarily suspended. | 60 // enqueued for later use if the extension is temporarily suspended. |
| 61 void CreateRoute(const MediaSource::Id& source_id, | 61 void CreateRoute( |
| 62 const MediaSink::Id& sink_id, | 62 const MediaSource::Id& source_id, |
| 63 const GURL& origin, | 63 const MediaSink::Id& sink_id, |
| 64 int tab_id, | 64 const GURL& origin, |
| 65 const MediaRouteResponseCallback& callback) override; | 65 int tab_id, |
| 66 void JoinRoute(const MediaSource::Id& source_id, | 66 const std::vector<MediaRouteResponseCallback>& callbacks) override; |
| 67 const std::string& presentation_id, | 67 void JoinRoute( |
| 68 const GURL& origin, | 68 const MediaSource::Id& source_id, |
| 69 int tab_id, | 69 const std::string& presentation_id, |
| 70 const MediaRouteResponseCallback& callback) override; | 70 const GURL& origin, |
| 71 int tab_id, |
| 72 const std::vector<MediaRouteResponseCallback>& callbacks) override; |
| 71 void CloseRoute(const MediaRoute::Id& route_id) override; | 73 void CloseRoute(const MediaRoute::Id& route_id) override; |
| 72 void SendRouteMessage(const MediaRoute::Id& route_id, | 74 void SendRouteMessage(const MediaRoute::Id& route_id, |
| 73 const std::string& message, | 75 const std::string& message, |
| 74 const SendRouteMessageCallback& callback) override; | 76 const SendRouteMessageCallback& callback) override; |
| 75 void ListenForRouteMessages( | 77 void ListenForRouteMessages( |
| 76 const std::vector<MediaRoute::Id>& route_ids, | 78 const std::vector<MediaRoute::Id>& route_ids, |
| 77 const PresentationSessionMessageCallback& message_cb) override; | 79 const PresentationSessionMessageCallback& message_cb) override; |
| 78 void ClearIssue(const Issue::Id& issue_id) override; | 80 void ClearIssue(const Issue::Id& issue_id) override; |
| 79 void RegisterMediaSinksObserver(MediaSinksObserver* observer) override; | 81 void RegisterMediaSinksObserver(MediaSinksObserver* observer) override; |
| 80 void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override; | 82 void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void RunOrDefer(const base::Closure& request); | 116 void RunOrDefer(const base::Closure& request); |
| 115 | 117 |
| 116 // Dispatches the Mojo requests queued in |pending_requests_|. | 118 // Dispatches the Mojo requests queued in |pending_requests_|. |
| 117 void ExecutePendingRequests(); | 119 void ExecutePendingRequests(); |
| 118 | 120 |
| 119 // These calls invoke methods in the component extension via Mojo. | 121 // These calls invoke methods in the component extension via Mojo. |
| 120 void DoCreateRoute(const MediaSource::Id& source_id, | 122 void DoCreateRoute(const MediaSource::Id& source_id, |
| 121 const MediaSink::Id& sink_id, | 123 const MediaSink::Id& sink_id, |
| 122 const std::string& origin, | 124 const std::string& origin, |
| 123 int tab_id, | 125 int tab_id, |
| 124 const MediaRouteResponseCallback& callback); | 126 const std::vector<MediaRouteResponseCallback>& callbacks); |
| 125 void DoJoinRoute(const MediaSource::Id& source_id, | 127 void DoJoinRoute(const MediaSource::Id& source_id, |
| 126 const std::string& presentation_id, | 128 const std::string& presentation_id, |
| 127 const std::string& origin, | 129 const std::string& origin, |
| 128 int tab_id, | 130 int tab_id, |
| 129 const MediaRouteResponseCallback& callback); | 131 const std::vector<MediaRouteResponseCallback>& callbacks); |
| 130 void DoCloseRoute(const MediaRoute::Id& route_id); | 132 void DoCloseRoute(const MediaRoute::Id& route_id); |
| 131 void DoSendSessionMessage(const MediaRoute::Id& route_id, | 133 void DoSendSessionMessage(const MediaRoute::Id& route_id, |
| 132 const std::string& message, | 134 const std::string& message, |
| 133 const SendRouteMessageCallback& callback); | 135 const SendRouteMessageCallback& callback); |
| 134 void DoListenForRouteMessages( | 136 void DoListenForRouteMessages( |
| 135 const std::vector<MediaRoute::Id>& route_ids, | 137 const std::vector<MediaRoute::Id>& route_ids, |
| 136 const PresentationSessionMessageCallback& message_cb); | 138 const PresentationSessionMessageCallback& message_cb); |
| 137 void DoClearIssue(const Issue::Id& issue_id); | 139 void DoClearIssue(const Issue::Id& issue_id); |
| 138 void DoStartObservingMediaSinks(const MediaSource::Id& source_id); | 140 void DoStartObservingMediaSinks(const MediaSource::Id& source_id); |
| 139 void DoStopObservingMediaSinks(const MediaSource::Id& source_id); | 141 void DoStopObservingMediaSinks(const MediaSource::Id& source_id); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 std::string instance_id_; | 199 std::string instance_id_; |
| 198 | 200 |
| 199 base::ThreadChecker thread_checker_; | 201 base::ThreadChecker thread_checker_; |
| 200 | 202 |
| 201 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); | 203 DISALLOW_COPY_AND_ASSIGN(MediaRouterMojoImpl); |
| 202 }; | 204 }; |
| 203 | 205 |
| 204 } // namespace media_router | 206 } // namespace media_router |
| 205 | 207 |
| 206 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ | 208 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_MOJO_IMPL_H_ |
| OLD | NEW |