| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 presentation::PresentationSessionState)>; | 66 presentation::PresentationSessionState)>; |
| 67 | 67 |
| 68 // A helper data class used by PresentationServiceImpl to do bookkeeping | 68 // A helper data class used by PresentationServiceImpl to do bookkeeping |
| 69 // of currently registered screen availability listeners. | 69 // of currently registered screen availability listeners. |
| 70 // 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 |
| 71 // the available bit and the Mojo callback to become available. | 71 // the available bit and the Mojo callback to become available. |
| 72 // 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 |
| 73 // bit, and the state machine will reset. | 73 // bit, and the state machine will reset. |
| 74 // The available bit is obtained from the embedder's media router. | 74 // The available bit is obtained from the embedder's media router. |
| 75 // The callback is obtained from the renderer via PresentationServiceImpl's | 75 // The callback is obtained from the renderer via PresentationServiceImpl's |
| 76 // GetScreenAvailability(). | 76 // ListenForScreenAvailability(). |
| 77 class CONTENT_EXPORT ScreenAvailabilityContext | 77 class CONTENT_EXPORT ScreenAvailabilityContext |
| 78 : public PresentationScreenAvailabilityListener { | 78 : public PresentationScreenAvailabilityListener { |
| 79 public: | 79 public: |
| 80 explicit ScreenAvailabilityContext( | 80 explicit ScreenAvailabilityContext( |
| 81 const std::string& presentation_url); | 81 const std::string& presentation_url); |
| 82 ~ScreenAvailabilityContext() override; | 82 ~ScreenAvailabilityContext() override; |
| 83 | 83 |
| 84 // If available bit exists, |callback| will be invoked with the bit and | 84 // If available bit exists, |callback| will be invoked with the bit and |
| 85 // this state machine will reset. | 85 // this state machine will reset. |
| 86 // Otherwise |callback| is saved for later use. | 86 // Otherwise |callback| is saved for later use. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // by this class. | 144 // by this class. |
| 145 PresentationServiceImpl( | 145 PresentationServiceImpl( |
| 146 RenderFrameHost* render_frame_host, | 146 RenderFrameHost* render_frame_host, |
| 147 WebContents* web_contents, | 147 WebContents* web_contents, |
| 148 PresentationServiceDelegate* delegate); | 148 PresentationServiceDelegate* delegate); |
| 149 | 149 |
| 150 // PresentationService implementation. | 150 // PresentationService implementation. |
| 151 void SetDefaultPresentationURL( | 151 void SetDefaultPresentationURL( |
| 152 const mojo::String& presentation_url, | 152 const mojo::String& presentation_url, |
| 153 const mojo::String& presentation_id) override; | 153 const mojo::String& presentation_id) override; |
| 154 void GetScreenAvailability( | 154 void ListenForScreenAvailability( |
| 155 const mojo::String& presentation_url, | 155 const mojo::String& presentation_url, |
| 156 const ScreenAvailabilityMojoCallback& callback) override; | 156 const ScreenAvailabilityMojoCallback& callback) override; |
| 157 void OnScreenAvailabilityListenerRemoved( | 157 void RemoveScreenAvailabilityListener( |
| 158 const mojo::String& presentation_url) override; | 158 const mojo::String& presentation_url) override; |
| 159 void ListenForDefaultSessionStart( | 159 void ListenForDefaultSessionStart( |
| 160 const DefaultSessionMojoCallback& callback) override; | 160 const DefaultSessionMojoCallback& callback) override; |
| 161 void StartSession( | 161 void StartSession( |
| 162 const mojo::String& presentation_url, | 162 const mojo::String& presentation_url, |
| 163 const mojo::String& presentation_id, | 163 const mojo::String& presentation_id, |
| 164 const NewSessionMojoCallback& callback) override; | 164 const NewSessionMojoCallback& callback) override; |
| 165 void JoinSession( | 165 void JoinSession( |
| 166 const mojo::String& presentation_url, | 166 const mojo::String& presentation_url, |
| 167 const mojo::String& presentation_id, | 167 const mojo::String& presentation_id, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 // NOTE: Weak pointers must be invalidated before all other member variables. | 243 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 244 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; | 244 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; |
| 245 | 245 |
| 246 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); | 246 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 } // namespace content | 249 } // namespace content |
| 250 | 250 |
| 251 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ | 251 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ |
| OLD | NEW |