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_message.h" | |
10 #include "content/public/browser/presentation_session.h" | 11 #include "content/public/browser/presentation_session.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 class PresentationScreenAvailabilityListener; | 15 class PresentationScreenAvailabilityListener; |
15 | 16 |
16 // An interface implemented by embedders to handle presentation API calls | 17 // An interface implemented by embedders to handle presentation API calls |
17 // forwarded from PresentationServiceImpl. | 18 // forwarded from PresentationServiceImpl. |
18 class CONTENT_EXPORT PresentationServiceDelegate { | 19 class CONTENT_EXPORT PresentationServiceDelegate { |
19 public: | 20 public: |
(...skipping 11 matching lines...) Expand all Loading... | |
31 const PresentationSessionInfo& session) = 0; | 32 const PresentationSessionInfo& session) = 0; |
32 | 33 |
33 protected: | 34 protected: |
34 virtual ~Observer() {} | 35 virtual ~Observer() {} |
35 }; | 36 }; |
36 | 37 |
37 using PresentationSessionSuccessCallback = | 38 using PresentationSessionSuccessCallback = |
38 base::Callback<void(const PresentationSessionInfo&)>; | 39 base::Callback<void(const PresentationSessionInfo&)>; |
39 using PresentationSessionErrorCallback = | 40 using PresentationSessionErrorCallback = |
40 base::Callback<void(const PresentationError&)>; | 41 base::Callback<void(const PresentationError&)>; |
42 using SendMessageCallback = base::Callback<void()>; | |
imcheng (use chromium acct)
2015/04/30 20:11:30
using SendMessageCallback = base::Closure;
USE s.singapati at gmail.com
2015/05/04 16:40:28
Done.
| |
41 | 43 |
42 virtual ~PresentationServiceDelegate() {} | 44 virtual ~PresentationServiceDelegate() {} |
43 | 45 |
44 // Registers an observer associated with frame with |render_process_id| | 46 // Registers an observer associated with frame with |render_process_id| |
45 // and |render_frame_id| with this class to listen for updates. | 47 // and |render_frame_id| with this class to listen for updates. |
46 // This class does not own the observer. | 48 // This class does not own the observer. |
47 // It is an error to add an observer if there is already an observer for that | 49 // It is an error to add an observer if there is already an observer for that |
48 // frame. | 50 // frame. |
49 virtual void AddObserver(int render_process_id, | 51 virtual void AddObserver(int render_process_id, |
50 int render_frame_id, | 52 int render_frame_id, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 // |success_cb|: Invoked with session info, if presentation session joined | 124 // |success_cb|: Invoked with session info, if presentation session joined |
123 // successfully. | 125 // successfully. |
124 // |error_cb|: Invoked with error reason, if joining failed. | 126 // |error_cb|: Invoked with error reason, if joining failed. |
125 virtual void JoinSession( | 127 virtual void JoinSession( |
126 int render_process_id, | 128 int render_process_id, |
127 int render_frame_id, | 129 int render_frame_id, |
128 const std::string& presentation_url, | 130 const std::string& presentation_url, |
129 const std::string& presentation_id, | 131 const std::string& presentation_id, |
130 const PresentationSessionSuccessCallback& success_cb, | 132 const PresentationSessionSuccessCallback& success_cb, |
131 const PresentationSessionErrorCallback& error_cb) = 0; | 133 const PresentationSessionErrorCallback& error_cb) = 0; |
134 | |
135 // Sends a message (string or binary data) to a presentation session. | |
136 // |render_process_id|, |render_frame_id|: ID of originating frame. | |
137 // |message_request|: Contains Presentation URL, ID and message to be sent | |
138 // and delegate is responsible for deallocating the message_request. | |
imcheng (use chromium acct)
2015/04/30 20:11:30
Please also document |send_message_cb|.
USE s.singapati at gmail.com
2015/05/04 16:40:28
Done.
| |
139 virtual void SendMessage( | |
140 int render_process_id, | |
141 int render_frame_id, | |
142 PresentationMessageRequest* message_request, | |
imcheng (use chromium acct)
2015/04/30 20:11:30
Can this be a scoped_ptr so it's less error prone
USE s.singapati at gmail.com
2015/05/01 10:30:25
Ok, I will check this one.
USE s.singapati at gmail.com
2015/05/04 16:40:28
sending scoped_ptr to delegate is fine. But mockin
USE s.singapati at gmail.com
2015/05/05 14:26:36
Done.
| |
143 const SendMessageCallback& send_message_cb) = 0; | |
132 }; | 144 }; |
133 | 145 |
134 } // namespace content | 146 } // namespace content |
135 | 147 |
136 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 148 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |