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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 using ScreenAvailabilityMojoCallback = | 57 using ScreenAvailabilityMojoCallback = |
58 mojo::Callback<void(mojo::String, bool)>; | 58 mojo::Callback<void(mojo::String, bool)>; |
59 using NewSessionMojoCallback = | 59 using NewSessionMojoCallback = |
60 mojo::Callback<void(presentation::PresentationSessionInfoPtr, | 60 mojo::Callback<void(presentation::PresentationSessionInfoPtr, |
61 presentation::PresentationErrorPtr)>; | 61 presentation::PresentationErrorPtr)>; |
62 using DefaultSessionMojoCallback = | 62 using DefaultSessionMojoCallback = |
63 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; | 63 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; |
64 using SessionStateCallback = | 64 using SessionStateCallback = |
65 mojo::Callback<void(presentation::PresentationSessionInfoPtr, | 65 mojo::Callback<void(presentation::PresentationSessionInfoPtr, |
66 presentation::PresentationSessionState)>; | 66 presentation::PresentationSessionState)>; |
| 67 using SessionMessagesCallback = |
| 68 mojo::Callback<void(mojo::Array<presentation::SessionMessagePtr>)>; |
67 | 69 |
68 // A helper data class used by PresentationServiceImpl to do bookkeeping | 70 // A helper data class used by PresentationServiceImpl to do bookkeeping |
69 // of currently registered screen availability listeners. | 71 // of currently registered screen availability listeners. |
70 // An instance of this class is a simple state machine that waits for both | 72 // An instance of this class is a simple state machine that waits for both |
71 // the available bit and the Mojo callback to become available. | 73 // the available bit and the Mojo callback to become available. |
72 // Once this happens, the Mojo callback will be invoked with the available | 74 // Once this happens, the Mojo callback will be invoked with the available |
73 // bit, and the state machine will reset. | 75 // bit, and the state machine will reset. |
74 // The available bit is obtained from the embedder's media router. | 76 // The available bit is obtained from the embedder's media router. |
75 // The callback is obtained from the renderer via PresentationServiceImpl's | 77 // The callback is obtained from the renderer via PresentationServiceImpl's |
76 // ListenForScreenAvailability(). | 78 // ListenForScreenAvailability(). |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 const NewSessionMojoCallback& callback) override; | 202 const NewSessionMojoCallback& callback) override; |
201 void JoinSession( | 203 void JoinSession( |
202 const mojo::String& presentation_url, | 204 const mojo::String& presentation_url, |
203 const mojo::String& presentation_id, | 205 const mojo::String& presentation_id, |
204 const NewSessionMojoCallback& callback) override; | 206 const NewSessionMojoCallback& callback) override; |
205 void CloseSession( | 207 void CloseSession( |
206 const mojo::String& presentation_url, | 208 const mojo::String& presentation_url, |
207 const mojo::String& presentation_id) override; | 209 const mojo::String& presentation_id) override; |
208 void ListenForSessionStateChange( | 210 void ListenForSessionStateChange( |
209 const SessionStateCallback& callback) override; | 211 const SessionStateCallback& callback) override; |
| 212 void ListenForSessionMessages( |
| 213 const SessionMessagesCallback& callback) override; |
210 | 214 |
211 // Creates a binding between this object and |request|. | 215 // Creates a binding between this object and |request|. |
212 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); | 216 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); |
213 | 217 |
214 // mojo::ErrorHandler override. | 218 // mojo::ErrorHandler override. |
215 // Note that this is called when the RenderFrameHost is deleted. | 219 // Note that this is called when the RenderFrameHost is deleted. |
216 void OnConnectionError() override; | 220 void OnConnectionError() override; |
217 | 221 |
218 // WebContentsObserver override. | 222 // WebContentsObserver override. |
219 void DidNavigateAnyFrame( | 223 void DidNavigateAnyFrame( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 324 |
321 // NOTE: Weak pointers must be invalidated before all other member variables. | 325 // NOTE: Weak pointers must be invalidated before all other member variables. |
322 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 326 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
323 | 327 |
324 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 328 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
325 }; | 329 }; |
326 | 330 |
327 } // namespace content | 331 } // namespace content |
328 | 332 |
329 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 333 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |