Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/ui/webui/media_router/query_result_manager.h

Issue 1784533004: [Media Router] Add origins to sink query results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 struct SinksQueryResult; 28 struct SinksQueryResult;
29 29
30 // The Media Router dialog allows the user to initiate casting using one of 30 // The Media Router dialog allows the user to initiate casting using one of
31 // several actions (each represented by a cast mode). Each cast mode is 31 // several actions (each represented by a cast mode). Each cast mode is
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 // GURL origin("https://origin.com");
38 // QueryResultManager::Observer* observer = ...; 39 // QueryResultManager::Observer* observer = ...;
39 // QueryResultManager result_manager(router); 40 // QueryResultManager result_manager(router);
40 // result_manager.AddObserver(observer); 41 // result_manager.AddObserver(observer);
41 // result_manager.StartSinksQuery(MediaCastMode::DEFAULT, 42 // result_manager.StartSinksQuery(MediaCastMode::DEFAULT,
42 // MediaSourceForPresentationUrl("http://google.com")); 43 // MediaSourceForPresentationUrl("http://google.com"), origin);
43 // result_manager.StartSinksQuery(MediaCastMode::TAB_MIRROR, 44 // result_manager.StartSinksQuery(MediaCastMode::TAB_MIRROR,
44 // MediaSourceForTab(123)); 45 // MediaSourceForTab(123), origin);
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 13 matching lines...) Expand all
68 const std::vector<MediaSinkWithCastModes>& sinks) = 0; 69 const std::vector<MediaSinkWithCastModes>& sinks) = 0;
69 }; 70 };
70 71
71 explicit QueryResultManager(MediaRouter* media_router); 72 explicit QueryResultManager(MediaRouter* media_router);
72 ~QueryResultManager(); 73 ~QueryResultManager();
73 74
74 // Adds/removes an observer that is notified with query results. 75 // Adds/removes an observer that is notified with query results.
75 void AddObserver(Observer* observer); 76 void AddObserver(Observer* observer);
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|
80 // from |origin|.
79 // Results are sent to all observers registered with AddObserver(). 81 // Results are sent to all observers registered with AddObserver().
80 // 82 //
81 // May start a new query in the Media Router for the registered source if 83 // 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 84 // there is no existing query for it. If there is an existing query for
83 // |cast_mode|, it is stopped. 85 // |cast_mode|, it is stopped.
84 // 86 //
85 // If |source| is empty, no new queries are begun. 87 // If |source| is empty, no new queries are begun.
86 void StartSinksQuery(MediaCastMode cast_mode, const MediaSource& source); 88 void StartSinksQuery(MediaCastMode cast_mode,
89 const MediaSource& source,
90 const GURL& origin);
87 91
88 // Stops notifying observers for |cast_mode|. 92 // Stops notifying observers for |cast_mode|.
89 void StopSinksQuery(MediaCastMode cast_mode); 93 void StopSinksQuery(MediaCastMode cast_mode);
90 94
91 // Gets the set of cast modes that are being actively queried. |cast_mode_set| 95 // Gets the set of cast modes that are being actively queried. |cast_mode_set|
92 // should be empty. 96 // should be empty.
93 void GetSupportedCastModes(CastModeSet* cast_modes) const; 97 void GetSupportedCastModes(CastModeSet* cast_modes) const;
94 98
95 // Returns the MediaSource registered for |cast_mode|. Returns an empty 99 // Returns the MediaSource registered for |cast_mode|. Returns an empty
96 // MediaSource if there is none. 100 // MediaSource if there is none.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 MediaRouter* router_; 143 MediaRouter* router_;
140 144
141 base::ThreadChecker thread_checker_; 145 base::ThreadChecker thread_checker_;
142 146
143 DISALLOW_COPY_AND_ASSIGN(QueryResultManager); 147 DISALLOW_COPY_AND_ASSIGN(QueryResultManager);
144 }; 148 };
145 149
146 } // namespace media_router 150 } // namespace media_router
147 151
148 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_ 152 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_QUERY_RESULT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/media_router/media_router_ui.cc ('k') | chrome/browser/ui/webui/media_router/query_result_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698