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 <string> | 10 #include <string> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 static const int kMaxNumQueuedSessionRequests = 10; | 99 static const int kMaxNumQueuedSessionRequests = 10; |
100 | 100 |
101 using DefaultSessionMojoCallback = | 101 using DefaultSessionMojoCallback = |
102 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; | 102 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; |
103 using SessionStateCallback = | 103 using SessionStateCallback = |
104 mojo::Callback<void(presentation::PresentationSessionInfoPtr, | 104 mojo::Callback<void(presentation::PresentationSessionInfoPtr, |
105 presentation::PresentationSessionState)>; | 105 presentation::PresentationSessionState)>; |
106 using SessionMessagesCallback = | 106 using SessionMessagesCallback = |
107 mojo::Callback<void(mojo::Array<presentation::SessionMessagePtr>)>; | 107 mojo::Callback<void(mojo::Array<presentation::SessionMessagePtr>)>; |
108 using SendMessageMojoCallback = mojo::Callback<void(bool)>; | 108 using SendMessageMojoCallback = mojo::Callback<void(bool)>; |
109 using GetPresentationReceiverSessionMojoCallback = | |
mark a. foltz
2015/10/01 06:25:29
Can we combine this with DefaultSessionMojoCallbac
imcheng
2015/10/06 00:59:15
Done.
| |
110 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; | |
109 | 111 |
110 // Listener implementation owned by PresentationServiceImpl. An instance of | 112 // Listener implementation owned by PresentationServiceImpl. An instance of |
111 // this is created when PresentationRequest.getAvailability() is resolved. | 113 // this is created when PresentationRequest.getAvailability() is resolved. |
112 // The instance receives screen availability results from the embedder and | 114 // The instance receives screen availability results from the embedder and |
113 // propagates results back to PresentationServiceImpl. | 115 // propagates results back to PresentationServiceImpl. |
114 class CONTENT_EXPORT ScreenAvailabilityListenerImpl | 116 class CONTENT_EXPORT ScreenAvailabilityListenerImpl |
115 : public PresentationScreenAvailabilityListener { | 117 : public PresentationScreenAvailabilityListener { |
116 public: | 118 public: |
117 ScreenAvailabilityListenerImpl( | 119 ScreenAvailabilityListenerImpl( |
118 const std::string& availability_url, | 120 const std::string& availability_url, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 void SendSessionMessage(presentation::PresentationSessionInfoPtr session_info, | 210 void SendSessionMessage(presentation::PresentationSessionInfoPtr session_info, |
209 presentation::SessionMessagePtr session_message, | 211 presentation::SessionMessagePtr session_message, |
210 const SendMessageMojoCallback& callback) override; | 212 const SendMessageMojoCallback& callback) override; |
211 void CloseSession( | 213 void CloseSession( |
212 const mojo::String& presentation_url, | 214 const mojo::String& presentation_url, |
213 const mojo::String& presentation_id) override; | 215 const mojo::String& presentation_id) override; |
214 void ListenForSessionStateChange( | 216 void ListenForSessionStateChange( |
215 presentation::PresentationSessionInfoPtr session) override; | 217 presentation::PresentationSessionInfoPtr session) override; |
216 void ListenForSessionMessages( | 218 void ListenForSessionMessages( |
217 presentation::PresentationSessionInfoPtr session) override; | 219 presentation::PresentationSessionInfoPtr session) override; |
220 void GetPresentationReceiverSession( | |
221 const GetPresentationReceiverSessionMojoCallback& callback) override; | |
218 | 222 |
219 // Creates a binding between this object and |request|. | 223 // Creates a binding between this object and |request|. |
220 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); | 224 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); |
221 | 225 |
222 // WebContentsObserver override. | 226 // WebContentsObserver override. |
223 void DidNavigateAnyFrame( | 227 void DidNavigateAnyFrame( |
224 content::RenderFrameHost* render_frame_host, | 228 content::RenderFrameHost* render_frame_host, |
225 const content::LoadCommittedDetails& details, | 229 const content::LoadCommittedDetails& details, |
226 const content::FrameNavigateParams& params) override; | 230 const content::FrameNavigateParams& params) override; |
227 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 231 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
(...skipping 25 matching lines...) Expand all Loading... | |
253 void OnStartSessionError( | 257 void OnStartSessionError( |
254 int request_session_id, | 258 int request_session_id, |
255 const PresentationError& error); | 259 const PresentationError& error); |
256 void OnJoinSessionSucceeded( | 260 void OnJoinSessionSucceeded( |
257 int request_session_id, | 261 int request_session_id, |
258 const PresentationSessionInfo& session_info); | 262 const PresentationSessionInfo& session_info); |
259 void OnJoinSessionError( | 263 void OnJoinSessionError( |
260 int request_session_id, | 264 int request_session_id, |
261 const PresentationError& error); | 265 const PresentationError& error); |
262 void OnSendMessageCallback(bool sent); | 266 void OnSendMessageCallback(bool sent); |
267 void OnGetPresentationReceiverSession( | |
268 const content::PresentationSessionInfo* session_info); | |
263 | 269 |
264 // Passed to embedder's implementation of PresentationServiceDelegate for | 270 // Passed to embedder's implementation of PresentationServiceDelegate for |
265 // later invocation when session messages arrive. | 271 // later invocation when session messages arrive. |
266 void OnSessionMessages( | 272 void OnSessionMessages( |
267 const content::PresentationSessionInfo& session, | 273 const content::PresentationSessionInfo& session, |
268 const ScopedVector<PresentationSessionMessage>& messages, | 274 const ScopedVector<PresentationSessionMessage>& messages, |
269 bool pass_ownership); | 275 bool pass_ownership); |
270 | 276 |
271 // Associates a JoinSession |callback| with a unique request ID and | 277 // Associates a JoinSession |callback| with a unique request ID and |
272 // stores it in a map. | 278 // stores it in a map. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 | 315 |
310 // RAII binding of |this| to an Presentation interface request. | 316 // RAII binding of |this| to an Presentation interface request. |
311 // The binding is removed when binding_ is cleared or goes out of scope. | 317 // The binding is removed when binding_ is cleared or goes out of scope. |
312 scoped_ptr<mojo::Binding<presentation::PresentationService>> binding_; | 318 scoped_ptr<mojo::Binding<presentation::PresentationService>> binding_; |
313 | 319 |
314 // There can be only one send message request at a time. | 320 // There can be only one send message request at a time. |
315 scoped_ptr<SendMessageMojoCallback> send_message_callback_; | 321 scoped_ptr<SendMessageMojoCallback> send_message_callback_; |
316 | 322 |
317 scoped_ptr<SessionMessagesCallback> on_session_messages_callback_; | 323 scoped_ptr<SessionMessagesCallback> on_session_messages_callback_; |
318 | 324 |
325 scoped_ptr<GetPresentationReceiverSessionMojoCallback> | |
326 receiver_session_callback_; | |
327 | |
319 // ID of the RenderFrameHost this object is associated with. | 328 // ID of the RenderFrameHost this object is associated with. |
320 int render_process_id_; | 329 int render_process_id_; |
321 int render_frame_id_; | 330 int render_frame_id_; |
322 | 331 |
323 // NOTE: Weak pointers must be invalidated before all other member variables. | 332 // NOTE: Weak pointers must be invalidated before all other member variables. |
324 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 333 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
325 | 334 |
326 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 335 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
327 }; | 336 }; |
328 | 337 |
329 } // namespace content | 338 } // namespace content |
330 | 339 |
331 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 340 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |