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