Chromium Code Reviews| 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_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 110 |
| 111 // Calls MediaRouter to close the given route. | 111 // Calls MediaRouter to close the given route. |
| 112 void CloseRoute(const MediaRoute::Id& route_id); | 112 void CloseRoute(const MediaRoute::Id& route_id); |
| 113 | 113 |
| 114 // Calls MediaRouter to add the given issue. | 114 // Calls MediaRouter to add the given issue. |
| 115 void AddIssue(const Issue& issue); | 115 void AddIssue(const Issue& issue); |
| 116 | 116 |
| 117 // Calls MediaRouter to clear the given issue. | 117 // Calls MediaRouter to clear the given issue. |
| 118 void ClearIssue(const Issue::Id& issue_id); | 118 void ClearIssue(const Issue::Id& issue_id); |
| 119 | 119 |
| 120 // Calls MediaRouter to search route providers for sinks matching | |
| 121 // |search_criteria| with the source that is currently associated with | |
| 122 // |cast_mode|. The user's domain |domain| is also used. | |
| 123 bool SearchSinksAndCreateRoute(const MediaSink::Id& sink_id, | |
| 124 const std::string& search_criteria, | |
| 125 const std::string& domain, | |
| 126 MediaCastMode cast_mode); | |
| 127 | |
| 120 // Returns the hostname of the default source's parent frame URL. | 128 // Returns the hostname of the default source's parent frame URL. |
| 121 std::string GetPresentationRequestSourceName() const; | 129 std::string GetPresentationRequestSourceName() const; |
| 122 std::string GetTruncatedPresentationRequestSourceName() const; | 130 std::string GetTruncatedPresentationRequestSourceName() const; |
| 123 bool HasPendingRouteRequest() const { | 131 bool HasPendingRouteRequest() const { |
| 124 return current_route_request_id_ != -1; | 132 return current_route_request_id_ != -1; |
| 125 } | 133 } |
| 126 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } | 134 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } |
| 127 const std::vector<MediaRoute>& routes() const { return routes_; } | 135 const std::vector<MediaRoute>& routes() const { return routes_; } |
| 128 const std::vector<MediaRoute::Id>& joinable_route_ids() const { | 136 const std::vector<MediaRoute::Id>& joinable_route_ids() const { |
| 129 return joinable_route_ids_; | 137 return joinable_route_ids_; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 | 209 |
| 202 // Callback passed to MediaRouter to receive response to route creation | 210 // Callback passed to MediaRouter to receive response to route creation |
| 203 // requests. | 211 // requests. |
| 204 void OnRouteResponseReceived( | 212 void OnRouteResponseReceived( |
| 205 int route_request_id, | 213 int route_request_id, |
| 206 const MediaSink::Id& sink_id, | 214 const MediaSink::Id& sink_id, |
| 207 MediaCastMode cast_mode, | 215 MediaCastMode cast_mode, |
| 208 const base::string16& presentation_request_source_name, | 216 const base::string16& presentation_request_source_name, |
| 209 const RouteRequestResult& result); | 217 const RouteRequestResult& result); |
| 210 | 218 |
| 219 // Callback passed to MediaRouter to receive the sink ID of the sink found by | |
| 220 // SearchSinksAndCreateRoute(). | |
| 221 void OnSearchSinkResponseReceived(const std::string& sink_id); | |
| 222 | |
| 211 // Creates and sends an issue if route creation timed out. | 223 // Creates and sends an issue if route creation timed out. |
| 212 void SendIssueForRouteTimeout( | 224 void SendIssueForRouteTimeout( |
| 213 MediaCastMode cast_mode, | 225 MediaCastMode cast_mode, |
| 214 const base::string16& presentation_request_source_name); | 226 const base::string16& presentation_request_source_name); |
| 215 | 227 |
| 216 // Initializes the dialog with mirroring sources derived from |initiator|. | 228 // Initializes the dialog with mirroring sources derived from |initiator|. |
| 217 void InitCommon(content::WebContents* initiator); | 229 void InitCommon(content::WebContents* initiator); |
| 218 | 230 |
| 219 // PresentationServiceDelegateImpl::DefaultPresentationObserver | 231 // PresentationServiceDelegateImpl::DefaultPresentationObserver |
| 220 void OnDefaultPresentationChanged( | 232 void OnDefaultPresentationChanged( |
| 221 const PresentationRequest& presentation_request) override; | 233 const PresentationRequest& presentation_request) override; |
| 222 void OnDefaultPresentationRemoved() override; | 234 void OnDefaultPresentationRemoved() override; |
| 223 | 235 |
| 224 // Creates a brand new route or, if a |route_id| is supplied, connects to a | 236 // Populates common route-related parameters for CreateRoute(), |
| 225 // non-local route. This is used for connecting to a non-local route. | 237 // ConnectRoute(), and SearchSinksAndCreateRoute(). |
| 226 // Returns true if a route request is successfully submitted. | 238 bool GetCreateOrConnectRouteParameters( |
|
apacible
2016/04/08 21:02:12
Rename this to be more general? Previously it was
btolsch
2016/04/08 21:55:04
The use by SearchSinksAndCreateRoute() is identica
apacible
2016/04/08 22:07:47
Something like SetRouteParamters()?
btolsch
2016/04/11 08:19:35
Done.
| |
| 227 // OnRouteResponseReceived() will be invoked when the route request | 239 const MediaSink::Id& sink_id, |
| 228 // completes. | 240 MediaCastMode cast_mode, |
| 229 bool CreateOrConnectRoute(const MediaSink::Id& sink_id, | 241 MediaSource::Id* source_id, |
| 230 MediaCastMode cast_mode, | 242 GURL* origin, |
| 231 const MediaRoute::Id& route_id); | 243 std::vector<MediaRouteResponseCallback>* route_response_callbacks, |
| 244 base::TimeDelta* timeout, | |
| 245 bool* off_the_record); | |
| 232 | 246 |
| 233 // Updates the set of supported cast modes and sends the updated set to | 247 // Updates the set of supported cast modes and sends the updated set to |
| 234 // |handler_|. | 248 // |handler_|. |
| 235 void UpdateCastModes(); | 249 void UpdateCastModes(); |
| 236 | 250 |
| 237 // Returns the default presentation request's frame URL if there is one. | 251 // Returns the default presentation request's frame URL if there is one. |
| 238 // Otherwise returns an empty GURL. | 252 // Otherwise returns an empty GURL. |
| 239 GURL GetFrameURL() const; | 253 GURL GetFrameURL() const; |
| 240 | 254 |
| 241 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted | 255 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 // NOTE: Weak pointers must be invalidated before all other member variables. | 311 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 298 // Therefore |weak_factory_| must be placed at the end. | 312 // Therefore |weak_factory_| must be placed at the end. |
| 299 base::WeakPtrFactory<MediaRouterUI> weak_factory_; | 313 base::WeakPtrFactory<MediaRouterUI> weak_factory_; |
| 300 | 314 |
| 301 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); | 315 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); |
| 302 }; | 316 }; |
| 303 | 317 |
| 304 } // namespace media_router | 318 } // namespace media_router |
| 305 | 319 |
| 306 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 320 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
| OLD | NEW |