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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/presentation_session.h" | 10 #include "content/public/browser/presentation_session.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual void OnDelegateDestroyed() = 0; | 24 virtual void OnDelegateDestroyed() = 0; |
25 | 25 |
26 protected: | 26 protected: |
27 virtual ~Observer() {} | 27 virtual ~Observer() {} |
28 }; | 28 }; |
29 | 29 |
30 using PresentationSessionSuccessCallback = | 30 using PresentationSessionSuccessCallback = |
31 base::Callback<void(const PresentationSessionInfo&)>; | 31 base::Callback<void(const PresentationSessionInfo&)>; |
32 using PresentationSessionErrorCallback = | 32 using PresentationSessionErrorCallback = |
33 base::Callback<void(const PresentationError&)>; | 33 base::Callback<void(const PresentationError&)>; |
| 34 using SendMessageCallback = base::Callback<void()>; |
34 | 35 |
35 virtual ~PresentationServiceDelegate() {} | 36 virtual ~PresentationServiceDelegate() {} |
36 | 37 |
37 // Registers an observer with this class to listen for updates to this class. | 38 // Registers an observer with this class to listen for updates to this class. |
38 // This class does not own the observer. | 39 // This class does not own the observer. |
39 // It is an error to add an observer if it has already been added before. | 40 // It is an error to add an observer if it has already been added before. |
40 virtual void AddObserver(Observer* observer) = 0; | 41 virtual void AddObserver(Observer* observer) = 0; |
41 // Unregisters an observer with this class. | 42 // Unregisters an observer with this class. |
42 virtual void RemoveObserver(Observer* observer) = 0; | 43 virtual void RemoveObserver(Observer* observer) = 0; |
43 | 44 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // |success_cb|: Invoked with session info, if presentation session joined | 109 // |success_cb|: Invoked with session info, if presentation session joined |
109 // successfully. | 110 // successfully. |
110 // |error_cb|: Invoked with error reason, if joining failed. | 111 // |error_cb|: Invoked with error reason, if joining failed. |
111 virtual void JoinSession( | 112 virtual void JoinSession( |
112 int render_process_id, | 113 int render_process_id, |
113 int render_frame_id, | 114 int render_frame_id, |
114 const std::string& presentation_url, | 115 const std::string& presentation_url, |
115 const std::string& presentation_id, | 116 const std::string& presentation_id, |
116 const PresentationSessionSuccessCallback& success_cb, | 117 const PresentationSessionSuccessCallback& success_cb, |
117 const PresentationSessionErrorCallback& error_cb) = 0; | 118 const PresentationSessionErrorCallback& error_cb) = 0; |
| 119 |
| 120 // Sends a string message to a presentation session. |
| 121 // |render_process_id|, |render_frame_id|: ID of originating frame. |
| 122 // |presentation_url|: URL of the presentation. |
| 123 // |presentation_id|: ID of the presentation. |
| 124 // |message|: message to be sent. |
| 125 // |send_message_cb|: Invoked when message is sent. |
| 126 virtual void SendStringMessage( |
| 127 int render_process_id, |
| 128 int render_frame_id, |
| 129 const std::string& presentation_url, |
| 130 const std::string& presentation_id, |
| 131 const std::string& message, |
| 132 const SendMessageCallback& send_message_cb) = 0; |
118 }; | 133 }; |
119 | 134 |
120 } // namespace content | 135 } // namespace content |
121 | 136 |
122 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 137 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |