| 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 CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 ListenForConnectionClose); | 95 ListenForConnectionClose); |
| 96 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 96 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
| 97 SetPresentationConnection); | 97 SetPresentationConnection); |
| 98 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, | 98 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, |
| 99 ReceiverPresentationServiceDelegate); | 99 ReceiverPresentationServiceDelegate); |
| 100 | 100 |
| 101 // Maximum number of pending JoinSession requests at any given time. | 101 // Maximum number of pending JoinSession requests at any given time. |
| 102 static const int kMaxNumQueuedSessionRequests = 10; | 102 static const int kMaxNumQueuedSessionRequests = 10; |
| 103 | 103 |
| 104 using ConnectionMessagesCallback = | 104 using ConnectionMessagesCallback = |
| 105 base::Callback<void(std::vector<blink::mojom::ConnectionMessagePtr>)>; | 105 base::Callback<void(const std::vector<PresentationConnectionMessage>&)>; |
| 106 using SendConnectionMessageCallback = base::Callback<void(bool)>; | 106 using SendConnectionMessageCallback = base::Callback<void(bool)>; |
| 107 | 107 |
| 108 // Listener implementation owned by PresentationServiceImpl. An instance of | 108 // Listener implementation owned by PresentationServiceImpl. An instance of |
| 109 // this is created when PresentationRequest.getAvailability() is resolved. | 109 // this is created when PresentationRequest.getAvailability() is resolved. |
| 110 // The instance receives screen availability results from the embedder and | 110 // The instance receives screen availability results from the embedder and |
| 111 // propagates results back to PresentationServiceImpl. | 111 // propagates results back to PresentationServiceImpl. |
| 112 class CONTENT_EXPORT ScreenAvailabilityListenerImpl | 112 class CONTENT_EXPORT ScreenAvailabilityListenerImpl |
| 113 : public PresentationScreenAvailabilityListener { | 113 : public PresentationScreenAvailabilityListener { |
| 114 public: | 114 public: |
| 115 ScreenAvailabilityListenerImpl(const GURL& availability_url, | 115 ScreenAvailabilityListenerImpl(const GURL& availability_url, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void SetClient(blink::mojom::PresentationServiceClientPtr client) override; | 163 void SetClient(blink::mojom::PresentationServiceClientPtr client) override; |
| 164 void ListenForScreenAvailability(const GURL& url) override; | 164 void ListenForScreenAvailability(const GURL& url) override; |
| 165 void StopListeningForScreenAvailability(const GURL& url) override; | 165 void StopListeningForScreenAvailability(const GURL& url) override; |
| 166 void StartSession(const std::vector<GURL>& presentation_urls, | 166 void StartSession(const std::vector<GURL>& presentation_urls, |
| 167 const NewSessionCallback& callback) override; | 167 const NewSessionCallback& callback) override; |
| 168 void JoinSession(const std::vector<GURL>& presentation_urls, | 168 void JoinSession(const std::vector<GURL>& presentation_urls, |
| 169 const base::Optional<std::string>& presentation_id, | 169 const base::Optional<std::string>& presentation_id, |
| 170 const NewSessionCallback& callback) override; | 170 const NewSessionCallback& callback) override; |
| 171 void SendConnectionMessage( | 171 void SendConnectionMessage( |
| 172 const PresentationSessionInfo& session_info, | 172 const PresentationSessionInfo& session_info, |
| 173 blink::mojom::ConnectionMessagePtr connection_message, | 173 const PresentationConnectionMessage& message, |
| 174 const SendConnectionMessageCallback& callback) override; | 174 const SendConnectionMessageCallback& callback) override; |
| 175 void CloseConnection(const GURL& presentation_url, | 175 void CloseConnection(const GURL& presentation_url, |
| 176 const std::string& presentation_id) override; | 176 const std::string& presentation_id) override; |
| 177 void Terminate(const GURL& presentation_url, | 177 void Terminate(const GURL& presentation_url, |
| 178 const std::string& presentation_id) override; | 178 const std::string& presentation_id) override; |
| 179 void ListenForConnectionMessages( | 179 void ListenForConnectionMessages( |
| 180 const PresentationSessionInfo& session_info) override; | 180 const PresentationSessionInfo& session_info) override; |
| 181 void SetPresentationConnection( | 181 void SetPresentationConnection( |
| 182 const PresentationSessionInfo& session_info, | 182 const PresentationSessionInfo& session_info, |
| 183 blink::mojom::PresentationConnectionPtr controller_connection_ptr, | 183 blink::mojom::PresentationConnectionPtr controller_connection_ptr, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 // Calls to |delegate_| to start listening for state changes for |connection|. | 234 // Calls to |delegate_| to start listening for state changes for |connection|. |
| 235 // State changes will be returned via |OnConnectionStateChanged|. | 235 // State changes will be returned via |OnConnectionStateChanged|. |
| 236 void ListenForConnectionStateChange( | 236 void ListenForConnectionStateChange( |
| 237 const PresentationSessionInfo& connection); | 237 const PresentationSessionInfo& connection); |
| 238 | 238 |
| 239 // Passed to embedder's implementation of PresentationServiceDelegate for | 239 // Passed to embedder's implementation of PresentationServiceDelegate for |
| 240 // later invocation when session messages arrive. | 240 // later invocation when session messages arrive. |
| 241 void OnConnectionMessages( | 241 void OnConnectionMessages( |
| 242 const content::PresentationSessionInfo& session_info, | 242 const content::PresentationSessionInfo& session_info, |
| 243 const std::vector<std::unique_ptr<PresentationConnectionMessage>>& | 243 const std::vector<content::PresentationConnectionMessage>& messages); |
| 244 messages, | |
| 245 bool pass_ownership); | |
| 246 | 244 |
| 247 // A callback registered to OffscreenPresentationManager when | 245 // A callback registered to OffscreenPresentationManager when |
| 248 // the PresentationServiceImpl for the presentation receiver is initialized. | 246 // the PresentationServiceImpl for the presentation receiver is initialized. |
| 249 // Calls |client_| to create a new PresentationConnection on receiver page. | 247 // Calls |client_| to create a new PresentationConnection on receiver page. |
| 250 void OnReceiverConnectionAvailable( | 248 void OnReceiverConnectionAvailable( |
| 251 const content::PresentationSessionInfo& session_info, | 249 const content::PresentationSessionInfo& session_info, |
| 252 PresentationConnectionPtr controller_connection_ptr, | 250 PresentationConnectionPtr controller_connection_ptr, |
| 253 PresentationConnectionRequest receiver_connection_request); | 251 PresentationConnectionRequest receiver_connection_request); |
| 254 | 252 |
| 255 // Associates a JoinSession |callback| with a unique request ID and | 253 // Associates a JoinSession |callback| with a unique request ID and |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 312 |
| 315 // NOTE: Weak pointers must be invalidated before all other member variables. | 313 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 316 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 314 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
| 317 | 315 |
| 318 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 316 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
| 319 }; | 317 }; |
| 320 | 318 |
| 321 } // namespace content | 319 } // namespace content |
| 322 | 320 |
| 323 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 321 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| OLD | NEW |