Chromium Code Reviews| Index: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| index eddec3cfbc703d31940a743e85dabccc8bb0e868..e14f5c40f72dd9a43c99aab53fee02601998008a 100644 |
| --- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| +++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js |
| @@ -1043,6 +1043,26 @@ Polymer({ |
| }, |
| /** |
| + * Creates a sink for the search result list whose name is equal to the |
| + * currently entered search text. This sink will create a new hangout sink if |
| + * the user clicks it. |
| + * @param {string} name Name of the new hangout. |
|
amp
2016/03/16 17:20:12
Can we include the domain here as well (it should
btolsch
2016/03/16 18:36:30
Done.
|
| + * @return {!{sinkItem: !media_router.Sink, |
| + * substrings: Array<!Array<number>>}} A search result item that |
| + * indicates a new hangout named |name| can be created. |
| + */ |
| + createManualHangoutItem_: function(name) { |
| + return { |
| + sinkItem: new media_router.Sink(null, name, 'Add hangout', null, |
| + media_router.SinkIconType.HANGOUT, |
| + media_router.SinkStatus.IDLE, |
| + media_router.CastModeType.TAB_MIRROR | |
| + media_router.CastModeType.DESKTOP_MIRROR), |
| + substrings: [[0, name.length - 1]], |
| + }; |
| + }, |
| + |
| + /** |
| * Filters all sinks based on fuzzy matching to the currently entered search |
| * text. |
| * @param {string} searchInputText The currently entered search text. |
| @@ -1069,6 +1089,7 @@ Polymer({ |
| substrings: matchSubstrings}); |
| } |
| searchResultsToShow.sort(this.compareSearchMatches_); |
| + searchResultsToShow.unshift(this.createManualHangoutItem_(searchInputText)); |
|
amp
2016/03/16 17:20:12
Do we need to tie this into the mrps better someho
btolsch
2016/03/16 18:36:30
I like this idea. I'm not sure there's a good way
|
| this.searchResultsToShow_ = searchResultsToShow; |
| }, |
| @@ -1294,7 +1315,17 @@ Polymer({ |
| var clickedSink = (this.isUserSearching_) ? |
| this.$$('#searchResults').itemForElement(event.target).sinkItem : |
| this.$.sinkList.itemForElement(event.target); |
| - this.showOrCreateRoute_(clickedSink); |
| + if (!clickedSink.id) { |
| + this.fire('add-hangout', { |
|
amp
2016/03/16 17:20:12
maybe use a more generic name instead of referring
btolsch
2016/03/16 18:36:30
I like the idea of pseudo sinks from the MRP's, an
|
| + name: clickedSink.name, |
| + selectedCastMode: |
| + this.shownCastModeValue_ == media_router.CastModeType.AUTO ? |
| + clickedSink.castModes & -clickedSink.castModes : |
| + this.shownCastModeValue_ |
| + }); |
| + } else { |
| + this.showOrCreateRoute_(clickedSink); |
|
amp
2016/03/16 17:20:12
I don't see where we do the route creation for the
btolsch
2016/03/16 18:36:30
That will depend on what happens with the rest of
|
| + } |
| this.fire('sink-click', {index: event['model'].index}); |
| }, |