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

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

Issue 2174693004: [Presentation API] Add support to content/ for multiple URLs per PresentationRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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 <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
15 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
16 #include "base/gtest_prod_util.h" 17 #include "base/gtest_prod_util.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/linked_ptr.h" 19 #include "base/memory/linked_ptr.h"
19 #include "base/memory/scoped_vector.h" 20 #include "base/memory/scoped_vector.h"
20 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
21 #include "base/optional.h" 22 #include "base/optional.h"
22 #include "content/common/content_export.h" 23 #include "content/common/content_export.h"
23 #include "content/public/browser/navigation_details.h" 24 #include "content/public/browser/navigation_details.h"
24 #include "content/public/browser/presentation_screen_availability_listener.h" 25 #include "content/public/browser/presentation_screen_availability_listener.h"
25 #include "content/public/browser/presentation_service_delegate.h" 26 #include "content/public/browser/presentation_service_delegate.h"
26 #include "content/public/browser/web_contents_observer.h" 27 #include "content/public/browser/web_contents_observer.h"
27 #include "content/public/common/frame_navigate_params.h" 28 #include "content/public/common/frame_navigate_params.h"
28 #include "mojo/public/cpp/bindings/binding.h" 29 #include "mojo/public/cpp/bindings/binding.h"
29 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" 30 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h"
31 #include "url/gurl.h"
30 32
31 namespace content { 33 namespace content {
32 34
33 struct FrameNavigateParams; 35 struct FrameNavigateParams;
34 struct LoadCommittedDetails; 36 struct LoadCommittedDetails;
35 struct PresentationSessionMessage; 37 struct PresentationSessionMessage;
36 class RenderFrameHost; 38 class RenderFrameHost;
37 39
38 // Implementation of Mojo PresentationService. 40 // Implementation of Mojo PresentationService.
39 // It handles Presentation API requests coming from Blink / renderer process 41 // It handles Presentation API requests coming from Blink / renderer process
(...skipping 25 matching lines...) Expand all
65 friend class PresentationServiceImplTest; 67 friend class PresentationServiceImplTest;
66 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, Reset); 68 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, Reset);
67 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DidNavigateThisFrame); 69 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DidNavigateThisFrame);
68 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 70 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
69 DidNavigateOtherFrame); 71 DidNavigateOtherFrame);
70 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, ThisRenderFrameDeleted); 72 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, ThisRenderFrameDeleted);
71 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 73 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
72 OtherRenderFrameDeleted); 74 OtherRenderFrameDeleted);
73 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DelegateFails); 75 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, DelegateFails);
74 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 76 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
75 SetDefaultPresentationUrl); 77 SetDefaultPresentationUrls);
76 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 78 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
77 SetSameDefaultPresentationUrl); 79 SetSameDefaultPresentationUrls);
78 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 80 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
79 ClearDefaultPresentationUrl); 81 ClearDefaultPresentationUrls);
80 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 82 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
81 ListenForDefaultSessionStart); 83 ListenForDefaultSessionStart);
82 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 84 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
83 ListenForDefaultSessionStartAfterSet); 85 ListenForDefaultSessionStartAfterSet);
84 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 86 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
85 DefaultSessionStartReset); 87 DefaultSessionStartReset);
86 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 88 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
87 ReceiveSessionMessagesAfterReset); 89 ReceiveSessionMessagesAfterReset);
88 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest, 90 FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
89 MaxPendingStartSessionRequests); 91 MaxPendingStartSessionRequests);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // |render_frame_host|: The RFH this instance is associated with. 145 // |render_frame_host|: The RFH this instance is associated with.
144 // |web_contents|: The WebContents to observe. 146 // |web_contents|: The WebContents to observe.
145 // |delegate|: Where Presentation API requests are delegated to. Not owned 147 // |delegate|: Where Presentation API requests are delegated to. Not owned
146 // by this class. 148 // by this class.
147 PresentationServiceImpl( 149 PresentationServiceImpl(
148 RenderFrameHost* render_frame_host, 150 RenderFrameHost* render_frame_host,
149 WebContents* web_contents, 151 WebContents* web_contents,
150 PresentationServiceDelegate* delegate); 152 PresentationServiceDelegate* delegate);
151 153
152 // PresentationService implementation. 154 // PresentationService implementation.
153 void SetDefaultPresentationURL(const std::string& url) override; 155 void SetDefaultPresentationUrls(
156 const std::vector<GURL>& presentation_urls) override;
154 void SetClient(blink::mojom::PresentationServiceClientPtr client) override; 157 void SetClient(blink::mojom::PresentationServiceClientPtr client) override;
155 void ListenForScreenAvailability(const std::string& url) override; 158 void ListenForScreenAvailability(const GURL& url) override;
156 void StopListeningForScreenAvailability(const std::string& url) override; 159 void StopListeningForScreenAvailability(const GURL& url) override;
157 void StartSession(const std::string& presentation_url, 160 void StartSession(const std::vector<GURL>& presentation_urls,
158 const NewSessionCallback& callback) override; 161 const NewSessionCallback& callback) override;
159 void JoinSession(const std::string& presentation_url, 162 void JoinSession(const std::vector<GURL>& presentation_urls,
160 const base::Optional<std::string>& presentation_id, 163 const base::Optional<std::string>& presentation_id,
161 const NewSessionCallback& callback) override; 164 const NewSessionCallback& callback) override;
162 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, 165 void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info,
163 blink::mojom::SessionMessagePtr session_message, 166 blink::mojom::SessionMessagePtr session_message,
164 const SendSessionMessageCallback& callback) override; 167 const SendSessionMessageCallback& callback) override;
165 void CloseConnection(const std::string& presentation_url, 168 void CloseConnection(const GURL& presentation_url,
166 const std::string& presentation_id) override; 169 const std::string& presentation_id) override;
167 void Terminate(const std::string& presentation_url, 170 void Terminate(const GURL& presentation_url,
168 const std::string& presentation_id) override; 171 const std::string& presentation_id) override;
169 void ListenForSessionMessages( 172 void ListenForSessionMessages(
170 blink::mojom::PresentationSessionInfoPtr session) override; 173 blink::mojom::PresentationSessionInfoPtr session) override;
171 174
172 // Creates a binding between this object and |request|. 175 // Creates a binding between this object and |request|.
173 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request); 176 void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request);
174 177
175 // WebContentsObserver override. 178 // WebContentsObserver override.
176 void DidNavigateAnyFrame( 179 void DidNavigateAnyFrame(
177 content::RenderFrameHost* render_frame_host, 180 content::RenderFrameHost* render_frame_host,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool FrameMatches(content::RenderFrameHost* render_frame_host) const; 249 bool FrameMatches(content::RenderFrameHost* render_frame_host) const;
247 250
248 // Embedder-specific delegate to forward Presentation requests to. 251 // Embedder-specific delegate to forward Presentation requests to.
249 // May be null if embedder does not support Presentation API. 252 // May be null if embedder does not support Presentation API.
250 PresentationServiceDelegate* delegate_; 253 PresentationServiceDelegate* delegate_;
251 254
252 // Proxy to the PresentationServiceClient to send results (e.g., screen 255 // Proxy to the PresentationServiceClient to send results (e.g., screen
253 // availability) to. 256 // availability) to.
254 blink::mojom::PresentationServiceClientPtr client_; 257 blink::mojom::PresentationServiceClientPtr client_;
255 258
256 std::string default_presentation_url_; 259 std::vector<std::string> default_presentation_urls_;
257 260
258 using ScreenAvailabilityListenerMap = 261 using ScreenAvailabilityListenerMap =
259 std::map<std::string, std::unique_ptr<ScreenAvailabilityListenerImpl>>; 262 std::map<std::string, std::unique_ptr<ScreenAvailabilityListenerImpl>>;
260 ScreenAvailabilityListenerMap screen_availability_listeners_; 263 ScreenAvailabilityListenerMap screen_availability_listeners_;
261 264
262 // For StartSession requests. 265 // For StartSession requests.
263 // Set to a positive value when a StartSession request is being processed. 266 // Set to a positive value when a StartSession request is being processed.
264 int start_session_request_id_; 267 int start_session_request_id_;
265 std::unique_ptr<NewSessionCallbackWrapper> pending_start_session_cb_; 268 std::unique_ptr<NewSessionCallbackWrapper> pending_start_session_cb_;
266 269
(...skipping 16 matching lines...) Expand all
283 286
284 // NOTE: Weak pointers must be invalidated before all other member variables. 287 // NOTE: Weak pointers must be invalidated before all other member variables.
285 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; 288 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_;
286 289
287 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); 290 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl);
288 }; 291 };
289 292
290 } // namespace content 293 } // namespace content
291 294
292 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 295 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/presentation/OWNERS ('k') | content/browser/presentation/presentation_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698