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

Side by Side Diff: chrome/browser/media/router/media_router.h

Issue 2679893002: [Media Router] Add ProvideSinks() Mojo API (Closed)
Patch Set: Created 3 years, 10 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_MEDIA_ROUTER_MEDIA_ROUTER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const content::PresentationConnectionStateChangeInfo&)>::Subscription; 52 const content::PresentationConnectionStateChangeInfo&)>::Subscription;
53 53
54 // An interface for handling resources related to media routing. 54 // An interface for handling resources related to media routing.
55 // Responsible for registering observers for receiving sink availability 55 // Responsible for registering observers for receiving sink availability
56 // updates, handling route requests/responses, and operating on routes (e.g. 56 // updates, handling route requests/responses, and operating on routes (e.g.
57 // posting messages or closing). 57 // posting messages or closing).
58 // TODO(imcheng): Reduce number of parameters by putting them into structs. 58 // TODO(imcheng): Reduce number of parameters by putting them into structs.
59 class MediaRouter : public KeyedService { 59 class MediaRouter : public KeyedService {
60 public: 60 public:
61 using SendRouteMessageCallback = base::Callback<void(bool sent)>; 61 using SendRouteMessageCallback = base::Callback<void(bool sent)>;
62 using MediaSinkList = std::vector<std::unique_ptr<MediaSink>>;
mark a. foltz 2017/02/10 01:23:55 Should MediaSink be move-only? Or is there a use c
imcheng 2017/02/10 22:45:18 I think this just needs to be updated according to
zhaobin 2017/02/16 22:56:35 Done.
62 63
63 ~MediaRouter() override = default; 64 ~MediaRouter() override = default;
64 65
65 // Creates a media route from |source_id| to |sink_id|. 66 // Creates a media route from |source_id| to |sink_id|.
66 // |origin| is the origin of requestor's page. 67 // |origin| is the origin of requestor's page.
67 // |web_contents| is the WebContents of the tab in which the request was made. 68 // |web_contents| is the WebContents of the tab in which the request was made.
68 // |origin| and |web_contents| are used for enforcing same-origin and/or 69 // |origin| and |web_contents| are used for enforcing same-origin and/or
69 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page 70 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page
70 // requesting JoinRoute() must have the same origin as the page that requested 71 // requesting JoinRoute() must have the same origin as the page that requested
71 // CreateRoute()). 72 // CreateRoute()).
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // the user has no domain or is not signed in. |sink_callback| will be called 162 // the user has no domain or is not signed in. |sink_callback| will be called
162 // either with the ID of the new sink when it is found or with an empty string 163 // either with the ID of the new sink when it is found or with an empty string
163 // if no sink was found. 164 // if no sink was found.
164 virtual void SearchSinks( 165 virtual void SearchSinks(
165 const MediaSink::Id& sink_id, 166 const MediaSink::Id& sink_id,
166 const MediaSource::Id& source_id, 167 const MediaSource::Id& source_id,
167 const std::string& search_input, 168 const std::string& search_input,
168 const std::string& domain, 169 const std::string& domain,
169 const MediaSinkSearchResponseCallback& sink_callback) = 0; 170 const MediaSinkSearchResponseCallback& sink_callback) = 0;
170 171
172 // Called when DIAL or CAST MediaSinkService finishes sink discovery.
mark a. foltz 2017/02/10 01:23:55 Are there multiple services running at once? Do
imcheng 2017/02/10 22:45:18 It seems this will be called directly by each serv
zhaobin 2017/02/16 22:56:35 Done.
173 // |sinks|: sinks discovered by MediaSinkService.
174 virtual void OnSinksDiscovered(std::unique_ptr<MediaSinkList> sinks) = 0;
mark a. foltz 2017/02/10 01:23:55 Passing a std::vector by unique_ptr isn't common.
imcheng 2017/02/10 22:45:18 I don't think a vector<unique_ptr<T>> is copyable
zhaobin 2017/02/16 22:56:35 Done.
175
171 // Adds |callback| to listen for state changes for presentation connected to 176 // Adds |callback| to listen for state changes for presentation connected to
172 // |route_id|. The returned Subscription object is owned by the caller. 177 // |route_id|. The returned Subscription object is owned by the caller.
173 // |callback| will be invoked whenever there are state changes, until the 178 // |callback| will be invoked whenever there are state changes, until the
174 // caller destroys the Subscription object. 179 // caller destroys the Subscription object.
175 virtual std::unique_ptr<PresentationConnectionStateSubscription> 180 virtual std::unique_ptr<PresentationConnectionStateSubscription>
176 AddPresentationConnectionStateChangedCallback( 181 AddPresentationConnectionStateChangedCallback(
177 const MediaRoute::Id& route_id, 182 const MediaRoute::Id& route_id,
178 const content::PresentationConnectionStateChangedCallback& callback) = 0; 183 const content::PresentationConnectionStateChangedCallback& callback) = 0;
179 184
180 // Called when the incognito profile for this instance is being shut down. 185 // Called when the incognito profile for this instance is being shut down.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 246
242 // Unregisters a previously registered RouteMessagesObserver. |observer| will 247 // Unregisters a previously registered RouteMessagesObserver. |observer| will
243 // stop receiving further updates. 248 // stop receiving further updates.
244 virtual void UnregisterRouteMessageObserver( 249 virtual void UnregisterRouteMessageObserver(
245 RouteMessageObserver* observer) = 0; 250 RouteMessageObserver* observer) = 0;
246 }; 251 };
247 252
248 } // namespace media_router 253 } // namespace media_router
249 254
250 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ 255 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/router/mock_media_router.h » ('j') | chrome/browser/media/router/mojo/media_router.mojom » ('J')

Powered by Google App Engine
This is Rietveld 408576698