| 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(std::vector<PresentationConnectionMessage>)>; |
| 106 | 106 |
| 107 // Listener implementation owned by PresentationServiceImpl. An instance of | 107 // Listener implementation owned by PresentationServiceImpl. An instance of |
| 108 // this is created when PresentationRequest.getAvailability() is resolved. | 108 // this is created when PresentationRequest.getAvailability() is resolved. |
| 109 // The instance receives screen availability results from the embedder and | 109 // The instance receives screen availability results from the embedder and |
| 110 // propagates results back to PresentationServiceImpl. | 110 // propagates results back to PresentationServiceImpl. |
| 111 class CONTENT_EXPORT ScreenAvailabilityListenerImpl | 111 class CONTENT_EXPORT ScreenAvailabilityListenerImpl |
| 112 : public PresentationScreenAvailabilityListener { | 112 : public PresentationScreenAvailabilityListener { |
| 113 public: | 113 public: |
| 114 ScreenAvailabilityListenerImpl(const GURL& availability_url, | 114 ScreenAvailabilityListenerImpl(const GURL& availability_url, |
| 115 PresentationServiceImpl* service); | 115 PresentationServiceImpl* service); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 // Calls to |delegate_| to start listening for state changes for |connection|. | 228 // Calls to |delegate_| to start listening for state changes for |connection|. |
| 229 // State changes will be returned via |OnConnectionStateChanged|. | 229 // State changes will be returned via |OnConnectionStateChanged|. |
| 230 void ListenForConnectionStateChange( | 230 void ListenForConnectionStateChange( |
| 231 const PresentationSessionInfo& connection); | 231 const PresentationSessionInfo& connection); |
| 232 | 232 |
| 233 // Passed to embedder's implementation of PresentationServiceDelegate for | 233 // Passed to embedder's implementation of PresentationServiceDelegate for |
| 234 // later invocation when session messages arrive. | 234 // later invocation when session messages arrive. |
| 235 void OnConnectionMessages( | 235 void OnConnectionMessages( |
| 236 const content::PresentationSessionInfo& session_info, | 236 const content::PresentationSessionInfo& session_info, |
| 237 const std::vector<std::unique_ptr<PresentationConnectionMessage>>& | 237 std::vector<content::PresentationConnectionMessage> messages); |
| 238 messages, | |
| 239 bool pass_ownership); | |
| 240 | 238 |
| 241 // A callback registered to OffscreenPresentationManager when | 239 // A callback registered to OffscreenPresentationManager when |
| 242 // the PresentationServiceImpl for the presentation receiver is initialized. | 240 // the PresentationServiceImpl for the presentation receiver is initialized. |
| 243 // Calls |client_| to create a new PresentationConnection on receiver page. | 241 // Calls |client_| to create a new PresentationConnection on receiver page. |
| 244 void OnReceiverConnectionAvailable( | 242 void OnReceiverConnectionAvailable( |
| 245 const content::PresentationSessionInfo& session_info, | 243 const content::PresentationSessionInfo& session_info, |
| 246 PresentationConnectionPtr controller_connection_ptr, | 244 PresentationConnectionPtr controller_connection_ptr, |
| 247 PresentationConnectionRequest receiver_connection_request); | 245 PresentationConnectionRequest receiver_connection_request); |
| 248 | 246 |
| 249 // Associates a JoinSession |callback| with a unique request ID and | 247 // Associates a JoinSession |callback| with a unique request ID and |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 301 |
| 304 // NOTE: Weak pointers must be invalidated before all other member variables. | 302 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 305 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 303 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
| 306 | 304 |
| 307 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 305 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
| 308 }; | 306 }; |
| 309 | 307 |
| 310 } // namespace content | 308 } // namespace content |
| 311 | 309 |
| 312 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 310 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| OLD | NEW |