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