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

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 Derek 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>
(...skipping 17 matching lines...) Expand all
28 class PresentationScreenAvailabilityListener; 28 class PresentationScreenAvailabilityListener;
29 class WebContents; 29 class WebContents;
30 struct PresentationSessionInfo; 30 struct PresentationSessionInfo;
31 struct PresentationSessionMessage; 31 struct PresentationSessionMessage;
32 } // namespace content 32 } // namespace content
33 33
34 namespace media_router { 34 namespace media_router {
35 35
36 class MediaRoute; 36 class MediaRoute;
37 class MediaSinksObserver; 37 class MediaSinksObserver;
38 class OffscreenPresentationManager;
38 class PresentationFrameManager; 39 class PresentationFrameManager;
39 class RouteRequestResult; 40 class RouteRequestResult;
40 41
41 // Implementation of PresentationServiceDelegate that interfaces an instance of 42 // Implementation of PresentationServiceDelegate that interfaces an instance of
42 // WebContents with the Chrome Media Router. It uses the Media Router to handle 43 // WebContents with the Chrome Media Router. It uses the Media Router to handle
43 // presentation API calls forwarded from PresentationServiceImpl. In addition, 44 // presentation API calls forwarded from PresentationServiceImpl. In addition,
44 // it also provides default presentation URL that is required for creating 45 // it also provides default presentation URL that is required for creating
45 // browser-initiated sessions. It is scoped to the lifetime of a WebContents, 46 // browser-initiated sessions. It is scoped to the lifetime of a WebContents,
46 // and is managed by the associated WebContents. 47 // and is managed by the associated WebContents.
47 class PresentationServiceDelegateImpl 48 class PresentationServiceDelegateImpl
48 : public content::WebContentsUserData<PresentationServiceDelegateImpl>, 49 : public content::WebContentsUserData<PresentationServiceDelegateImpl>,
49 public content::PresentationServiceDelegate { 50 public content::ControllerPresentationServiceDelegate {
50 public: 51 public:
51 // Observer interface for listening to default presentation request 52 // Observer interface for listening to default presentation request
52 // changes for the WebContents. 53 // changes for the WebContents.
53 class DefaultPresentationRequestObserver { 54 class DefaultPresentationRequestObserver {
54 public: 55 public:
55 virtual ~DefaultPresentationRequestObserver() = default; 56 virtual ~DefaultPresentationRequestObserver() = default;
56 57
57 // Called when default presentation request for the corresponding 58 // Called when default presentation request for the corresponding
58 // WebContents is set or changed. 59 // WebContents is set or changed.
59 // |default_presentation_info|: New default presentation request. 60 // |default_presentation_info|: New default presentation request.
60 virtual void OnDefaultPresentationChanged( 61 virtual void OnDefaultPresentationChanged(
61 const PresentationRequest& default_presentation_request) = 0; 62 const PresentationRequest& default_presentation_request) = 0;
62 63
63 // Called when default presentation request for the corresponding 64 // Called when default presentation request for the corresponding
64 // WebContents has been removed. 65 // WebContents has been removed.
65 virtual void OnDefaultPresentationRemoved() = 0; 66 virtual void OnDefaultPresentationRemoved() = 0;
66 }; 67 };
67 68
68 // Retrieves the instance of PresentationServiceDelegateImpl that was attached 69 // Retrieves the instance of PresentationServiceDelegateImpl that was attached
69 // to the specified WebContents. If no instance was attached, creates one, 70 // to the specified WebContents. If no instance was attached, creates one,
70 // and attaches it to the specified WebContents. 71 // and attaches it to the specified WebContents.
71 static PresentationServiceDelegateImpl* GetOrCreateForWebContents( 72 static PresentationServiceDelegateImpl* GetOrCreateForWebContents(
72 content::WebContents* web_contents); 73 content::WebContents* web_contents);
73 74
74 ~PresentationServiceDelegateImpl() override; 75 ~PresentationServiceDelegateImpl() override;
75 76
76 // content::PresentationServiceDelegate implementation.
77 void AddObserver(
78 int render_process_id,
79 int render_frame_id,
80 content::PresentationServiceDelegate::Observer* observer) override;
81 void RemoveObserver(int render_process_id, int render_frame_id) override;
82 bool AddScreenAvailabilityListener( 77 bool AddScreenAvailabilityListener(
83 int render_process_id, 78 int render_process_id,
84 int render_frame_id, 79 int render_frame_id,
85 content::PresentationScreenAvailabilityListener* listener) override; 80 content::PresentationScreenAvailabilityListener* listener) override;
86 void RemoveScreenAvailabilityListener( 81 void RemoveScreenAvailabilityListener(
87 int render_process_id, 82 int render_process_id,
88 int render_frame_id, 83 int render_frame_id,
89 content::PresentationScreenAvailabilityListener* listener) override; 84 content::PresentationScreenAvailabilityListener* listener) override;
90 void Reset(int render_process_id, int render_frame_id) override; 85 void Reset(int render_process_id, int render_frame_id) override;
91 void SetDefaultPresentationUrls( 86 void SetDefaultPresentationUrls(
(...skipping 29 matching lines...) Expand all
121 int render_frame_id, 116 int render_frame_id,
122 const content::PresentationSessionInfo& session, 117 const content::PresentationSessionInfo& session,
123 std::unique_ptr<content::PresentationSessionMessage> message, 118 std::unique_ptr<content::PresentationSessionMessage> message,
124 const SendMessageCallback& send_message_cb) override; 119 const SendMessageCallback& send_message_cb) override;
125 void ListenForConnectionStateChange( 120 void ListenForConnectionStateChange(
126 int render_process_id, 121 int render_process_id,
127 int render_frame_id, 122 int render_frame_id,
128 const content::PresentationSessionInfo& connection, 123 const content::PresentationSessionInfo& connection,
129 const content::PresentationConnectionStateChangedCallback& 124 const content::PresentationConnectionStateChangedCallback&
130 state_changed_cb) override; 125 state_changed_cb) override;
126 void ConnectToOffscreenPresentation(
127 int render_process_id,
128 int render_frame_id,
129 const content::PresentationSessionInfo& session,
130 content::PresentationConnectionPtr connection) override;
131 131
132 // Callback invoked when a default PresentationRequest is started from a 132 // Callback invoked when a default PresentationRequest is started from a
133 // browser-initiated dialog. 133 // browser-initiated dialog.
134 void OnRouteResponse(const PresentationRequest& request, 134 void OnRouteResponse(const PresentationRequest& request,
135 const RouteRequestResult& result); 135 const RouteRequestResult& result);
136 136
137 // Adds / removes an observer for listening to default PresentationRequest 137 // Adds / removes an observer for listening to default PresentationRequest
138 // changes. This class does not own |observer|. When |observer| is about to 138 // changes. This class does not own |observer|. When |observer| is about to
139 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called. 139 // be destroyed, |RemoveDefaultPresentationRequestObserver| must be called.
140 void AddDefaultPresentationRequestObserver( 140 void AddDefaultPresentationRequestObserver(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 std::unique_ptr<PresentationFrameManager> frame_manager_; 204 std::unique_ptr<PresentationFrameManager> frame_manager_;
205 205
206 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; 206 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_;
207 207
208 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); 208 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl);
209 }; 209 };
210 210
211 } // namespace media_router 211 } // namespace media_router
212 212
213 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 213 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698