OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CAST_REMOTING_CONNECTOR_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ |
6 #define CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ | 6 #define CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // responsible for passing small binary messages between the source and sink, | 59 // responsible for passing small binary messages between the source and sink, |
60 // while the CastRemotingSender handles the high-volume media data transfer. | 60 // while the CastRemotingSender handles the high-volume media data transfer. |
61 // | 61 // |
62 // Please see the unit tests in cast_remoting_connector_unittest.cc as a | 62 // Please see the unit tests in cast_remoting_connector_unittest.cc as a |
63 // reference for how CastRemotingConnector and a Cast Provider interact to | 63 // reference for how CastRemotingConnector and a Cast Provider interact to |
64 // start/execute/stop remoting sessions. | 64 // start/execute/stop remoting sessions. |
65 class CastRemotingConnector | 65 class CastRemotingConnector |
66 : public base::SupportsUserData::Data, | 66 : public base::SupportsUserData::Data, |
67 public media_router::MediaRoutesObserver { | 67 public media_router::MediaRoutesObserver { |
68 public: | 68 public: |
| 69 ~CastRemotingConnector() final; |
| 70 |
69 // Returns the instance of the CastRemotingConnector associated with | 71 // Returns the instance of the CastRemotingConnector associated with |
70 // |source_contents|, creating a new instance if needed. | 72 // |source_contents|, creating a new instance if needed. |
71 static CastRemotingConnector* Get(content::WebContents* source_contents); | 73 static CastRemotingConnector* Get(content::WebContents* source_contents); |
72 | 74 |
73 // Used by ChromeContentBrowserClient to request a binding to a new | 75 // Used by ChromeContentBrowserClient to request a binding to a new |
74 // Remoter for each new source in a render frame. | 76 // Remoter for each new source in a render frame. |
75 static void CreateMediaRemoter(content::RenderFrameHost* render_frame_host, | 77 static void CreateMediaRemoter(content::RenderFrameHost* render_frame_host, |
76 media::mojom::RemotingSourcePtr source, | 78 media::mojom::RemotingSourcePtr source, |
77 media::mojom::RemoterRequest request); | 79 media::mojom::RemoterRequest request); |
78 | 80 |
(...skipping 13 matching lines...) Expand all Loading... |
92 // A RouteMessageObserver for the remoting route that passes messages from the | 94 // A RouteMessageObserver for the remoting route that passes messages from the |
93 // Cast Provider back to this connector. An instance of this class only exists | 95 // Cast Provider back to this connector. An instance of this class only exists |
94 // while a remoting route is available, and is owned by CastRemotingConnector. | 96 // while a remoting route is available, and is owned by CastRemotingConnector. |
95 class MessageObserver; | 97 class MessageObserver; |
96 | 98 |
97 // Main constructor. |media_source_id| refers to any remoted content managed | 99 // Main constructor. |media_source_id| refers to any remoted content managed |
98 // by this instance (i.e., any remoted content from one tab/WebContents). | 100 // by this instance (i.e., any remoted content from one tab/WebContents). |
99 CastRemotingConnector(media_router::MediaRouter* router, | 101 CastRemotingConnector(media_router::MediaRouter* router, |
100 const media_router::MediaSource::Id& media_source_id); | 102 const media_router::MediaSource::Id& media_source_id); |
101 | 103 |
102 ~CastRemotingConnector() final; | |
103 | |
104 // Creates a RemotingBridge that implements the requested Remoter service, and | 104 // Creates a RemotingBridge that implements the requested Remoter service, and |
105 // binds it to the interface |request|. | 105 // binds it to the interface |request|. |
106 void CreateBridge(media::mojom::RemotingSourcePtr source, | 106 void CreateBridge(media::mojom::RemotingSourcePtr source, |
107 media::mojom::RemoterRequest request); | 107 media::mojom::RemoterRequest request); |
108 | 108 |
109 // Called by the RemotingBridge constructor/destructor to register/deregister | 109 // Called by the RemotingBridge constructor/destructor to register/deregister |
110 // an instance. This allows this connector to broadcast notifications to all | 110 // an instance. This allows this connector to broadcast notifications to all |
111 // active sources. | 111 // active sources. |
112 void RegisterBridge(RemotingBridge* bridge); | 112 void RegisterBridge(RemotingBridge* bridge); |
113 void DeregisterBridge(RemotingBridge* bridge, | 113 void DeregisterBridge(RemotingBridge* bridge, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 base::WeakPtrFactory<CastRemotingConnector> weak_factory_; | 198 base::WeakPtrFactory<CastRemotingConnector> weak_factory_; |
199 | 199 |
200 // Key used with the base::SupportsUserData interface to search for an | 200 // Key used with the base::SupportsUserData interface to search for an |
201 // instance of CastRemotingConnector owned by a WebContents. | 201 // instance of CastRemotingConnector owned by a WebContents. |
202 static const void* const kUserDataKey; | 202 static const void* const kUserDataKey; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(CastRemotingConnector); | 204 DISALLOW_COPY_AND_ASSIGN(CastRemotingConnector); |
205 }; | 205 }; |
206 | 206 |
207 #endif // CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ | 207 #endif // CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ |
OLD | NEW |