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

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: fix compile 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 virtual void OnSinksReceived(const MediaSource& source,
36 const std::vector<MediaSink>& sinks) = 0;
37
38 // Called when there is a message from a route.
39 // |route_id|: The route ID.
40 // |message|: The message.
41 virtual void OnMessage(const MediaRouteId& route_id,
42 const std::string& message) = 0;
43
44 // Called when a response to a route request has been received and
45 // a route has been established.
46 // |request_id|: ID of original request.
47 // |route|: Description of the established route.
48 virtual void OnRouteResponseReceived(const RouteRequestId& request_id,
49 const MediaRoute& route) = 0;
50
51 // Called when an error occurred while establishing a route.
52 // |request_id|: ID of original request.
53 // |error_text|: Text describing the error.
54 virtual void OnRouteResponseError(const RouteRequestId& request_id,
55 const std::string& error_text) = 0;
56
57 // Called when the list of currently MediaRoutes and their MediaSinks
58 // has been updated.
59 // |routes|: List of MediaRoutes.
60 // |sinks|: List of MediaSinks associated with the routes.
61 virtual void OnRoutesUpdated(
62 const std::vector<MediaRoute>& routes,
63 const std::vector<MediaSink>& sinks) = 0;
64
65 // Called when the MRPMHost is being destroyed.
66 virtual void OnHostDestroyed(MediaRouteProviderManagerHost* host) = 0;
67 };
68
69 // The following APIs allow the media router to send commands to the MRPM.
70
71 // Instructs MRPM to start a query for compatible media sinks for |source|.
72 // Results from the query and subsequent updates will be received via
73 // |Delegate::OnSinksReceived| until the query is removed from MRPM
74 // via |RemoveMediaSinksQuery|.
75 virtual void AddMediaSinksQuery(const MediaSource& source) = 0;
76
77 // Instructs MRPM to stop a query for compatible media sinks for |source|.
78 // The delegate will no longer receive updates.
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 // Result of the request will be received via either |OnRouteResponseReceived|
85 // or |OnRouteResponseError|.
86 virtual void RequestRoute(const RouteRequestId& request_id,
87 const MediaSource& source,
88 const MediaSinkId& sink_id) = 0;
89
90 // Requests MRPM to close a route specified by |route_id|.
91 virtual void CloseRoute(const MediaRouteId& route_id) = 0;
92
93 // Requests MRPM to post |message| to a MediaSink connected by MediaRoute
94 // with |route_id|.
95 virtual void PostMessage(const MediaRouteId& route_id,
96 const std::string& message) = 0;
97
98 // Requests MRPM to start a query for all MediaRoutes and their MediaSinks.
99 // The result and subsequent updates will be received via
100 // |Delegate::OnRoutesUpdated|.
xhwang 2015/04/06 20:51:31 nit: You are not using "Delegate::" in other comme
imcheng 2015/04/06 21:54:20 Added Delegate:: to OnRouteResponse* comments abov
101 virtual void StartMediaRoutesQuery() = 0;
102
103 // Requests MRPM to stop the query. The delegate will no longer receive
104 // updates.
105 virtual void StopMediaRoutesQuery() = 0;
106 };
107
108 } // namespace media_router
109
110 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_PROVIDER_MANAGER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698