| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // start/execute/stop remoting sessions. | 65 // start/execute/stop remoting sessions. |
| 66 class CastRemotingConnector | 66 class CastRemotingConnector |
| 67 : public base::SupportsUserData::Data, | 67 : public base::SupportsUserData::Data, |
| 68 public media_router::MediaRoutesObserver { | 68 public media_router::MediaRoutesObserver { |
| 69 public: | 69 public: |
| 70 // Returns the instance of the CastRemotingConnector associated with | 70 // Returns the instance of the CastRemotingConnector associated with |
| 71 // |source_contents|, creating a new instance if needed. | 71 // |source_contents|, creating a new instance if needed. |
| 72 static CastRemotingConnector* Get(content::WebContents* source_contents); | 72 static CastRemotingConnector* Get(content::WebContents* source_contents); |
| 73 | 73 |
| 74 // Used by ChromeContentBrowserClient to request a binding to a new | 74 // Used by ChromeContentBrowserClient to request a binding to a new |
| 75 // RemoterFactory for each new render frame. The |render_frame_host| is | 75 // RemoterFactory for each new render frame. |
| 76 // expected to outlive the mojo message pipe in |request| that the service | |
| 77 // binds to. | |
| 78 static void CreateRemoterFactory(content::RenderFrameHost* render_frame_host, | 76 static void CreateRemoterFactory(content::RenderFrameHost* render_frame_host, |
| 79 media::mojom::RemoterFactoryRequest request); | 77 media::mojom::RemoterFactoryRequest request); |
| 80 | 78 |
| 81 private: | 79 private: |
| 82 // Allow unit tests access to the private constructor and CreateBridge() | 80 // Allow unit tests access to the private constructor and CreateBridge() |
| 83 // method, since unit tests don't have a complete browser (i.e., with a | 81 // method, since unit tests don't have a complete browser (i.e., with a |
| 84 // WebContents and RenderFrameHost) to work with. | 82 // WebContents and RenderFrameHost) to work with. |
| 85 friend class CastRemotingConnectorTest; | 83 friend class CastRemotingConnectorTest; |
| 86 | 84 |
| 87 // Implementation of the media::mojom::RemoterFactory, with one instance | 85 // Implementation of the media::mojom::RemoterFactory, with one instance |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 base::WeakPtrFactory<CastRemotingConnector> weak_factory_; | 198 base::WeakPtrFactory<CastRemotingConnector> weak_factory_; |
| 201 | 199 |
| 202 // Key used with the base::SupportsUserData interface to search for an | 200 // Key used with the base::SupportsUserData interface to search for an |
| 203 // instance of CastRemotingConnector owned by a WebContents. | 201 // instance of CastRemotingConnector owned by a WebContents. |
| 204 static const void* const kUserDataKey; | 202 static const void* const kUserDataKey; |
| 205 | 203 |
| 206 DISALLOW_COPY_AND_ASSIGN(CastRemotingConnector); | 204 DISALLOW_COPY_AND_ASSIGN(CastRemotingConnector); |
| 207 }; | 205 }; |
| 208 | 206 |
| 209 #endif // CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ | 207 #endif // CHROME_BROWSER_MEDIA_CAST_REMOTING_CONNECTOR_H_ |
| OLD | NEW |