| 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 SessionTextMessageCallback = |
| 68 mojo::Callback<void(presentation::PresentationSessionInfoPtr, |
| 69 mojo::String)>; |
| 67 | 70 |
| 68 // A helper data class used by PresentationServiceImpl to do bookkeeping | 71 // A helper data class used by PresentationServiceImpl to do bookkeeping |
| 69 // of currently registered screen availability listeners. | 72 // of currently registered screen availability listeners. |
| 70 // An instance of this class is a simple state machine that waits for both | 73 // 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. | 74 // the available bit and the Mojo callback to become available. |
| 72 // Once this happens, the Mojo callback will be invoked with the available | 75 // Once this happens, the Mojo callback will be invoked with the available |
| 73 // bit, and the state machine will reset. | 76 // bit, and the state machine will reset. |
| 74 // The available bit is obtained from the embedder's media router. | 77 // The available bit is obtained from the embedder's media router. |
| 75 // The callback is obtained from the renderer via PresentationServiceImpl's | 78 // The callback is obtained from the renderer via PresentationServiceImpl's |
| 76 // ListenForScreenAvailability(). | 79 // ListenForScreenAvailability(). |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 const NewSessionMojoCallback& callback) override; | 176 const NewSessionMojoCallback& callback) override; |
| 174 void JoinSession( | 177 void JoinSession( |
| 175 const mojo::String& presentation_url, | 178 const mojo::String& presentation_url, |
| 176 const mojo::String& presentation_id, | 179 const mojo::String& presentation_id, |
| 177 const NewSessionMojoCallback& callback) override; | 180 const NewSessionMojoCallback& callback) override; |
| 178 void CloseSession( | 181 void CloseSession( |
| 179 const mojo::String& presentation_url, | 182 const mojo::String& presentation_url, |
| 180 const mojo::String& presentation_id) override; | 183 const mojo::String& presentation_id) override; |
| 181 void ListenForSessionStateChange( | 184 void ListenForSessionStateChange( |
| 182 const SessionStateCallback& callback) override; | 185 const SessionStateCallback& callback) override; |
| 186 void ListenForSessionTextMessage( |
| 187 const SessionTextMessageCallback& callback) override; |
| 183 | 188 |
| 184 // Creates a binding between this object and |request|. | 189 // Creates a binding between this object and |request|. |
| 185 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); | 190 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); |
| 186 | 191 |
| 187 // mojo::ErrorHandler override. | 192 // mojo::ErrorHandler override. |
| 188 // Note that this is called when the RenderFrameHost is deleted. | 193 // Note that this is called when the RenderFrameHost is deleted. |
| 189 void OnConnectionError() override; | 194 void OnConnectionError() override; |
| 190 | 195 |
| 191 // WebContentsObserver override. | 196 // WebContentsObserver override. |
| 192 void DidNavigateAnyFrame( | 197 void DidNavigateAnyFrame( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 288 |
| 284 // NOTE: Weak pointers must be invalidated before all other member variables. | 289 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 285 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 290 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
| 286 | 291 |
| 287 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 292 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
| 288 }; | 293 }; |
| 289 | 294 |
| 290 } // namespace content | 295 } // namespace content |
| 291 | 296 |
| 292 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 297 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| OLD | NEW |