Chromium Code Reviews| 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 CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 class PresentationScreenAvailabilityListener; | 28 class PresentationScreenAvailabilityListener; |
| 29 class WebContents; | 29 class WebContents; |
| 30 struct PresentationSessionInfo; | 30 struct PresentationSessionInfo; |
| 31 struct PresentationSessionMessage; | 31 struct PresentationSessionMessage; |
| 32 } // namespace content | 32 } // namespace content |
| 33 | 33 |
| 34 namespace media_router { | 34 namespace media_router { |
| 35 | 35 |
| 36 class MediaRoute; | 36 class MediaRoute; |
| 37 class MediaSinksObserver; | 37 class MediaSinksObserver; |
| 38 class OffscreenPresentationManager; | |
| 38 class PresentationFrameManager; | 39 class PresentationFrameManager; |
| 39 class RouteRequestResult; | 40 class RouteRequestResult; |
| 40 | 41 |
| 41 // Implementation of PresentationServiceDelegate that interfaces an | 42 // Implementation of PresentationServiceDelegate that interfaces an |
| 42 // instance of WebContents with the Chrome Media Router. It uses the Media | 43 // instance of WebContents with the Chrome Media Router. It uses the Media |
| 43 // Router to handle presentation API calls forwarded from | 44 // Router to handle presentation API calls forwarded from |
| 44 // PresentationServiceImpl. In addition, it also | 45 // PresentationServiceImpl. In addition, it also |
| 45 // provides default presentation URL that is required for creating | 46 // provides default presentation URL that is required for creating |
| 46 // browser-initiated sessions. | 47 // browser-initiated sessions. |
| 47 // It is scoped to the lifetime of a WebContents, and is managed by the | 48 // It is scoped to the lifetime of a WebContents, and is managed by the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 int render_frame_id, | 124 int render_frame_id, |
| 124 const content::PresentationSessionInfo& session, | 125 const content::PresentationSessionInfo& session, |
| 125 std::unique_ptr<content::PresentationSessionMessage> message, | 126 std::unique_ptr<content::PresentationSessionMessage> message, |
| 126 const SendMessageCallback& send_message_cb) override; | 127 const SendMessageCallback& send_message_cb) override; |
| 127 void ListenForConnectionStateChange( | 128 void ListenForConnectionStateChange( |
| 128 int render_process_id, | 129 int render_process_id, |
| 129 int render_frame_id, | 130 int render_frame_id, |
| 130 const content::PresentationSessionInfo& connection, | 131 const content::PresentationSessionInfo& connection, |
| 131 const content::PresentationConnectionStateChangedCallback& | 132 const content::PresentationConnectionStateChangedCallback& |
| 132 state_changed_cb) override; | 133 state_changed_cb) override; |
| 133 | |
| 134 // Callback invoked when a default PresentationRequest is started from a | 134 // Callback invoked when a default PresentationRequest is started from a |
| 135 // browser-initiated dialog. | 135 // browser-initiated dialog. |
| 136 void OnRouteResponse(const PresentationRequest& request, | 136 void OnRouteResponse(const PresentationRequest& request, |
| 137 const RouteRequestResult& result); | 137 const RouteRequestResult& result); |
| 138 | 138 |
| 139 // Adds / removes an observer for listening to default PresentationRequest | 139 // Adds / removes an observer for listening to default PresentationRequest |
| 140 // changes. This class does not own |observer|. When |observer| is about to | 140 // changes. This class does not own |observer|. When |observer| is about to |
| 141 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. | 141 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. |
| 142 void AddDefaultPresentationRequestObserver( | 142 void AddDefaultPresentationRequestObserver( |
| 143 DefaultPresentationRequestObserver* observer); | 143 DefaultPresentationRequestObserver* observer); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 157 content::WebContents* web_contents() const { return web_contents_; } | 157 content::WebContents* web_contents() const { return web_contents_; } |
| 158 | 158 |
| 159 base::WeakPtr<PresentationServiceDelegateImpl> GetWeakPtr(); | 159 base::WeakPtr<PresentationServiceDelegateImpl> GetWeakPtr(); |
| 160 | 160 |
| 161 void SetMediaRouterForTest(MediaRouter* router); | 161 void SetMediaRouterForTest(MediaRouter* router); |
| 162 bool HasScreenAvailabilityListenerForTest( | 162 bool HasScreenAvailabilityListenerForTest( |
| 163 int render_process_id, | 163 int render_process_id, |
| 164 int render_frame_id, | 164 int render_frame_id, |
| 165 const MediaSource::Id& source_id) const; | 165 const MediaSource::Id& source_id) const; |
| 166 | 166 |
| 167 void RegisterOffscreenPresentationReceiver( | |
| 168 content::OffscreenPresentationClient*) override {} | |
| 169 | |
| 170 void UnregisterOffscreenPresentationReceiver( | |
| 171 content::OffscreenPresentationClient*) override {} | |
| 172 | |
| 173 void RegisterOffscreenPresentationController( | |
| 174 const std::string& presentationId, | |
| 175 content::OffscreenPresentationClient*) override; | |
| 176 | |
| 177 void UnregisterOffscreenPresentationController( | |
| 178 const std::string& presentationId, | |
| 179 content::OffscreenPresentationClient*) override; | |
| 180 | |
| 167 private: | 181 private: |
| 168 friend class content::WebContentsUserData<PresentationServiceDelegateImpl>; | 182 friend class content::WebContentsUserData<PresentationServiceDelegateImpl>; |
| 169 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, | 183 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, |
| 170 DelegateObservers); | 184 DelegateObservers); |
| 171 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, | 185 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, |
| 172 SetDefaultPresentationUrl); | 186 SetDefaultPresentationUrl); |
| 173 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, | 187 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, |
| 174 DefaultPresentationRequestObserver); | 188 DefaultPresentationRequestObserver); |
| 175 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, | 189 FRIEND_TEST_ALL_PREFIXES(PresentationServiceDelegateImplTest, |
| 176 DefaultPresentationUrlCallback); | 190 DefaultPresentationUrlCallback); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 197 const content::PresentationSessionInfo& new_session, | 211 const content::PresentationSessionInfo& new_session, |
| 198 const MediaRoute::Id& route_id); | 212 const MediaRoute::Id& route_id); |
| 199 | 213 |
| 200 // References to the WebContents that owns this instance, and associated | 214 // References to the WebContents that owns this instance, and associated |
| 201 // browser profile's MediaRouter instance. | 215 // browser profile's MediaRouter instance. |
| 202 content::WebContents* const web_contents_; | 216 content::WebContents* const web_contents_; |
| 203 MediaRouter* router_; | 217 MediaRouter* router_; |
| 204 | 218 |
| 205 std::unique_ptr<PresentationFrameManager> frame_manager_; | 219 std::unique_ptr<PresentationFrameManager> frame_manager_; |
| 206 | 220 |
| 221 OffscreenPresentationManager* const m_offscreenPresentationManager; | |
|
imcheng
2016/09/19 23:01:17
offscreen_presentation_manager_;
zhaobin
2016/09/23 17:18:18
Done.
| |
| 222 | |
| 207 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; | 223 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; |
| 208 | 224 |
| 209 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); | 225 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); |
| 210 }; | 226 }; |
| 211 | 227 |
| 212 } // namespace media_router | 228 } // namespace media_router |
| 213 | 229 |
| 214 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 230 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
| OLD | NEW |