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

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

Issue 1020743003: [Media Router] Design MediaRouter interface with stub implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Kevin's comments, removed extension_* files for now Created 5 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
(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_ROUTER_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "chrome/browser/media/router/media_route_id.h"
12 #include "chrome/browser/media/router/media_sink.h"
13
14 namespace media_router {
15
16 class MediaRoute;
17 class MediaRouteResponse;
18 class MediaRoutesObserver;
19 class MediaSource;
20 class MediaSinksObserver;
21
22 using MediaRouteResponseCallback =
23 base::Callback<void(const MediaRouteResponse&)>;
24
25 // An interface for handling resources related to media routing.
26 // Responsible for registering observers for receiving sink availability updates
27 // as well as handling route requests/responses.
mark a. foltz 2015/03/27 21:21:58 Update docstring to include PostMessage behavior.
mark a. foltz 2015/03/27 21:21:58 Threading assumptions should be documented here in
imcheng 2015/03/30 22:49:09 I will do that in media_router_impl.h.
imcheng 2015/03/30 22:49:10 Done.
28 class MediaRouter {
29 public:
30 virtual ~MediaRouter();
31
32 // Requests a media route from |source| to |sink_id|.
33 // |callback| is invoked with a response indicating success or failure.
mark a. foltz 2015/03/27 21:21:58 Explain use of return value (i.e. it can be used t
imcheng 2015/03/30 22:49:10 Done.
34 virtual RouteRequestId StartRouteRequest(
35 const MediaSource& source,
36 const MediaSinkId& sink_id,
37 const MediaRouteResponseCallback& callback) = 0;
38
39 // Unregisters a pending media route request, e.g. when the MR UI is closed.
mark a. foltz 2015/03/27 21:21:58 e.g., when the user has canceled presentation by c
mark a. foltz 2015/03/27 21:21:58 Should this have a return value? As long as it gu
imcheng 2015/03/30 22:49:09 Done.
imcheng 2015/03/30 22:49:10 It will always discard the request, so no return v
40 virtual void UnregisterMediaRouteResponseCallback(
mark a. foltz 2015/03/27 21:21:58 - A better name might be CancelRouteRequest? - Men
imcheng 2015/03/30 22:49:09 This function does NOT cancel a route request, onl
41 const RouteRequestId& request_id) = 0;
42
43 // Closes a media route specified by |route_id|.
mark a. foltz 2015/03/27 21:21:58 s/a/the/
imcheng 2015/03/30 22:49:10 Done.
44 virtual void CloseRoute(const MediaRouteId& route_id) = 0;
45
46 // Registers |observer| with MediaRouter so that it will receive updates on
mark a. foltz 2015/03/27 21:21:58 I might write this as: Registers |observer| with
imcheng 2015/03/30 22:49:10 Done.
47 // sinks that are compatible with the source specified in it.
48 // Initial set of updates may be returned synchronously to |observer|.
49 // NOTE: This class does not assume ownership of |observer|. Callers must
50 // manage |observer| and make sure |UnregisterObserver()| is called
51 // before the observer is destroyed.
mark a. foltz 2015/03/27 21:21:58 Is Unregister() always called immediately before O
imcheng 2015/03/30 22:49:09 It is typically the case that destruction follows
52 // Returns true if registration succeeded or the |observer| already exists.
53 // If the MRPM Host is not available, the registration request will fail
54 // immediately.
55 virtual bool RegisterObserver(MediaSinksObserver* observer) = 0;
56
57 // Unregisters |observer| from MediaRouter.
mark a. foltz 2015/03/27 21:21:58 What are the side effects? I assume that |observer
imcheng 2015/03/30 22:49:09 Done.
58 virtual void UnregisterObserver(MediaSinksObserver* observer) = 0;
59
60 // Posts |message| with optional |extra_info_json| to a MediaSink connected
61 // via MediaRoute with |route_id|.
62 virtual void PostMessage(const MediaRouteId& route_id,
mark a. foltz 2015/03/27 21:21:58 This (at a minimum) needs a TODO to add overrides
imcheng 2015/03/30 22:49:09 Does the API and downstream need to differentiate
63 const std::string& message,
64 const std::string& extra_info_json) = 0;
mark a. foltz 2015/03/27 21:21:58 Is extra_info_json being used?
imcheng 2015/03/30 22:49:09 No it's not being used. I can remove it for now to
65
66 // Adds a MediaRoutesObserver to listen for updates on MediaRoutes.
67 // MediaRouter does not own |observer|. |RemoveMediaRoutesObserver| should
68 // be called before |observer| is destroyed.
mark a. foltz 2015/03/27 21:21:58 Similar comments to the pattern above for Register
imcheng 2015/03/30 22:49:09 See other comment.
69 virtual void AddMediaRoutesObserver(MediaRoutesObserver* observer) = 0;
mark a. foltz 2015/03/27 21:21:58 Would prefer similar terminology to the sinks case
imcheng 2015/03/30 22:49:09 Done.
70
71 // Removes a previously added MediaRoutesObserver. |observer| will stop
72 // receiving updates from MediaRouter.
73 virtual void RemoveMediaRoutesObserver(MediaRoutesObserver* observer) = 0;
74 };
75
76 } // namespace media_router
77
78 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698