Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: content/public/browser/presentation_service_delegate.h

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again to pick up Yuri's cl Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/presentation_session.h" 15 #include "content/public/browser/presentation_session.h"
16 #include "content/public/browser/presentation_session_message.h" 16 #include "content/public/browser/presentation_session_message.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 class PresentationScreenAvailabilityListener; 20 class PresentationScreenAvailabilityListener;
21 class PresentationSessionStateListener; 21 class PresentationSessionStateListener;
22 22
23 // Param #0: a vector of messages that are received. 23 // Param #0: a vector of messages that are received.
24 // Param #1: tells the callback handler that it may reuse strings or buffers 24 // Param #1: tells the callback handler that it may reuse strings or buffers
25 // in the messages contained within param #0. 25 // in the messages contained within param #0.
26 using PresentationSessionMessageCallback = base::Callback< 26 using PresentationSessionMessageCallback = base::Callback<
27 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; 27 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>;
28 28
29 using PresentationReceiverSessionAvailableCallback =
30 base::Callback<void(const content::PresentationSessionInfo*)>;
31
32 using SendMessageCallback = base::Callback<void(bool)>;
33
29 // An interface implemented by embedders to handle presentation API calls 34 // An interface implemented by embedders to handle presentation API calls
30 // forwarded from PresentationServiceImpl. 35 // forwarded from PresentationServiceImpl.
31 class CONTENT_EXPORT PresentationServiceDelegate { 36 class CONTENT_EXPORT PresentationServiceDelegate {
32 public: 37 public:
33 // Observer interface to listen for changes to PresentationServiceDelegate. 38 // Observer interface to listen for changes to PresentationServiceDelegate.
34 class CONTENT_EXPORT Observer { 39 class CONTENT_EXPORT Observer {
35 public: 40 public:
36 // Called when the PresentationServiceDelegate is being destroyed. 41 // Called when the PresentationServiceDelegate is being destroyed.
37 virtual void OnDelegateDestroyed() = 0; 42 virtual void OnDelegateDestroyed() = 0;
miu 2015/10/07 21:51:47 nit: The methods in this interface should probably
imcheng 2015/10/10 04:39:44 Ack. we only have 2 implementations of this and th
38 43
39 // Called when the default presentation has been started outside of a 44 // Called when the default presentation has been started outside of a
40 // Presentation API context (e.g., browser action). This will not be called 45 // Presentation API context (e.g., browser action). This will not be called
41 // if the session was created as a result of Presentation API's 46 // if the session was created as a result of Presentation API's
42 // StartSession()/JoinSession(). 47 // StartSession()/JoinSession().
43 virtual void OnDefaultPresentationStarted( 48 virtual void OnDefaultPresentationStarted(
44 const PresentationSessionInfo& session) = 0; 49 const PresentationSessionInfo& session) = 0;
45 50
46 protected: 51 protected:
47 virtual ~Observer() {} 52 virtual ~Observer() {}
48 }; 53 };
49 54
50 using PresentationSessionSuccessCallback = 55 using PresentationSessionSuccessCallback =
51 base::Callback<void(const PresentationSessionInfo&)>; 56 base::Callback<void(const PresentationSessionInfo&)>;
52 using PresentationSessionErrorCallback = 57 using PresentationSessionErrorCallback =
53 base::Callback<void(const PresentationError&)>; 58 base::Callback<void(const PresentationError&)>;
54 using SendMessageCallback = base::Callback<void(bool)>;
55 59
56 virtual ~PresentationServiceDelegate() {} 60 virtual ~PresentationServiceDelegate() {}
57 61
58 // Registers an observer associated with frame with |render_process_id| 62 // Registers an observer associated with frame with |render_process_id|
59 // and |render_frame_id| with this class to listen for updates. 63 // and |render_frame_id| with this class to listen for updates.
60 // This class does not own the observer. 64 // This class does not own the observer.
61 // It is an error to add an observer if there is already an observer for that 65 // It is an error to add an observer if there is already an observer for that
62 // frame. 66 // frame.
63 virtual void AddObserver(int render_process_id, 67 virtual void AddObserver(int render_process_id,
64 int render_frame_id, 68 int render_frame_id,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Continuously listen for presentation session state changes for a session. 176 // Continuously listen for presentation session state changes for a session.
173 // Returns true if |listener| is sucessfully registered. 177 // Returns true if |listener| is sucessfully registered.
174 // |render_process_id|, |render_frame_id|: ID of frame. 178 // |render_process_id|, |render_frame_id|: ID of frame.
175 // |session|: Presentation session to listen for state changes. 179 // |session|: Presentation session to listen for state changes.
176 // |listener|: The listener to be invoked whenever there is a state change. 180 // |listener|: The listener to be invoked whenever there is a state change.
177 // Not owned by this class. 181 // Not owned by this class.
178 virtual bool ListenForSessionStateChange( 182 virtual bool ListenForSessionStateChange(
179 int render_process_id, 183 int render_process_id,
180 int render_frame_id, 184 int render_frame_id,
181 content::PresentationSessionStateListener* listener) = 0; 185 content::PresentationSessionStateListener* listener) = 0;
186
187 // Gets a receiver presentation session for the offscreen presentation hosted
miu 2015/10/07 21:51:47 The wording in this comment was a bit confusing to
imcheng 2015/10/10 04:39:44 Done. If a receiver session never becomes availabl
188 // on the offscreen tab containing this frame, or waits until one is
189 // available.
190 // If there is at least one receiver presentation session, |callback| will
191 // be invoked with one of the sessions immediately.
192 // Otherwise, |callback| will be invoked when a receiver presentation session
193 // becomes available.
194 // If the calling frame is not the main frame of an offscreen tab,
195 // |callback| will be invoked with null.
196 virtual void GetPresentationReceiverSession(
miu 2015/10/07 21:51:47 Consider naming this method something like NotifyW
imcheng 2015/10/10 04:39:44 Renamed per your suggestion. I am not a fan of the
197 int render_process_id,
198 int render_frame_id,
199 const PresentationReceiverSessionAvailableCallback& callback) = 0;
200
201 // Gets all receiver presentation sessions for the offscreen presentation
202 // hosted on the offscreen tab containing this frame.
203 // If the calling frame is not the main frame of an offscreen tab, an empty
204 // vector will be returned.
205 virtual std::vector<content::PresentationSessionInfo>
206 GetPresentationReceiverSessions(int render_process_id,
207 int render_frame_id) = 0;
182 }; 208 };
183 209
184 } // namespace content 210 } // namespace content
185 211
186 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ 212 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698