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

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

Issue 2477573002: [Presentation API] (3rd) (1-UA) Split PresentationServiceDelegateImpl(PSDImpl) (Closed)
Patch Set: fix windows compile error Created 3 years, 11 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/render_frame_host_id.h" 22 #include "chrome/browser/media/router/render_frame_host_id.h"
22 #include "content/public/browser/presentation_service_delegate.h" 23 #include "content/public/browser/presentation_service_delegate.h"
23 #include "content/public/browser/web_contents_observer.h" 24 #include "content/public/browser/web_contents_observer.h"
24 #include "content/public/browser/web_contents_user_data.h" 25 #include "content/public/browser/web_contents_user_data.h"
25 26
26 namespace content { 27 namespace content {
27 class PresentationScreenAvailabilityListener; 28 class PresentationScreenAvailabilityListener;
28 class WebContents; 29 class WebContents;
29 struct PresentationSessionInfo; 30 struct PresentationSessionInfo;
30 struct PresentationConnectionMessage; 31 struct PresentationConnectionMessage;
(...skipping 10 matching lines...) Expand all
41 class RouteRequestResult; 42 class RouteRequestResult;
42 43
43 // Implementation of PresentationServiceDelegate that interfaces an instance of 44 // Implementation of PresentationServiceDelegate that interfaces an instance of
44 // 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
45 // presentation API calls forwarded from PresentationServiceImpl. In addition, 46 // presentation API calls forwarded from PresentationServiceImpl. In addition,
46 // it also provides default presentation URL that is required for creating 47 // it also provides default presentation URL that is required for creating
47 // browser-initiated sessions. It is scoped to the lifetime of a WebContents, 48 // browser-initiated sessions. It is scoped to the lifetime of a WebContents,
48 // and is managed by the associated WebContents. 49 // and is managed by the associated WebContents.
49 class PresentationServiceDelegateImpl 50 class PresentationServiceDelegateImpl
50 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, 51 : public content::WebContentsUserData<PresentationServiceDelegateImpl>,
51 public content::PresentationServiceDelegate { 52 public content::ControllerPresentationServiceDelegate {
52 public: 53 public:
53 // Observer interface for listening to default presentation request 54 // Observer interface for listening to default presentation request
54 // changes for the WebContents. 55 // changes for the WebContents.
55 class DefaultPresentationRequestObserver { 56 class DefaultPresentationRequestObserver {
56 public: 57 public:
57 virtual ~DefaultPresentationRequestObserver() = default; 58 virtual ~DefaultPresentationRequestObserver() = default;
58 59
59 // Called when default presentation request for the corresponding 60 // Called when default presentation request for the corresponding
60 // WebContents is set or changed. 61 // WebContents is set or changed.
61 // |default_presentation_info|: New default presentation request. 62 // |default_presentation_info|: New default presentation request.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 int render_frame_id, 126 int render_frame_id,
126 const content::PresentationSessionInfo& session, 127 const content::PresentationSessionInfo& session,
127 std::unique_ptr<content::PresentationConnectionMessage> message, 128 std::unique_ptr<content::PresentationConnectionMessage> message,
128 const SendMessageCallback& send_message_cb) override; 129 const SendMessageCallback& send_message_cb) override;
129 void ListenForConnectionStateChange( 130 void ListenForConnectionStateChange(
130 int render_process_id, 131 int render_process_id,
131 int render_frame_id, 132 int render_frame_id,
132 const content::PresentationSessionInfo& connection, 133 const content::PresentationSessionInfo& connection,
133 const content::PresentationConnectionStateChangedCallback& 134 const content::PresentationConnectionStateChangedCallback&
134 state_changed_cb) override; 135 state_changed_cb) override;
136 void ConnectToOffscreenPresentation(
137 int render_process_id,
138 int render_frame_id,
139 const content::PresentationSessionInfo& session,
140 content::PresentationConnectionPtr controller_connection_ptr,
141 content::PresentationConnectionRequest receiver_connection_request)
142 override;
135 143
136 // Callback invoked when a default PresentationRequest is started from a 144 // Callback invoked when a default PresentationRequest is started from a
137 // browser-initiated dialog. 145 // browser-initiated dialog.
138 void OnRouteResponse(const PresentationRequest& request, 146 void OnRouteResponse(const PresentationRequest& request,
139 const RouteRequestResult& result); 147 const RouteRequestResult& result);
140 148
141 // Adds / removes an observer for listening to default PresentationRequest 149 // Adds / removes an observer for listening to default PresentationRequest
142 // changes. This class does not own |observer|. When |observer| is about to 150 // changes. This class does not own |observer|. When |observer| is about to
143 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. 151 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called.
144 void AddDefaultPresentationRequestObserver( 152 void AddDefaultPresentationRequestObserver(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Returns true if auto-join requests should be cancelled for |origin|. 212 // Returns true if auto-join requests should be cancelled for |origin|.
205 bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const; 213 bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const;
206 #endif 214 #endif
207 215
208 // References to the WebContents that owns this instance, and associated 216 // References to the WebContents that owns this instance, and associated
209 // browser profile's MediaRouter instance. 217 // browser profile's MediaRouter instance.
210 content::WebContents* const web_contents_; 218 content::WebContents* const web_contents_;
211 MediaRouter* router_; 219 MediaRouter* router_;
212 220
213 std::unique_ptr<PresentationFrameManager> frame_manager_; 221 std::unique_ptr<PresentationFrameManager> frame_manager_;
222 PresentationServiceDelegateObservers observers_;
214 223
215 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; 224 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_;
216 225
217 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); 226 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl);
218 }; 227 };
219 228
220 } // namespace media_router 229 } // namespace media_router
221 230
222 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 231 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698