| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void ClearIssue(const Issue::Id& issue_id); | 121 void ClearIssue(const Issue::Id& issue_id); |
| 122 | 122 |
| 123 // Calls MediaRouter to search route providers for sinks matching | 123 // Calls MediaRouter to search route providers for sinks matching |
| 124 // |search_criteria| with the source that is currently associated with | 124 // |search_criteria| with the source that is currently associated with |
| 125 // |cast_mode|. The user's domain |domain| is also used. | 125 // |cast_mode|. The user's domain |domain| is also used. |
| 126 void SearchSinksAndCreateRoute(const MediaSink::Id& sink_id, | 126 void SearchSinksAndCreateRoute(const MediaSink::Id& sink_id, |
| 127 const std::string& search_criteria, | 127 const std::string& search_criteria, |
| 128 const std::string& domain, | 128 const std::string& domain, |
| 129 MediaCastMode cast_mode); | 129 MediaCastMode cast_mode); |
| 130 | 130 |
| 131 // Returns the cast mode that user has last chosen for the current hostname. |
| 132 // If user hasn't chosen any, this returns MediaCastMode::DEFAULT. |
| 133 MediaCastMode GetCastModeSelectionForCurrentHost() const; |
| 134 |
| 135 // Records the cast mode selection for the current hostname, unless the cast |
| 136 // mode is MediaCastMode::DESKTOP_MIRROR. |
| 137 void RecordCastModeSelection(MediaCastMode cast_mode); |
| 138 |
| 131 // Returns the hostname of the default source's parent frame URL. | 139 // Returns the hostname of the default source's parent frame URL. |
| 132 std::string GetPresentationRequestSourceName() const; | 140 std::string GetPresentationRequestSourceName() const; |
| 133 std::string GetTruncatedPresentationRequestSourceName() const; | 141 std::string GetTruncatedPresentationRequestSourceName() const; |
| 134 bool HasPendingRouteRequest() const { | 142 bool HasPendingRouteRequest() const { |
| 135 return current_route_request_id_ != -1; | 143 return current_route_request_id_ != -1; |
| 136 } | 144 } |
| 137 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } | 145 const std::vector<MediaSinkWithCastModes>& sinks() const { return sinks_; } |
| 138 const std::vector<MediaRoute>& routes() const { return routes_; } | 146 const std::vector<MediaRoute>& routes() const { return routes_; } |
| 139 const std::vector<MediaRoute::Id>& joinable_route_ids() const { | 147 const std::vector<MediaRoute::Id>& joinable_route_ids() const { |
| 140 return joinable_route_ids_; | 148 return joinable_route_ids_; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 bool* incognito); | 277 bool* incognito); |
| 270 | 278 |
| 271 // Updates the set of supported cast modes and sends the updated set to | 279 // Updates the set of supported cast modes and sends the updated set to |
| 272 // |handler_|. | 280 // |handler_|. |
| 273 void UpdateCastModes(); | 281 void UpdateCastModes(); |
| 274 | 282 |
| 275 // Returns the default presentation request's frame URL if there is one. | 283 // Returns the default presentation request's frame URL if there is one. |
| 276 // Otherwise returns an empty GURL. | 284 // Otherwise returns an empty GURL. |
| 277 GURL GetFrameURL() const; | 285 GURL GetFrameURL() const; |
| 278 | 286 |
| 287 // Returns the hostname (e.g. "cs.chromium.org") for |initiator_|, or an empty |
| 288 // string if |initiator_| is not set. |
| 289 std::string GetInitiatorHostname() const; |
| 290 |
| 279 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted | 291 // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted |
| 280 // only after it has deleted |this|. | 292 // only after it has deleted |this|. |
| 281 MediaRouterWebUIMessageHandler* handler_; | 293 MediaRouterWebUIMessageHandler* handler_; |
| 282 | 294 |
| 283 // These are non-null while this instance is registered to receive | 295 // These are non-null while this instance is registered to receive |
| 284 // updates from them. | 296 // updates from them. |
| 285 std::unique_ptr<IssuesObserver> issues_observer_; | 297 std::unique_ptr<IssuesObserver> issues_observer_; |
| 286 std::unique_ptr<MediaRoutesObserver> routes_observer_; | 298 std::unique_ptr<MediaRoutesObserver> routes_observer_; |
| 287 | 299 |
| 288 // Set to true by |handler_| when the UI has been initialized. | 300 // Set to true by |handler_| when the UI has been initialized. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // NOTE: Weak pointers must be invalidated before all other member variables. | 348 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 337 // Therefore |weak_factory_| must be placed at the end. | 349 // Therefore |weak_factory_| must be placed at the end. |
| 338 base::WeakPtrFactory<MediaRouterUI> weak_factory_; | 350 base::WeakPtrFactory<MediaRouterUI> weak_factory_; |
| 339 | 351 |
| 340 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); | 352 DISALLOW_COPY_AND_ASSIGN(MediaRouterUI); |
| 341 }; | 353 }; |
| 342 | 354 |
| 343 } // namespace media_router | 355 } // namespace media_router |
| 344 | 356 |
| 345 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ | 357 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_UI_H_ |
| OLD | NEW |