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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 mojo::InterfaceRequest<presentation::PresentationService> request); | 54 mojo::InterfaceRequest<presentation::PresentationService> request); |
55 | 55 |
56 private: | 56 private: |
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 = |
| 65 mojo::Callback<void(presentation::PresentationSessionInfoPtr, |
| 66 presentation::PresentationSessionState)>; |
64 | 67 |
65 // A helper data class used by PresentationServiceImpl to do bookkeeping | 68 // A helper data class used by PresentationServiceImpl to do bookkeeping |
66 // of currently registered screen availability listeners. | 69 // of currently registered screen availability listeners. |
67 // An instance of this class is a simple state machine that waits for both | 70 // An instance of this class is a simple state machine that waits for both |
68 // the available bit and the Mojo callback to become available. | 71 // the available bit and the Mojo callback to become available. |
69 // Once this happens, the Mojo callback will be invoked with the available | 72 // Once this happens, the Mojo callback will be invoked with the available |
70 // bit, and the state machine will reset. | 73 // bit, and the state machine will reset. |
71 // The available bit is obtained from the embedder's media router. | 74 // The available bit is obtained from the embedder's media router. |
72 // The callback is obtained from the renderer via PresentationServiceImpl's | 75 // The callback is obtained from the renderer via PresentationServiceImpl's |
73 // GetScreenAvailability(). | 76 // GetScreenAvailability(). |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const mojo::String& presentation_url, | 162 const mojo::String& presentation_url, |
160 const mojo::String& presentation_id, | 163 const mojo::String& presentation_id, |
161 const NewSessionMojoCallback& callback) override; | 164 const NewSessionMojoCallback& callback) override; |
162 void JoinSession( | 165 void JoinSession( |
163 const mojo::String& presentation_url, | 166 const mojo::String& presentation_url, |
164 const mojo::String& presentation_id, | 167 const mojo::String& presentation_id, |
165 const NewSessionMojoCallback& callback) override; | 168 const NewSessionMojoCallback& callback) override; |
166 void CloseSession( | 169 void CloseSession( |
167 const mojo::String& presentation_url, | 170 const mojo::String& presentation_url, |
168 const mojo::String& presentation_id) override; | 171 const mojo::String& presentation_id) override; |
| 172 void ListenForSessionStateChange( |
| 173 const SessionStateCallback& callback) override; |
169 | 174 |
170 // mojo::InterfaceImpl override. | 175 // mojo::InterfaceImpl override. |
171 // Note that this is called when the RenderFrameHost is deleted. | 176 // Note that this is called when the RenderFrameHost is deleted. |
172 void OnConnectionError() override; | 177 void OnConnectionError() override; |
173 | 178 |
174 // WebContentsObserver override. | 179 // WebContentsObserver override. |
175 void DidNavigateAnyFrame( | 180 void DidNavigateAnyFrame( |
176 content::RenderFrameHost* render_frame_host, | 181 content::RenderFrameHost* render_frame_host, |
177 const content::LoadCommittedDetails& details, | 182 const content::LoadCommittedDetails& details, |
178 const content::FrameNavigateParams& params) override; | 183 const content::FrameNavigateParams& params) override; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 242 |
238 // NOTE: Weak pointers must be invalidated before all other member variables. | 243 // NOTE: Weak pointers must be invalidated before all other member variables. |
239 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 244 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
240 | 245 |
241 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 246 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
242 }; | 247 }; |
243 | 248 |
244 } // namespace content | 249 } // namespace content |
245 | 250 |
246 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 251 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
OLD | NEW |