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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 using SessionStateChangedCallback = | 22 using SessionStateChangedCallback = |
23 base::Callback<void(const PresentationSessionInfo&, | 23 base::Callback<void(const PresentationSessionInfo&, |
24 PresentationSessionState)>; | 24 PresentationSessionState)>; |
25 | 25 |
26 // Param #0: a vector of messages that are received. | 26 // Param #0: a vector of messages that are received. |
27 // Param #1: tells the callback handler that it may reuse strings or buffers | 27 // Param #1: tells the callback handler that it may reuse strings or buffers |
28 // in the messages contained within param #0. | 28 // in the messages contained within param #0. |
29 using PresentationSessionMessageCallback = base::Callback< | 29 using PresentationSessionMessageCallback = base::Callback< |
30 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; | 30 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; |
31 | 31 |
32 using PresenterSessionAvailableCallback = | |
33 base::Callback<void(const content::PresentationSessionInfo&)>; | |
34 | |
35 using SendMessageCallback = base::Callback<void(bool)>; | |
36 | |
32 // An interface implemented by embedders to handle presentation API calls | 37 // An interface implemented by embedders to handle presentation API calls |
33 // forwarded from PresentationServiceImpl. | 38 // forwarded from PresentationServiceImpl. |
34 class CONTENT_EXPORT PresentationServiceDelegate { | 39 class CONTENT_EXPORT PresentationServiceDelegate { |
35 public: | 40 public: |
36 // Observer interface to listen for changes to PresentationServiceDelegate. | 41 // Observer interface to listen for changes to PresentationServiceDelegate. |
37 class CONTENT_EXPORT Observer { | 42 class CONTENT_EXPORT Observer { |
38 public: | 43 public: |
39 // Called when the PresentationServiceDelegate is being destroyed. | 44 // Called when the PresentationServiceDelegate is being destroyed. |
40 virtual void OnDelegateDestroyed() = 0; | 45 virtual void OnDelegateDestroyed() = 0; |
41 | 46 |
42 // Called when the default presentation has been started outside of a | 47 // Called when the default presentation has been started outside of a |
43 // Presentation API context (e.g., browser action). This will not be called | 48 // Presentation API context (e.g., browser action). This will not be called |
44 // if the session was created as a result of Presentation API's | 49 // if the session was created as a result of Presentation API's |
45 // StartSession()/JoinSession(). | 50 // StartSession()/JoinSession(). |
46 virtual void OnDefaultPresentationStarted( | 51 virtual void OnDefaultPresentationStarted( |
47 const PresentationSessionInfo& session) = 0; | 52 const PresentationSessionInfo& session) = 0; |
48 | 53 |
49 protected: | 54 protected: |
50 virtual ~Observer() {} | 55 virtual ~Observer() {} |
51 }; | 56 }; |
52 | 57 |
53 using PresentationSessionSuccessCallback = | 58 using PresentationSessionSuccessCallback = |
54 base::Callback<void(const PresentationSessionInfo&)>; | 59 base::Callback<void(const PresentationSessionInfo&)>; |
55 using PresentationSessionErrorCallback = | 60 using PresentationSessionErrorCallback = |
56 base::Callback<void(const PresentationError&)>; | 61 base::Callback<void(const PresentationError&)>; |
57 using SendMessageCallback = base::Callback<void(bool)>; | |
58 | 62 |
59 virtual ~PresentationServiceDelegate() {} | 63 virtual ~PresentationServiceDelegate() {} |
60 | 64 |
61 // Registers an observer associated with frame with |render_process_id| | 65 // Registers an observer associated with frame with |render_process_id| |
62 // and |render_frame_id| with this class to listen for updates. | 66 // and |render_frame_id| with this class to listen for updates. |
63 // This class does not own the observer. | 67 // This class does not own the observer. |
64 // It is an error to add an observer if there is already an observer for that | 68 // It is an error to add an observer if there is already an observer for that |
65 // frame. | 69 // frame. |
66 virtual void AddObserver(int render_process_id, | 70 virtual void AddObserver(int render_process_id, |
67 int render_frame_id, | 71 int render_frame_id, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 const SendMessageCallback& send_message_cb) = 0; | 177 const SendMessageCallback& send_message_cb) = 0; |
174 | 178 |
175 // Continuously listen for presentation session state changes for a frame. | 179 // Continuously listen for presentation session state changes for a frame. |
176 // |render_process_id|, |render_frame_id|: ID of frame. | 180 // |render_process_id|, |render_frame_id|: ID of frame. |
177 // |state_changed_cb|: Invoked with the session and its new state whenever | 181 // |state_changed_cb|: Invoked with the session and its new state whenever |
178 // there is a state change. | 182 // there is a state change. |
179 virtual void ListenForSessionStateChange( | 183 virtual void ListenForSessionStateChange( |
180 int render_process_id, | 184 int render_process_id, |
181 int render_frame_id, | 185 int render_frame_id, |
182 const SessionStateChangedCallback& state_changed_cb) = 0; | 186 const SessionStateChangedCallback& state_changed_cb) = 0; |
187 | |
188 virtual void GetPresenterSession( | |
189 int render_process_id, | |
miu
2015/09/17 00:09:20
BTW--Most of the methods in this interface have th
imcheng
2015/09/26 01:21:57
It's definitely possible to use it on non main fra
| |
190 int render_frame_id, | |
191 const PresenterSessionAvailableCallback& success_callback, | |
192 const base::Callback<void(const std::string&)>& error_callback) = 0; | |
193 | |
194 virtual std::vector<content::PresentationSessionInfo> GetPresenterSessions( | |
195 int render_process_id, | |
196 int render_frame_id) = 0; | |
183 }; | 197 }; |
184 | 198 |
185 } // namespace content | 199 } // namespace content |
186 | 200 |
187 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 201 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |