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_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 29 matching lines...) Expand all Loading... |
40 PresentationConnectionState state; | 40 PresentationConnectionState state; |
41 | 41 |
42 // |close_reason| and |messsage| are only used for state change to CLOSED. | 42 // |close_reason| and |messsage| are only used for state change to CLOSED. |
43 PresentationConnectionCloseReason close_reason; | 43 PresentationConnectionCloseReason close_reason; |
44 std::string message; | 44 std::string message; |
45 }; | 45 }; |
46 | 46 |
47 using PresentationConnectionStateChangedCallback = | 47 using PresentationConnectionStateChangedCallback = |
48 base::Callback<void(const PresentationConnectionStateChangeInfo&)>; | 48 base::Callback<void(const PresentationConnectionStateChangeInfo&)>; |
49 | 49 |
| 50 // This class serves as a proxy to PSImpl. |
| 51 class OffscreenPresentationClient { |
| 52 public: |
| 53 OffscreenPresentationClient() {} |
| 54 // Called when 1. receiver page is rendered for a presentation; |
| 55 // 2. new controller is connected to the presentation. |
| 56 virtual void OnReceiverConnectionAvailable( |
| 57 const content::PresentationSessionInfo&) = 0; |
| 58 // For controller, add a receiver client to its observer list, and the list |
| 59 // contains at most one element; |
| 60 // For receiver, add a controller client to its observer list, and the list |
| 61 // may contain multiple elements. |
| 62 virtual void AddOffscreenPresentationObserver( |
| 63 OffscreenPresentationClient*) = 0; |
| 64 |
| 65 virtual void RemoveOffscreenPresentationObserver( |
| 66 OffscreenPresentationClient*) = 0; |
| 67 |
| 68 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(OffscreenPresentationClient); |
| 70 }; |
| 71 |
50 // An interface implemented by embedders to handle presentation API calls | 72 // An interface implemented by embedders to handle presentation API calls |
51 // forwarded from PresentationServiceImpl. | 73 // forwarded from PresentationServiceImpl. |
52 class CONTENT_EXPORT PresentationServiceDelegate { | 74 class CONTENT_EXPORT PresentationServiceDelegate { |
53 public: | 75 public: |
54 // Observer interface to listen for changes to PresentationServiceDelegate. | 76 // Observer interface to listen for changes to PresentationServiceDelegate. |
55 class CONTENT_EXPORT Observer { | 77 class CONTENT_EXPORT Observer { |
56 public: | 78 public: |
57 // Called when the PresentationServiceDelegate is being destroyed. | 79 // Called when the PresentationServiceDelegate is being destroyed. |
58 virtual void OnDelegateDestroyed() = 0; | 80 virtual void OnDelegateDestroyed() = 0; |
59 | 81 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // frame. | 218 // frame. |
197 // |render_process_id|, |render_frame_id|: ID of frame. | 219 // |render_process_id|, |render_frame_id|: ID of frame. |
198 // |connection|: PresentationConnection to listen for state changes. | 220 // |connection|: PresentationConnection to listen for state changes. |
199 // |state_changed_cb|: Invoked with the PresentationConnection and its new | 221 // |state_changed_cb|: Invoked with the PresentationConnection and its new |
200 // state whenever there is a state change. | 222 // state whenever there is a state change. |
201 virtual void ListenForConnectionStateChange( | 223 virtual void ListenForConnectionStateChange( |
202 int render_process_id, | 224 int render_process_id, |
203 int render_frame_id, | 225 int render_frame_id, |
204 const PresentationSessionInfo& connection, | 226 const PresentationSessionInfo& connection, |
205 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; | 227 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; |
| 228 |
| 229 // Called when receiver PSImpl is connected with receiver render process. |
| 230 virtual void RegisterOffscreenPresentationReceiver( |
| 231 OffscreenPresentationClient*) = 0; |
| 232 |
| 233 // Called when receiver frame is destroyed. |
| 234 virtual void UnregisterOffscreenPresentationReceiver( |
| 235 OffscreenPresentationClient*) = 0; |
| 236 |
| 237 // Called when successfully starting presentation session. |
| 238 virtual void RegisterOffscreenPresentationController( |
| 239 const std::string& presentationId, |
| 240 OffscreenPresentationClient*) = 0; |
| 241 |
| 242 // Called when presentation connection is closed. |
| 243 virtual void UnregisterOffscreenPresentationController( |
| 244 const std::string& presentationId, |
| 245 OffscreenPresentationClient*) = 0; |
206 }; | 246 }; |
207 | 247 |
208 } // namespace content | 248 } // namespace content |
209 | 249 |
210 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 250 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |