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_QUERY_RESULT_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 // associated with a media source. This class allows the dialog to receive | 32 // associated with a media source. This class allows the dialog to receive |
| 33 // lists of MediaSinks compatible with the cast modes available through the | 33 // lists of MediaSinks compatible with the cast modes available through the |
| 34 // dialog. | 34 // dialog. |
| 35 // | 35 // |
| 36 // Typical use: | 36 // Typical use: |
| 37 // | 37 // |
| 38 // QueryResultManager::Observer* observer = ...; | 38 // QueryResultManager::Observer* observer = ...; |
| 39 // QueryResultManager result_manager(router); | 39 // QueryResultManager result_manager(router); |
| 40 // result_manager.AddObserver(observer); | 40 // result_manager.AddObserver(observer); |
| 41 // result_manager.StartSinksQuery(MediaCastMode::DEFAULT, | 41 // result_manager.StartSinksQuery(MediaCastMode::DEFAULT, |
| 42 // MediaSourceForPresentationUrl("http://google.com")); | 42 // MediaSourceForPresentationUrl("http://google.com"), |
|
mark a. foltz
2016/03/03 22:58:37
Make the presentation URL different from the origi
matt.boetger
2016/03/04 00:22:11
Done.
| |
| 43 // GURL("http://google.com")); | |
| 43 // result_manager.StartSinksQuery(MediaCastMode::TAB_MIRROR, | 44 // result_manager.StartSinksQuery(MediaCastMode::TAB_MIRROR, |
| 44 // MediaSourceForTab(123)); | 45 // MediaSourceForTab(123), GURL("")); |
|
mark a. foltz
2016/03/03 22:58:37
When would a sinks query not pass an origin?
matt.boetger
2016/03/04 00:22:11
For tabs.
| |
| 45 // ... | 46 // ... |
| 46 // [Updates will be received by observer via OnResultsUpdated()] | 47 // [Updates will be received by observer via OnResultsUpdated()] |
| 47 // ... | 48 // ... |
| 48 // [When info on MediaSource is needed, i.e. when requesting route for a mode] | 49 // [When info on MediaSource is needed, i.e. when requesting route for a mode] |
| 49 // CastModeSet cast_modes; | 50 // CastModeSet cast_modes; |
| 50 // result_manager.GetSupportedCastModes(&cast_modes); | 51 // result_manager.GetSupportedCastModes(&cast_modes); |
| 51 // [Logic to select a MediaCastMode from the set] | 52 // [Logic to select a MediaCastMode from the set] |
| 52 // MediaSource source = result_manager.GetSourceForCastMode( | 53 // MediaSource source = result_manager.GetSourceForCastMode( |
| 53 // MediaCastMode::TAB_MIRROR); | 54 // MediaCastMode::TAB_MIRROR); |
| 54 // if (!source.Empty()) { | 55 // if (!source.Empty()) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 76 void RemoveObserver(Observer* observer); | 77 void RemoveObserver(Observer* observer); |
| 77 | 78 |
| 78 // Requests a list of MediaSinks compatible with |source| for |cast_mode|. | 79 // Requests a list of MediaSinks compatible with |source| for |cast_mode|. |
| 79 // Results are sent to all observers registered with AddObserver(). | 80 // Results are sent to all observers registered with AddObserver(). |
| 80 // | 81 // |
| 81 // May start a new query in the Media Router for the registered source if | 82 // May start a new query in the Media Router for the registered source if |
| 82 // there is no existing query for it. If there is an existing query for | 83 // there is no existing query for it. If there is an existing query for |
| 83 // |cast_mode|, it is stopped. | 84 // |cast_mode|, it is stopped. |
| 84 // | 85 // |
| 85 // If |source| is empty, no new queries are begun. | 86 // If |source| is empty, no new queries are begun. |
| 86 void StartSinksQuery(MediaCastMode cast_mode, const MediaSource& source); | 87 void StartSinksQuery(MediaCastMode cast_mode, |
| 88 const MediaSource& source); | |
| 87 | 89 |
| 88 // Stops notifying observers for |cast_mode|. | 90 // Stops notifying observers for |cast_mode|. |
| 89 void StopSinksQuery(MediaCastMode cast_mode); | 91 void StopSinksQuery(MediaCastMode cast_mode); |
| 90 | 92 |
| 91 // Gets the set of cast modes that are being actively queried. |cast_mode_set| | 93 // Gets the set of cast modes that are being actively queried. |cast_mode_set| |
| 92 // should be empty. | 94 // should be empty. |
| 93 void GetSupportedCastModes(CastModeSet* cast_modes) const; | 95 void GetSupportedCastModes(CastModeSet* cast_modes) const; |
| 94 | 96 |
| 95 // Returns the MediaSource registered for |cast_mode|. Returns an empty | 97 // Returns the MediaSource registered for |cast_mode|. Returns an empty |
| 96 // MediaSource if there is none. | 98 // MediaSource if there is none. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 MediaRouter* router_; | 141 MediaRouter* router_; |
| 140 | 142 |
| 141 base::ThreadChecker thread_checker_; | 143 base::ThreadChecker thread_checker_; |
| 142 | 144 |
| 143 DISALLOW_COPY_AND_ASSIGN(QueryResultManager); | 145 DISALLOW_COPY_AND_ASSIGN(QueryResultManager); |
| 144 }; | 146 }; |
| 145 | 147 |
| 146 } // namespace media_router | 148 } // namespace media_router |
| 147 | 149 |
| 148 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ | 150 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ |
| OLD | NEW |