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

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

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again to pick up Yuri's cl Created 5 years, 2 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 <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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const PresentationSessionSuccessCallback& success_cb, 89 const PresentationSessionSuccessCallback& success_cb,
89 const PresentationSessionErrorCallback& error_cb) override; 90 const PresentationSessionErrorCallback& error_cb) override;
90 void CloseSession(int render_process_id, 91 void CloseSession(int render_process_id,
91 int render_frame_id, 92 int render_frame_id,
92 const std::string& presentation_id) override; 93 const std::string& presentation_id) override;
93 void ListenForSessionMessages( 94 void ListenForSessionMessages(
94 int render_process_id, 95 int render_process_id,
95 int render_frame_id, 96 int render_frame_id,
96 const content::PresentationSessionInfo& session, 97 const content::PresentationSessionInfo& session,
97 const content::PresentationSessionMessageCallback& message_cb) override; 98 const content::PresentationSessionMessageCallback& message_cb) override;
98 void SendMessage(int render_process_id, 99 void SendMessage(
99 int render_frame_id, 100 int render_process_id,
100 const content::PresentationSessionInfo& session, 101 int render_frame_id,
101 scoped_ptr<content::PresentationSessionMessage> message, 102 const content::PresentationSessionInfo& session,
102 const SendMessageCallback& send_message_cb) override; 103 scoped_ptr<content::PresentationSessionMessage> message,
104 const content::SendMessageCallback& send_message_cb) override;
103 bool ListenForSessionStateChange( 105 bool ListenForSessionStateChange(
104 int render_process_id, 106 int render_process_id,
105 int render_frame_id, 107 int render_frame_id,
106 content::PresentationSessionStateListener* listener) override; 108 content::PresentationSessionStateListener* listener) override;
109 void GetPresentationReceiverSession(
110 int render_process_id,
111 int render_frame_id,
112 const content::PresentationReceiverSessionAvailableCallback& callback)
113 override;
114 std::vector<content::PresentationSessionInfo> GetPresentationReceiverSessions(
115 int render_process_id,
116 int render_frame_id) override;
107 117
108 // Callback invoked when there is a route response from CreateRoute/JoinRoute 118 // Callback invoked when there is a route response from CreateRoute/JoinRoute
109 // outside of a Presentation API request. This could be due to 119 // outside of a Presentation API request. This could be due to
110 // browser action (e.g., browser initiated media router dialog) or 120 // browser action (e.g., browser initiated media router dialog) or
111 // a media route provider (e.g., autojoin). 121 // a media route provider (e.g., autojoin).
112 void OnRouteResponse(const MediaRoute* route, 122 void OnRouteResponse(const MediaRoute* route,
113 const std::string& presentation_id, 123 const std::string& presentation_id,
114 const std::string& error); 124 const std::string& error);
115 125
116 // Returns the default MediaSource for this tab if there is one. 126 // Returns the default MediaSource for this tab if there is one.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 const PresentationSessionErrorCallback& error_cb, 178 const PresentationSessionErrorCallback& error_cb,
169 const MediaRoute* route, 179 const MediaRoute* route,
170 const std::string& presentation_id, 180 const std::string& presentation_id,
171 const std::string& error_text); 181 const std::string& error_text);
172 182
173 void OnStartSessionSucceeded( 183 void OnStartSessionSucceeded(
174 int render_process_id, 184 int render_process_id,
175 int render_frame_id, 185 int render_frame_id,
176 const PresentationSessionSuccessCallback& success_cb, 186 const PresentationSessionSuccessCallback& success_cb,
177 const content::PresentationSessionInfo& new_session, 187 const content::PresentationSessionInfo& new_session,
178 const MediaRoute::Id& route_id); 188 const MediaRoute& route);
179 189
180 // Returns |true| if the frame is the main frame of |web_contents_|. 190 // Returns |true| if the frame is the main frame of |web_contents_|.
181 bool IsMainFrame(int render_process_id, int render_frame_id) const; 191 bool IsMainFrame(int render_process_id, int render_frame_id) const;
182 192
183 // Updates tab-level default MediaSource, default frame URL, and the 193 // Updates tab-level default MediaSource, default frame URL, and the
184 // originating frame. If the source or frame URL changed, notify the 194 // originating frame. If the source or frame URL changed, notify the
185 // observers. 195 // observers.
186 void UpdateDefaultMediaSourceAndNotifyObservers( 196 void UpdateDefaultMediaSourceAndNotifyObservers(
187 const RenderFrameHostId& render_frame_host_id, 197 const RenderFrameHostId& render_frame_host_id,
188 const MediaSource& new_default_source, 198 const MediaSource& new_default_source,
189 const GURL& new_default_frame_url); 199 const GURL& new_default_frame_url);
190 200
191 // ID of RenderFrameHost that contains the default presentation. 201 // ID of RenderFrameHost that contains the default presentation.
192 RenderFrameHostId default_presentation_render_frame_host_id_; 202 RenderFrameHostId default_presentation_render_frame_host_id_;
193 // Default MediaSource for the tab associated with this instance. 203 // Default MediaSource for the tab associated with this instance.
194 MediaSource default_source_; 204 MediaSource default_source_;
195 // URL of the frame that contains the default MediaSource. 205 // URL of the frame that contains the default MediaSource.
196 GURL default_frame_url_; 206 GURL default_frame_url_;
197 207
198 // References to the observers listening for changes to default media source. 208 // References to the observers listening for changes to default media source.
199 base::ObserverList< 209 base::ObserverList<
200 DefaultMediaSourceObserver> default_media_source_observers_; 210 DefaultMediaSourceObserver> default_media_source_observers_;
201 211
202 // References to the WebContents that owns this instance, and associated 212 // References to the WebContents that owns this instance, and associated
203 // browser profile's MediaRouter instance. 213 // browser profile's MediaRouter instance.
204 content::WebContents* web_contents_; 214 content::WebContents* const web_contents_;
205 MediaRouter* router_; 215 MediaRouter* router_;
206 216
207 scoped_ptr<PresentationFrameManager> frame_manager_; 217 scoped_ptr<PresentationFrameManager> frame_manager_;
208 218
209 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_; 219 base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_;
210 220
211 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl); 221 DISALLOW_COPY_AND_ASSIGN(PresentationServiceDelegateImpl);
212 }; 222 };
213 223
214 } // namespace media_router 224 } // namespace media_router
215 225
216 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_ 226 #endif // CHROME_BROWSER_MEDIA_ROUTER_PRESENTATION_SERVICE_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698