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

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: rebase Created 4 years, 6 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 <memory> 10 #include <memory>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 90 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
91 ListenForConnectionStateChange); 91 ListenForConnectionStateChange);
92 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 92 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
93 ListenForConnectionClose); 93 ListenForConnectionClose);
94 94
95 // Maximum number of pending JoinSession requests at any given time. 95 // Maximum number of pending JoinSession requests at any given time.
96 static const int kMaxNumQueuedSessionRequests = 10; 96 static const int kMaxNumQueuedSessionRequests = 10;
97 97
98 using PresentationSessionMojoCallback = 98 using PresentationSessionMojoCallback =
99 mojo::Callback<void(blink::mojom::PresentationSessionInfoPtr)>; 99 mojo::Callback<void(blink::mojom::PresentationSessionInfoPtr)>;
100 using PresentationConnectionListMojoCallback = mojo::Callback<void(
101 mojo::Array<blink::mojom::PresentationSessionInfoPtr>)>;
100 using SessionMessagesCallback = 102 using SessionMessagesCallback =
101 mojo::Callback<void(mojo::Array<blink::mojom::SessionMessagePtr>)>; 103 mojo::Callback<void(mojo::Array<blink::mojom::SessionMessagePtr>)>;
102 using SendMessageMojoCallback = mojo::Callback<void(bool)>; 104 using SendMessageMojoCallback = mojo::Callback<void(bool)>;
103 105
104 // Listener implementation owned by PresentationServiceImpl. An instance of 106 // Listener implementation owned by PresentationServiceImpl. An instance of
105 // this is created when PresentationRequest.getAvailability() is resolved. 107 // this is created when PresentationRequest.getAvailability() is resolved.
106 // The instance receives screen availability results from the embedder and 108 // The instance receives screen availability results from the embedder and
107 // propagates results back to PresentationServiceImpl. 109 // propagates results back to PresentationServiceImpl.
108 class CONTENT_EXPORT ScreenAvailabilityListenerImpl 110 class CONTENT_EXPORT ScreenAvailabilityListenerImpl
109 : public PresentationScreenAvailabilityListener { 111 : public PresentationScreenAvailabilityListener {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const NewSessionMojoCallback& callback) override; 165 const NewSessionMojoCallback& callback) override;
164 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, 166 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info,
165 blink::mojom::SessionMessagePtr session_message, 167 blink::mojom::SessionMessagePtr session_message,
166 const SendMessageMojoCallback& callback) override; 168 const SendMessageMojoCallback& callback) override;
167 void CloseConnection(const mojo::String& presentation_url, 169 void CloseConnection(const mojo::String& presentation_url,
168 const mojo::String& presentation_id) override; 170 const mojo::String& presentation_id) override;
169 void Terminate(const mojo::String& presentation_url, 171 void Terminate(const mojo::String& presentation_url,
170 const mojo::String& presentation_id) override; 172 const mojo::String& presentation_id) override;
171 void ListenForSessionMessages( 173 void ListenForSessionMessages(
172 blink::mojom::PresentationSessionInfoPtr session) override; 174 blink::mojom::PresentationSessionInfoPtr session) override;
175 void GetReceiverConnections(
176 const PresentationConnectionListMojoCallback& callback) override;
173 177
174 // Creates a binding between this object and |request|. 178 // Creates a binding between this object and |request|.
175 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); 179 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request);
176 180
177 // WebContentsObserver override. 181 // WebContentsObserver override.
178 void DidNavigateAnyFrame( 182 void DidNavigateAnyFrame(
179 content::RenderFrameHost* render_frame_host, 183 content::RenderFrameHost* render_frame_host,
180 const content::LoadCommittedDetails& details, 184 const content::LoadCommittedDetails& details,
181 const content::FrameNavigateParams& params) override; 185 const content::FrameNavigateParams& params) override;
182 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; 186 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
(...skipping 30 matching lines...) Expand all
213 void OnStartSessionError( 217 void OnStartSessionError(
214 int request_session_id, 218 int request_session_id,
215 const PresentationError& error); 219 const PresentationError& error);
216 void OnJoinSessionSucceeded( 220 void OnJoinSessionSucceeded(
217 int request_session_id, 221 int request_session_id,
218 const PresentationSessionInfo& session_info); 222 const PresentationSessionInfo& session_info);
219 void OnJoinSessionError( 223 void OnJoinSessionError(
220 int request_session_id, 224 int request_session_id,
221 const PresentationError& error); 225 const PresentationError& error);
222 void OnSendMessageCallback(bool sent); 226 void OnSendMessageCallback(bool sent);
227 void OnReceiverConnectionAvailable(
228 const content::PresentationSessionInfo& session_info);
223 229
224 // Calls to |delegate_| to start listening for state changes for |connection|. 230 // Calls to |delegate_| to start listening for state changes for |connection|.
225 // State changes will be returned via |OnConnectionStateChanged|. 231 // State changes will be returned via |OnConnectionStateChanged|.
226 void ListenForConnectionStateChange( 232 void ListenForConnectionStateChange(
227 const PresentationSessionInfo& connection); 233 const PresentationSessionInfo& connection);
228 234
229 // Passed to embedder's implementation of PresentationServiceDelegate for 235 // Passed to embedder's implementation of PresentationServiceDelegate for
230 // later invocation when session messages arrive. 236 // later invocation when session messages arrive.
231 void OnSessionMessages( 237 void OnSessionMessages(
232 const content::PresentationSessionInfo& session, 238 const content::PresentationSessionInfo& session,
(...skipping 17 matching lines...) Expand all
250 // Embedder-specific delegate to forward Presentation requests to. 256 // Embedder-specific delegate to forward Presentation requests to.
251 // May be null if embedder does not support Presentation API. 257 // May be null if embedder does not support Presentation API.
252 PresentationServiceDelegate* delegate_; 258 PresentationServiceDelegate* delegate_;
253 259
254 // Proxy to the PresentationServiceClient to send results (e.g., screen 260 // Proxy to the PresentationServiceClient to send results (e.g., screen
255 // availability) to. 261 // availability) to.
256 blink::mojom::PresentationServiceClientPtr client_; 262 blink::mojom::PresentationServiceClientPtr client_;
257 263
258 std::string default_presentation_url_; 264 std::string default_presentation_url_;
259 265
266 // Maps from a presentation URL to a screen availability listener.
260 using ScreenAvailabilityListenerMap = 267 using ScreenAvailabilityListenerMap =
261 std::map<std::string, std::unique_ptr<ScreenAvailabilityListenerImpl>>; 268 std::map<std::string, std::unique_ptr<ScreenAvailabilityListenerImpl>>;
262 ScreenAvailabilityListenerMap screen_availability_listeners_; 269 ScreenAvailabilityListenerMap screen_availability_listeners_;
263 270
264 // For StartSession requests. 271 // For StartSession requests.
265 // Set to a positive value when a StartSession request is being processed. 272 // Set to a positive value when a StartSession request is being processed.
266 int start_session_request_id_; 273 int start_session_request_id_;
267 std::unique_ptr<NewSessionMojoCallbackWrapper> pending_start_session_cb_; 274 std::unique_ptr<NewSessionMojoCallbackWrapper> pending_start_session_cb_;
268 275
269 // For JoinSession requests. 276 // For JoinSession requests.
(...skipping 15 matching lines...) Expand all
285 292
286 // NOTE: Weak pointers must be invalidated before all other member variables. 293 // NOTE: Weak pointers must be invalidated before all other member variables.
287 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; 294 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_;
288 295
289 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); 296 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl);
290 }; 297 };
291 298
292 } // namespace content 299 } // namespace content
293 300
294 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 301 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | content/browser/presentation/presentation_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698