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

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_impl.h

Issue 2737413003: [Presentation API] Remove references to presentation sessions. (Closed)
Patch Set: Update PresentationServiceDelegateImpl unittest Created 3 years, 9 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 CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "chrome/browser/media/router/media_router.h" 18 #include "chrome/browser/media/router/media_router.h"
19 #include "chrome/browser/media/router/media_source.h" 19 #include "chrome/browser/media/router/media_source.h"
20 #include "chrome/browser/media/router/presentation_request.h" 20 #include "chrome/browser/media/router/presentation_request.h"
21 #include "chrome/browser/media/router/presentation_service_delegate_observers.h" 21 #include "chrome/browser/media/router/presentation_service_delegate_observers.h"
22 #include "chrome/browser/media/router/render_frame_host_id.h" 22 #include "chrome/browser/media/router/render_frame_host_id.h"
23 #include "content/public/browser/presentation_service_delegate.h" 23 #include "content/public/browser/presentation_service_delegate.h"
24 #include "content/public/browser/web_contents_observer.h" 24 #include "content/public/browser/web_contents_observer.h"
25 #include "content/public/browser/web_contents_user_data.h" 25 #include "content/public/browser/web_contents_user_data.h"
26 26
27 namespace content { 27 namespace content {
28 class PresentationScreenAvailabilityListener; 28 class PresentationScreenAvailabilityListener;
29 class WebContents; 29 class WebContents;
30 struct PresentationSessionInfo;
31 struct PresentationConnectionMessage; 30 struct PresentationConnectionMessage;
31 struct PresentationInfo;
32 } // namespace content 32 } // namespace content
33 33
34 namespace url { 34 namespace url {
35 class Origin; 35 class Origin;
36 } // namespace url 36 } // namespace url
37 37
38 namespace media_router { 38 namespace media_router {
39 39
40 class MediaRoute; 40 class MediaRoute;
41 class PresentationFrameManager; 41 class PresentationFrameManager;
42 class RouteRequestResult; 42 class RouteRequestResult;
43 43
44 // Implementation of PresentationServiceDelegate that interfaces an instance of 44 // Implementation of PresentationServiceDelegate that interfaces an instance of
45 // WebContents with the Chrome Media Router. It uses the Media Router to handle 45 // WebContents with the Chrome Media Router. It uses the Media Router to handle
46 // presentation API calls forwarded from PresentationServiceImpl. In addition, 46 // presentation API calls forwarded from PresentationServiceImpl. In addition,
47 // it also provides default presentation URL that is required for creating 47 // it also provides default presentation URL that is required for creating
48 // browser-initiated sessions. It is scoped to the lifetime of a WebContents, 48 // browser-initiated presentations. It is scoped to the lifetime of a
49 // and is managed by the associated WebContents. 49 // WebContents, and is managed by the associated WebContents.
50 class PresentationServiceDelegateImpl 50 class PresentationServiceDelegateImpl
51 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, 51 : public content::WebContentsUserData<PresentationServiceDelegateImpl>,
52 public content::ControllerPresentationServiceDelegate { 52 public content::ControllerPresentationServiceDelegate {
53 public: 53 public:
54 // Observer interface for listening to default presentation request 54 // Observer interface for listening to default presentation request
55 // changes for the WebContents. 55 // changes for the WebContents.
56 class DefaultPresentationRequestObserver { 56 class DefaultPresentationRequestObserver {
57 public: 57 public:
58 virtual ~DefaultPresentationRequestObserver() = default; 58 virtual ~DefaultPresentationRequestObserver() = default;
59 59
(...skipping 28 matching lines...) Expand all
88 content::PresentationScreenAvailabilityListener* listener) override; 88 content::PresentationScreenAvailabilityListener* listener) override;
89 void RemoveScreenAvailabilityListener( 89 void RemoveScreenAvailabilityListener(
90 int render_process_id, 90 int render_process_id,
91 int render_frame_id, 91 int render_frame_id,
92 content::PresentationScreenAvailabilityListener* listener) override; 92 content::PresentationScreenAvailabilityListener* listener) override;
93 void Reset(int render_process_id, int render_frame_id) override; 93 void Reset(int render_process_id, int render_frame_id) override;
94 void SetDefaultPresentationUrls( 94 void SetDefaultPresentationUrls(
95 int render_process_id, 95 int render_process_id,
96 int render_frame_id, 96 int render_frame_id,
97 const std::vector<GURL>& default_presentation_urls, 97 const std::vector<GURL>& default_presentation_urls,
98 const content::PresentationSessionStartedCallback& callback) override; 98 const content::PresentationConnectionCallback& callback) override;
99 void StartSession( 99 void StartPresentation(
100 int render_process_id, 100 int render_process_id,
101 int render_frame_id, 101 int render_frame_id,
102 const std::vector<GURL>& presentation_urls, 102 const std::vector<GURL>& presentation_urls,
103 const content::PresentationSessionStartedCallback& success_cb, 103 const content::PresentationConnectionCallback& success_cb,
104 const content::PresentationSessionErrorCallback& error_cb) override; 104 const content::PresentationConnectionErrorCallback& error_cb) override;
105 void JoinSession( 105 void ReconnectPresentation(
106 int render_process_id, 106 int render_process_id,
107 int render_frame_id, 107 int render_frame_id,
108 const std::vector<GURL>& presentation_urls, 108 const std::vector<GURL>& presentation_urls,
109 const std::string& presentation_id, 109 const std::string& presentation_id,
110 const content::PresentationSessionStartedCallback& success_cb, 110 const content::PresentationConnectionCallback& success_cb,
111 const content::PresentationSessionErrorCallback& error_cb) override; 111 const content::PresentationConnectionErrorCallback& error_cb) override;
112 void CloseConnection(int render_process_id, 112 void CloseConnection(int render_process_id,
113 int render_frame_id, 113 int render_frame_id,
114 const std::string& presentation_id) override; 114 const std::string& presentation_id) override;
115 void Terminate(int render_process_id, 115 void Terminate(int render_process_id,
116 int render_frame_id, 116 int render_frame_id,
117 const std::string& presentation_id) override; 117 const std::string& presentation_id) override;
118 void ListenForConnectionMessages( 118 void ListenForConnectionMessages(
119 int render_process_id, 119 int render_process_id,
120 int render_frame_id, 120 int render_frame_id,
121 const content::PresentationSessionInfo& session, 121 const content::PresentationInfo& presentation_info,
122 const content::PresentationConnectionMessageCallback& message_cb) 122 const content::PresentationConnectionMessageCallback& message_cb)
123 override; 123 override;
124 void SendMessage(int render_process_id, 124 void SendMessage(int render_process_id,
125 int render_frame_id, 125 int render_frame_id,
126 const content::PresentationSessionInfo& session, 126 const content::PresentationInfo& presentation_info,
127 content::PresentationConnectionMessage message, 127 content::PresentationConnectionMessage message,
128 const SendMessageCallback& send_message_cb) override; 128 const SendMessageCallback& send_message_cb) override;
129 void ListenForConnectionStateChange( 129 void ListenForConnectionStateChange(
130 int render_process_id, 130 int render_process_id,
131 int render_frame_id, 131 int render_frame_id,
132 const content::PresentationSessionInfo& connection, 132 const content::PresentationInfo& connection,
133 const content::PresentationConnectionStateChangedCallback& 133 const content::PresentationConnectionStateChangedCallback&
134 state_changed_cb) override; 134 state_changed_cb) override;
135 void ConnectToPresentation( 135 void ConnectToPresentation(
136 int render_process_id, 136 int render_process_id,
137 int render_frame_id, 137 int render_frame_id,
138 const content::PresentationSessionInfo& session, 138 const content::PresentationInfo& presentation_info,
139 content::PresentationConnectionPtr controller_connection_ptr, 139 content::PresentationConnectionPtr controller_connection_ptr,
140 content::PresentationConnectionRequest receiver_connection_request) 140 content::PresentationConnectionRequest receiver_connection_request)
141 override; 141 override;
142 142
143 // Callback invoked when a default PresentationRequest is started from a 143 // Callback invoked when a default PresentationRequest is started from a
144 // browser-initiated dialog. 144 // browser-initiated dialog.
145 void OnRouteResponse(const PresentationRequest& request, 145 void OnRouteResponse(const PresentationRequest& request,
146 const RouteRequestResult& result); 146 const RouteRequestResult& result);
147 147
148 // Adds / removes an observer for listening to default PresentationRequest 148 // Adds / removes an observer for listening to default PresentationRequest
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Returns |listener|'s presentation URL as a MediaSource. If |listener| does 193 // Returns |listener|'s presentation URL as a MediaSource. If |listener| does
194 // not have a persentation URL, returns the tab mirroring MediaSource. 194 // not have a persentation URL, returns the tab mirroring MediaSource.
195 MediaSource GetMediaSourceFromListener( 195 MediaSource GetMediaSourceFromListener(
196 content::PresentationScreenAvailabilityListener* listener); 196 content::PresentationScreenAvailabilityListener* listener);
197 197
198 void OnJoinRouteResponse( 198 void OnJoinRouteResponse(
199 int render_process_id, 199 int render_process_id,
200 int render_frame_id, 200 int render_frame_id,
201 const GURL& presentation_url, 201 const GURL& presentation_url,
202 const std::string& presentation_id, 202 const std::string& presentation_id,
203 const content::PresentationSessionStartedCallback& success_cb, 203 const content::PresentationConnectionCallback& success_cb,
204 const content::PresentationSessionErrorCallback& error_cb, 204 const content::PresentationConnectionErrorCallback& error_cb,
205 const RouteRequestResult& result); 205 const RouteRequestResult& result);
206 206
207 void OnStartSessionSucceeded( 207 void OnStartPresentationSucceeded(
208 int render_process_id, 208 int render_process_id,
209 int render_frame_id, 209 int render_frame_id,
210 const content::PresentationSessionStartedCallback& success_cb, 210 const content::PresentationConnectionCallback& success_cb,
211 const content::PresentationSessionInfo& new_session, 211 const content::PresentationInfo& new_presentation_info,
212 const MediaRoute& route); 212 const MediaRoute& route);
213 213
214 #if !defined(OS_ANDROID) 214 #if !defined(OS_ANDROID)
215 // Returns true if auto-join requests should be cancelled for |origin|. 215 // Returns true if auto-join requests should be cancelled for |origin|.
216 bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const; 216 bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const;
217 #endif 217 #endif
218 218
219 // References to the WebContents that owns this instance, and associated 219 // References to the WebContents that owns this instance, and associated
220 // browser profile's MediaRouter instance. 220 // browser profile's MediaRouter instance.
221 content::WebContents* const web_contents_; 221 content::WebContents* const web_contents_;
222 MediaRouter* router_; 222 MediaRouter* router_;
223 223
224 std::unique_ptr<PresentationFrameManager> frame_manager_; 224 std::unique_ptr<PresentationFrameManager> frame_manager_;
225 PresentationServiceDelegateObservers observers_; 225 PresentationServiceDelegateObservers observers_;
226 226
227 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; 227 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_;
228 228
229 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); 229 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl);
230 }; 230 };
231 231
232 } // namespace media_router 232 } // namespace media_router
233 233
234 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 234 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698