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

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: resolve code review comments from jam Created 4 years 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 PresentationSessionMessage; 31 struct PresentationSessionMessage;
(...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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 int render_frame_id, 124 int render_frame_id,
124 const content::PresentationSessionInfo& session, 125 const content::PresentationSessionInfo& session,
125 std::unique_ptr<content::PresentationSessionMessage> message, 126 std::unique_ptr<content::PresentationSessionMessage> message,
126 const SendMessageCallback& send_message_cb) override; 127 const SendMessageCallback& send_message_cb) override;
127 void ListenForConnectionStateChange( 128 void ListenForConnectionStateChange(
128 int render_process_id, 129 int render_process_id,
129 int render_frame_id, 130 int render_frame_id,
130 const content::PresentationSessionInfo& connection, 131 const content::PresentationSessionInfo& connection,
131 const content::PresentationConnectionStateChangedCallback& 132 const content::PresentationConnectionStateChangedCallback&
132 state_changed_cb) override; 133 state_changed_cb) override;
134 void ConnectToOffscreenPresentation(
135 int render_process_id,
136 int render_frame_id,
137 const content::PresentationSessionInfo& session,
138 content::PresentationConnectionPtr connection) override;
133 139
134 // Callback invoked when a default PresentationRequest is started from a 140 // Callback invoked when a default PresentationRequest is started from a
135 // browser-initiated dialog. 141 // browser-initiated dialog.
136 void OnRouteResponse(const PresentationRequest& request, 142 void OnRouteResponse(const PresentationRequest& request,
137 const RouteRequestResult& result); 143 const RouteRequestResult& result);
138 144
139 // Adds / removes an observer for listening to default PresentationRequest 145 // Adds / removes an observer for listening to default PresentationRequest
140 // changes. This class does not own |observer|. When |observer| is about to 146 // changes. This class does not own |observer|. When |observer| is about to
141 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. 147 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called.
142 void AddDefaultPresentationRequestObserver( 148 void AddDefaultPresentationRequestObserver(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // Returns true if auto-join requests should be cancelled for |origin|. 208 // Returns true if auto-join requests should be cancelled for |origin|.
203 bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const; 209 bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const;
204 #endif 210 #endif
205 211
206 // References to the WebContents that owns this instance, and associated 212 // References to the WebContents that owns this instance, and associated
207 // browser profile's MediaRouter instance. 213 // browser profile's MediaRouter instance.
208 content::WebContents* const web_contents_; 214 content::WebContents* const web_contents_;
209 MediaRouter* router_; 215 MediaRouter* router_;
210 216
211 std::unique_ptr<PresentationFrameManager> frame_manager_; 217 std::unique_ptr<PresentationFrameManager> frame_manager_;
218 PresentationServiceDelegateObservers observers_;
212 219
213 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; 220 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_;
214 221
215 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); 222 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl);
216 }; 223 };
217 224
218 } // namespace media_router 225 } // namespace media_router
219 226
220 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 227 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698