OLD | NEW |
---|---|
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 <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "chrome/browser/media/router/media_router.h" | 17 #include "chrome/browser/media/router/media_router.h" |
18 #include "chrome/browser/media/router/media_source.h" | 18 #include "chrome/browser/media/router/media_source.h" |
19 #include "chrome/browser/media/router/render_frame_host_helper.h" | |
19 #include "content/public/browser/presentation_service_delegate.h" | 20 #include "content/public/browser/presentation_service_delegate.h" |
20 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
21 #include "content/public/browser/web_contents_user_data.h" | 22 #include "content/public/browser/web_contents_user_data.h" |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 class RenderFrameHost; | 25 class RenderFrameHost; |
25 class PresentationScreenAvailabilityListener; | 26 class PresentationScreenAvailabilityListener; |
26 class WebContents; | 27 class WebContents; |
27 struct PresentationSessionInfo; | 28 struct PresentationSessionInfo; |
28 struct PresentationSessionMessage; | 29 struct PresentationSessionMessage; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 const PresentationSessionSuccessCallback& success_cb, | 87 const PresentationSessionSuccessCallback& success_cb, |
87 const PresentationSessionErrorCallback& error_cb) override; | 88 const PresentationSessionErrorCallback& error_cb) override; |
88 void CloseSession(int render_process_id, | 89 void CloseSession(int render_process_id, |
89 int render_frame_id, | 90 int render_frame_id, |
90 const std::string& presentation_id) override; | 91 const std::string& presentation_id) override; |
91 void ListenForSessionMessages( | 92 void ListenForSessionMessages( |
92 int render_process_id, | 93 int render_process_id, |
93 int render_frame_id, | 94 int render_frame_id, |
94 const content::PresentationSessionInfo& session, | 95 const content::PresentationSessionInfo& session, |
95 const content::PresentationSessionMessageCallback& message_cb) override; | 96 const content::PresentationSessionMessageCallback& message_cb) override; |
96 void SendMessage(int render_process_id, | 97 void SendMessage( |
97 int render_frame_id, | 98 int render_process_id, |
98 const content::PresentationSessionInfo& session, | 99 int render_frame_id, |
99 scoped_ptr<content::PresentationSessionMessage> message, | 100 const content::PresentationSessionInfo& session, |
100 const SendMessageCallback& send_message_cb) override; | 101 scoped_ptr<content::PresentationSessionMessage> message, |
102 const content::SendMessageCallback& send_message_cb) override; | |
101 bool ListenForSessionStateChange( | 103 bool ListenForSessionStateChange( |
102 int render_process_id, | 104 int render_process_id, |
103 int render_frame_id, | 105 int render_frame_id, |
104 content::PresentationSessionStateListener* listener) override; | 106 content::PresentationSessionStateListener* listener) override; |
107 void GetPresentationReceiverSession( | |
mark a. foltz
2015/10/01 06:25:28
Do we need both this and the GetSessions method be
imcheng
2015/10/06 00:59:15
I added comments in presentation_service_delegate.
| |
108 int render_process_id, | |
109 int render_frame_id, | |
110 const content::PresentationReceiverSessionAvailableCallback& callback) | |
111 override; | |
112 std::vector<content::PresentationSessionInfo> GetPresentationReceiverSessions( | |
113 int render_process_id, | |
114 int render_frame_id) override; | |
105 | 115 |
106 // Callback invoked when there is a route response from CreateRoute/JoinRoute | 116 // Callback invoked when there is a route response from CreateRoute/JoinRoute |
107 // outside of a Presentation API request. This could be due to | 117 // outside of a Presentation API request. This could be due to |
108 // browser action (e.g., browser initiated media router dialog) or | 118 // browser action (e.g., browser initiated media router dialog) or |
109 // a media route provider (e.g., autojoin). | 119 // a media route provider (e.g., autojoin). |
110 void OnRouteResponse(const MediaRoute* route, | 120 void OnRouteResponse(const MediaRoute* route, |
111 const std::string& presentation_id, | 121 const std::string& presentation_id, |
112 const std::string& error); | 122 const std::string& error); |
113 | 123 |
114 // Returns the default MediaSource for this tab if there is one. | 124 // Returns the default MediaSource for this tab if there is one. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 const PresentationSessionErrorCallback& error_cb, | 176 const PresentationSessionErrorCallback& error_cb, |
167 const MediaRoute* route, | 177 const MediaRoute* route, |
168 const std::string& presentation_id, | 178 const std::string& presentation_id, |
169 const std::string& error_text); | 179 const std::string& error_text); |
170 | 180 |
171 void OnStartSessionSucceeded( | 181 void OnStartSessionSucceeded( |
172 int render_process_id, | 182 int render_process_id, |
173 int render_frame_id, | 183 int render_frame_id, |
174 const PresentationSessionSuccessCallback& success_cb, | 184 const PresentationSessionSuccessCallback& success_cb, |
175 const content::PresentationSessionInfo& new_session, | 185 const content::PresentationSessionInfo& new_session, |
176 const MediaRoute::Id& route_id); | 186 const MediaRoute& route); |
177 | 187 |
178 // Returns |true| if the frame is the main frame of |web_contents_|. | 188 // Returns |true| if the frame is the main frame of |web_contents_|. |
179 bool IsMainFrame(int render_process_id, int render_frame_id) const; | 189 bool IsMainFrame(int render_process_id, int render_frame_id) const; |
180 | 190 |
181 // Updates tab-level default MediaSource and/or default frame URL. If either | 191 // Updates tab-level default MediaSource and/or default frame URL. If either |
182 // changed, notify the observers. | 192 // changed, notify the observers. |
183 void UpdateDefaultMediaSourceAndNotifyObservers( | 193 void UpdateDefaultMediaSourceAndNotifyObservers( |
184 const MediaSource& new_default_source, | 194 const MediaSource& new_default_source, |
185 const GURL& new_default_frame_url); | 195 const GURL& new_default_frame_url); |
186 | 196 |
187 // Default MediaSource for the tab associated with this instance. | 197 // Default MediaSource for the tab associated with this instance. |
188 MediaSource default_source_; | 198 MediaSource default_source_; |
189 // URL of the frame that contains the default MediaSource. | 199 // URL of the frame that contains the default MediaSource. |
190 GURL default_frame_url_; | 200 GURL default_frame_url_; |
191 | 201 |
192 // References to the observers listening for changes to default media source. | 202 // References to the observers listening for changes to default media source. |
193 base::ObserverList< | 203 base::ObserverList< |
194 DefaultMediaSourceObserver> default_media_source_observers_; | 204 DefaultMediaSourceObserver> default_media_source_observers_; |
195 | 205 |
196 // References to the WebContents that owns this instance, and associated | 206 // References to the WebContents that owns this instance, and associated |
197 // browser profile's MediaRouter instance. | 207 // browser profile's MediaRouter instance. |
198 content::WebContents* web_contents_; | 208 content::WebContents* const web_contents_; |
199 MediaRouter* router_; | 209 MediaRouter* router_; |
200 | 210 |
201 scoped_ptr<PresentationFrameManager> frame_manager_; | 211 scoped_ptr<PresentationFrameManager> frame_manager_; |
202 | 212 |
203 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; | 213 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; |
204 | 214 |
205 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); | 215 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); |
206 }; | 216 }; |
207 | 217 |
208 } // namespace media_router | 218 } // namespace media_router |
209 | 219 |
210 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ | 220 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ |
OLD | NEW |