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

Side by Side Diff: content/browser/presentation/presentation_service_impl.h

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 static const int kMaxNumQueuedSessionRequests = 10; 95 static const int kMaxNumQueuedSessionRequests = 10;
96 96
97 using DefaultSessionMojoCallback = 97 using DefaultSessionMojoCallback =
98 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; 98 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>;
99 using SessionStateCallback = 99 using SessionStateCallback =
100 mojo::Callback<void(presentation::PresentationSessionInfoPtr, 100 mojo::Callback<void(presentation::PresentationSessionInfoPtr,
101 presentation::PresentationSessionState)>; 101 presentation::PresentationSessionState)>;
102 using SessionMessagesCallback = 102 using SessionMessagesCallback =
103 mojo::Callback<void(mojo::Array<presentation::SessionMessagePtr>)>; 103 mojo::Callback<void(mojo::Array<presentation::SessionMessagePtr>)>;
104 using SendMessageMojoCallback = mojo::Callback<void(bool)>; 104 using SendMessageMojoCallback = mojo::Callback<void(bool)>;
105 using GetPresenterSessionMojoCallback =
106 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>;
105 107
106 // Listener implementation owned by PresentationServiceImpl. An instance of 108 // Listener implementation owned by PresentationServiceImpl. An instance of
107 // this is created when PresentationRequest.getAvailability() is resolved. 109 // this is created when PresentationRequest.getAvailability() is resolved.
108 // The instance receives screen availability results from the embedder and 110 // The instance receives screen availability results from the embedder and
109 // propagates results back to PresentationServiceImpl. 111 // propagates results back to PresentationServiceImpl.
110 class CONTENT_EXPORT ScreenAvailabilityListenerImpl 112 class CONTENT_EXPORT ScreenAvailabilityListenerImpl
111 : public PresentationScreenAvailabilityListener { 113 : public PresentationScreenAvailabilityListener {
112 public: 114 public:
113 ScreenAvailabilityListenerImpl( 115 ScreenAvailabilityListenerImpl(
114 const std::string& availability_url, 116 const std::string& availability_url,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const NewSessionMojoCallback& callback) override; 189 const NewSessionMojoCallback& callback) override;
188 void SendSessionMessage(presentation::PresentationSessionInfoPtr session_info, 190 void SendSessionMessage(presentation::PresentationSessionInfoPtr session_info,
189 presentation::SessionMessagePtr session_message, 191 presentation::SessionMessagePtr session_message,
190 const SendMessageMojoCallback& callback) override; 192 const SendMessageMojoCallback& callback) override;
191 void CloseSession( 193 void CloseSession(
192 const mojo::String& presentation_url, 194 const mojo::String& presentation_url,
193 const mojo::String& presentation_id) override; 195 const mojo::String& presentation_id) override;
194 void ListenForSessionStateChange() override; 196 void ListenForSessionStateChange() override;
195 void ListenForSessionMessages( 197 void ListenForSessionMessages(
196 presentation::PresentationSessionInfoPtr session) override; 198 presentation::PresentationSessionInfoPtr session) override;
199 void GetPresenterSession(
200 const GetPresenterSessionMojoCallback& callback) override;
197 201
198 // Creates a binding between this object and |request|. 202 // Creates a binding between this object and |request|.
199 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); 203 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request);
200 204
201 // WebContentsObserver override. 205 // WebContentsObserver override.
202 void DidNavigateAnyFrame( 206 void DidNavigateAnyFrame(
203 content::RenderFrameHost* render_frame_host, 207 content::RenderFrameHost* render_frame_host,
204 const content::LoadCommittedDetails& details, 208 const content::LoadCommittedDetails& details,
205 const content::FrameNavigateParams& params) override; 209 const content::FrameNavigateParams& params) override;
206 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; 210 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
(...skipping 25 matching lines...) Expand all
232 void OnStartSessionError( 236 void OnStartSessionError(
233 int request_session_id, 237 int request_session_id,
234 const PresentationError& error); 238 const PresentationError& error);
235 void OnJoinSessionSucceeded( 239 void OnJoinSessionSucceeded(
236 int request_session_id, 240 int request_session_id,
237 const PresentationSessionInfo& session_info); 241 const PresentationSessionInfo& session_info);
238 void OnJoinSessionError( 242 void OnJoinSessionError(
239 int request_session_id, 243 int request_session_id,
240 const PresentationError& error); 244 const PresentationError& error);
241 void OnSendMessageCallback(bool sent); 245 void OnSendMessageCallback(bool sent);
246 void OnGetPresenterSessionSuccess(
247 const content::PresentationSessionInfo& session_info);
248 void OnGetPresenterSessionError(const std::string& error);
242 249
243 // Passed to embedder's implementation of PresentationServiceDelegate for 250 // Passed to embedder's implementation of PresentationServiceDelegate for
244 // later invocation when session messages arrive. 251 // later invocation when session messages arrive.
245 void OnSessionMessages( 252 void OnSessionMessages(
246 const content::PresentationSessionInfo& session, 253 const content::PresentationSessionInfo& session,
247 const ScopedVector<PresentationSessionMessage>& messages, 254 const ScopedVector<PresentationSessionMessage>& messages,
248 bool pass_ownership); 255 bool pass_ownership);
249 256
250 // Associates a JoinSession |callback| with a unique request ID and 257 // Associates a JoinSession |callback| with a unique request ID and
251 // stores it in a map. 258 // stores it in a map.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 294
288 // RAII binding of |this| to an Presentation interface request. 295 // RAII binding of |this| to an Presentation interface request.
289 // The binding is removed when binding_ is cleared or goes out of scope. 296 // The binding is removed when binding_ is cleared or goes out of scope.
290 scoped_ptr<mojo::Binding<presentation::PresentationService>> binding_; 297 scoped_ptr<mojo::Binding<presentation::PresentationService>> binding_;
291 298
292 // There can be only one send message request at a time. 299 // There can be only one send message request at a time.
293 scoped_ptr<SendMessageMojoCallback> send_message_callback_; 300 scoped_ptr<SendMessageMojoCallback> send_message_callback_;
294 301
295 scoped_ptr<SessionMessagesCallback> on_session_messages_callback_; 302 scoped_ptr<SessionMessagesCallback> on_session_messages_callback_;
296 303
304 scoped_ptr<GetPresenterSessionMojoCallback> presenter_session_callback_;
305
297 // ID of the RenderFrameHost this object is associated with. 306 // ID of the RenderFrameHost this object is associated with.
298 int render_process_id_; 307 int render_process_id_;
299 int render_frame_id_; 308 int render_frame_id_;
300 309
301 // NOTE: Weak pointers must be invalidated before all other member variables. 310 // NOTE: Weak pointers must be invalidated before all other member variables.
302 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; 311 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_;
303 312
304 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); 313 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl);
305 }; 314 };
306 315
307 } // namespace content 316 } // namespace content
308 317
309 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 318 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698