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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 protected: | 38 protected: |
39 virtual ~Observer() {} | 39 virtual ~Observer() {} |
40 }; | 40 }; |
41 | 41 |
42 using PresentationSessionSuccessCallback = | 42 using PresentationSessionSuccessCallback = |
43 base::Callback<void(const PresentationSessionInfo&)>; | 43 base::Callback<void(const PresentationSessionInfo&)>; |
44 using PresentationSessionErrorCallback = | 44 using PresentationSessionErrorCallback = |
45 base::Callback<void(const PresentationError&)>; | 45 base::Callback<void(const PresentationError&)>; |
46 using PresentationSessionMessageCallback = base::Callback<void( | 46 using PresentationSessionMessageCallback = base::Callback<void( |
47 scoped_ptr<ScopedVector<PresentationSessionMessage>>)>; | 47 scoped_ptr<ScopedVector<PresentationSessionMessage>>)>; |
| 48 using SendMessageCallback = base::Closure; |
48 | 49 |
49 virtual ~PresentationServiceDelegate() {} | 50 virtual ~PresentationServiceDelegate() {} |
50 | 51 |
51 // Registers an observer associated with frame with |render_process_id| | 52 // Registers an observer associated with frame with |render_process_id| |
52 // and |render_frame_id| with this class to listen for updates. | 53 // and |render_frame_id| with this class to listen for updates. |
53 // This class does not own the observer. | 54 // This class does not own the observer. |
54 // It is an error to add an observer if there is already an observer for that | 55 // It is an error to add an observer if there is already an observer for that |
55 // frame. | 56 // frame. |
56 virtual void AddObserver(int render_process_id, | 57 virtual void AddObserver(int render_process_id, |
57 int render_frame_id, | 58 int render_frame_id, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 const PresentationSessionSuccessCallback& success_cb, | 138 const PresentationSessionSuccessCallback& success_cb, |
138 const PresentationSessionErrorCallback& error_cb) = 0; | 139 const PresentationSessionErrorCallback& error_cb) = 0; |
139 | 140 |
140 // Gets the next batch of messages from all presentation sessions in the frame | 141 // Gets the next batch of messages from all presentation sessions in the frame |
141 // |render_process_id|, |render_frame_id|: ID for originating frame. | 142 // |render_process_id|, |render_frame_id|: ID for originating frame. |
142 // |message_cb|: Invoked with a non-empty list of messages. | 143 // |message_cb|: Invoked with a non-empty list of messages. |
143 virtual void ListenForSessionMessages( | 144 virtual void ListenForSessionMessages( |
144 int render_process_id, | 145 int render_process_id, |
145 int render_frame_id, | 146 int render_frame_id, |
146 const PresentationSessionMessageCallback& message_cb) = 0; | 147 const PresentationSessionMessageCallback& message_cb) = 0; |
| 148 |
| 149 // Sends a message (string or binary data) to a presentation session. |
| 150 // |render_process_id|, |render_frame_id|: ID of originating frame. |
| 151 // |message_request|: Contains Presentation URL, ID and message to be sent |
| 152 // and delegate is responsible for deallocating the message_request. |
| 153 // |send_message_cb|: Invoked after handling the send message request. |
| 154 virtual void SendMessage( |
| 155 int render_process_id, |
| 156 int render_frame_id, |
| 157 scoped_ptr<PresentationSessionMessage> message_request, |
| 158 const SendMessageCallback& send_message_cb) = 0; |
147 }; | 159 }; |
148 | 160 |
149 } // namespace content | 161 } // namespace content |
150 | 162 |
151 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 163 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |