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

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

Issue 1177073003: [MediaRouter] Update MR-2-Extension's PostMessage to return boolean. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Mark's comments Created 5 years, 6 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 // Type of callback used in |CreateRoute()|. Callback is invoked when the 23 // Type of callback used in |CreateRoute()|. Callback is invoked when the
24 // route request either succeeded or failed. 24 // route request either succeeded or failed.
25 // The first argument is the route created. If the route request failed, this 25 // The first argument is the route created. If the route request failed, this
26 // will be a nullptr. 26 // will be a nullptr.
27 // The second argument is the error string, which will be nonempty if the route 27 // The second argument is the error string, which will be nonempty if the route
28 // request failed. 28 // request failed.
29 using MediaRouteResponseCallback = 29 using MediaRouteResponseCallback =
30 base::Callback<void(scoped_ptr<MediaRoute>, const std::string&)>; 30 base::Callback<void(scoped_ptr<MediaRoute>, const std::string&)>;
31 31
32 using SendMessageCallback = base::Callback<void(bool sent)>;
Kevin M 2015/06/11 22:45:24 Make this a child of MediaRouter
haibinlu 2015/06/11 23:05:22 Done.
33
32 // An interface for handling resources related to media routing. 34 // An interface for handling resources related to media routing.
33 // Responsible for registering observers for receiving sink availability 35 // Responsible for registering observers for receiving sink availability
34 // updates, handling route requests/responses, and operating on routes (e.g. 36 // updates, handling route requests/responses, and operating on routes (e.g.
35 // posting messages or closing). 37 // posting messages or closing).
36 class MediaRouter { 38 class MediaRouter {
37 public: 39 public:
38 virtual ~MediaRouter() {} 40 virtual ~MediaRouter() {}
39 41
40 // Creates a media route from |source_id| to |sink_id|. 42 // Creates a media route from |source_id| to |sink_id|.
41 // |callback| is invoked with a response indicating success or failure. 43 // |callback| is invoked with a response indicating success or failure.
42 virtual void CreateRoute(const MediaSource::Id& source_id, 44 virtual void CreateRoute(const MediaSource::Id& source_id,
43 const MediaSink::Id& sink_id, 45 const MediaSink::Id& sink_id,
44 const MediaRouteResponseCallback& callback) = 0; 46 const MediaRouteResponseCallback& callback) = 0;
45 47
46 // Closes the media route specified by |route_id|. 48 // Closes the media route specified by |route_id|.
47 virtual void CloseRoute(const MediaRoute::Id& route_id) = 0; 49 virtual void CloseRoute(const MediaRoute::Id& route_id) = 0;
48 50
49 // Posts |message| to a MediaSink connected via MediaRoute with |route_id|. 51 // Posts |message| to a MediaSink connected via MediaRoute with |route_id|.
50 // TODO(imcheng): Support additional data types: Blob, ArrayBuffer, 52 // TODO(imcheng): Support additional data types: Blob, ArrayBuffer,
51 // ArrayBufferView. 53 // ArrayBufferView.
52 virtual void PostMessage(const MediaRoute::Id& route_id, 54 virtual void SendMessage(const MediaRoute::Id& route_id,
53 const std::string& message) = 0; 55 const std::string& message,
56 const SendMessageCallback& callback) = 0;
54 57
55 // Clears the issue with the id |issue_id|. 58 // Clears the issue with the id |issue_id|.
56 virtual void ClearIssue(const Issue::Id& issue_id) = 0; 59 virtual void ClearIssue(const Issue::Id& issue_id) = 0;
57 60
58 // Receives updates from a MediaRouter instance. 61 // Receives updates from a MediaRouter instance.
59 class Delegate { 62 class Delegate {
60 public: 63 public:
61 // Called when there is a message from a route. 64 // Called when there is a message from a route.
62 // |route_id|: The route ID. 65 // |route_id|: The route ID.
63 // |message|: The message. 66 // |message|: The message.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // in undefined behavior. 109 // in undefined behavior.
107 virtual void AddIssuesObserver(IssuesObserver* observer) = 0; 110 virtual void AddIssuesObserver(IssuesObserver* observer) = 0;
108 111
109 // Removes the IssuesObserver |observer|. 112 // Removes the IssuesObserver |observer|.
110 virtual void RemoveIssuesObserver(IssuesObserver* observer) = 0; 113 virtual void RemoveIssuesObserver(IssuesObserver* observer) = 0;
111 }; 114 };
112 115
113 } // namespace media_router 116 } // namespace media_router
114 117
115 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ 118 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/router/media_router.mojom » ('j') | chrome/browser/media/router/media_router.mojom » ('J')

Powered by Google App Engine
This is Rietveld 408576698