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

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

Issue 1020743003: [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm dependency on helper function in chrome_browser Created 5 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "chrome/browser/media/router/media_route.h"
13 #include "chrome/browser/media/router/media_sink.h"
14 #include "chrome/browser/media/router/media_source.h"
15
16 namespace media_router {
17
18 class MediaRoute;
19
20 // Acts as the Chrome endpoint for communication between Media Router and
21 // Media Route Providers (via the Media Route Provider Manager).
22 class MediaRouteProviderManagerHost {
23 public:
24 virtual ~MediaRouteProviderManagerHost() {}
25
26 // Delegate called by the MediaRouteProviderManagerHost when a response is
27 // received from the MRPM.
28 class Delegate {
29 public:
30 virtual ~Delegate() {}
31
32 // Called when results from a media sinks query have been received.
33 // |source|: Media source of the query.
34 // |sinks|: List of sinks compatible with the source.
35 // |routes|: Currently active routes on |sinks|.
36 virtual void OnSinksReceived(const MediaSource& source,
37 const std::vector<MediaSink>& sinks) = 0;
38
39 // Called when results there is a message from a route.
mark a. foltz 2015/03/31 22:10:24 Omit 'results'
imcheng 2015/04/01 00:55:16 Done.
40 // |route_id|: The route ID.
41 // |message|: The message.
42 virtual void OnMessage(const MediaRouteId& route_id,
43 const std::string& message) = 0;
44
45 // Called when a response to a route request has been received and
46 // a route has been established.
47 // |request_id|: ID of original request.
48 // |route|: Description of the established route.
49 virtual void OnRouteResponseReceived(const RouteRequestId& request_id,
50 const MediaRoute& route) = 0;
51
52 // Called when an error occurred while establishing a route.
53 // |request_id|: ID of original request.
54 // |error_text|: Text describing the error.
55 virtual void OnRouteResponseError(const RouteRequestId& request_id,
56 const std::string& error_text) = 0;
57
58 // Called when the list of currently MediaRoutes and their MediaSinks
59 // have been updated.
mark a. foltz 2015/03/31 22:10:24 s/have/has/
imcheng 2015/04/01 00:55:16 Done.
60 // |routes|: List of MediaRoutes.
61 // |sinks|: List of MediaSinks associated with the routes.
62 virtual void OnRoutesUpdated(
63 const std::vector<MediaRoute>& routes,
64 const std::vector<MediaSink>& sinks) = 0;
65
66 // Called when the MRPMHost is being destroyed.
67 virtual void OnHostDestroyed(MediaRouteProviderManagerHost* host) = 0;
68 };
69
70 // The following API allows the media router to send commands to the MRPM.
71
72 // Instructs MRPM to start a query for compatible media sinks for |source|.
73 // Results from the query and subsequent updates will be received via
74 // |Delegate::OnSinksReceived| until the query is removed from MRPM
75 // via |RemoveMediaSinksQuery|.
76 virtual void AddMediaSinksQuery(const MediaSource& source) = 0;
77
78 // Instructs MRPM to stop a query for compatible media sinks for |source|.
79 virtual void RemoveMediaSinksQuery(const MediaSource& source) = 0;
80
81 // Requests MRPM to establish a route between |source| and a media sink given
82 // by |sink_id|. |request_id| is generated by Media Router and passed
83 // to MRPM to identify the request.
84 virtual void RequestRoute(const RouteRequestId& request_id,
85 const MediaSource& source,
86 const MediaSinkId& sink_id) = 0;
87
88 // Requests MRPM to close a route specified by |route_id|.
89 virtual void CloseRoute(const MediaRouteId& route_id) = 0;
90
91 // Requests MRPM to post |message| with optional |extra_info| to a MediaSink
92 // connected by MediaRoute with |route_id|.
93 virtual void PostMessage(const MediaRouteId& route_id,
94 const std::string& message,
95 const std::string& extra_info_json) = 0;
mark a. foltz 2015/03/31 22:10:24 I thought extra_info_json was going to be removed?
imcheng 2015/04/01 00:55:16 oops, forgot to remove it from here. Done.
96
97 // Requests MRPM to send updates on all MediaRoutes and their MediaSinks.
98 // The updated lists will be received via
99 // |Delegate::OnActiveSinksAndRoutesReceived|.
100 virtual void StartMediaRoutesQuery() = 0;
101
102 // Requests MRPM to stop sending updates on MediaRoutes.
103 virtual void StopMediaRoutesQuery() = 0;
104 };
105
106 } // namespace media_router
107
108 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698