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

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

Issue 1228863005: [MediaRouter] The minimal change to make everything build on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the include for MediaRouterDialogControllerImpl Created 5 years, 5 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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "chrome/browser/media/router/issue.h" 12 #include "chrome/browser/media/router/issue.h"
13 #include "chrome/browser/media/router/media_route.h" 13 #include "chrome/browser/media/router/media_route.h"
14 #include "chrome/browser/media/router/media_sink.h" 14 #include "chrome/browser/media/router/media_sink.h"
15 #include "chrome/browser/media/router/media_source.h" 15 #include "chrome/browser/media/router/media_source.h"
16 #include "components/keyed_service/core/keyed_service.h"
16 #include "content/public/browser/presentation_session_message.h" 17 #include "content/public/browser/presentation_session_message.h"
17 18
18 namespace media_router { 19 namespace media_router {
19 20
20 class IssuesObserver; 21 class IssuesObserver;
21 class MediaRoutesObserver; 22 class MediaRoutesObserver;
22 class MediaSinksObserver; 23 class MediaSinksObserver;
23 24
24 // Type of callback used in |CreateRoute()|. Callback is invoked when the 25 // Type of callback used in |CreateRoute()|. Callback is invoked when the
25 // route request either succeeded or failed. 26 // route request either succeeded or failed.
26 // The first argument is the route created. If the route request failed, this 27 // The first argument is the route created. If the route request failed, this
27 // will be a nullptr. 28 // will be a nullptr.
28 // The second argument is the error string, which will be nonempty if the route 29 // The second argument is the error string, which will be nonempty if the route
29 // request failed. 30 // request failed.
30 using MediaRouteResponseCallback = 31 using MediaRouteResponseCallback =
31 base::Callback<void(const MediaRoute*, const std::string&)>; 32 base::Callback<void(const MediaRoute*, const std::string&)>;
32 33
33 // Used in cases where a tab ID is not applicable in CreateRoute/JoinRoute. 34 // Used in cases where a tab ID is not applicable in CreateRoute/JoinRoute.
34 const int kInvalidTabId = -1; 35 const int kInvalidTabId = -1;
35 36
36 // An interface for handling resources related to media routing. 37 // An interface for handling resources related to media routing.
37 // Responsible for registering observers for receiving sink availability 38 // Responsible for registering observers for receiving sink availability
38 // updates, handling route requests/responses, and operating on routes (e.g. 39 // updates, handling route requests/responses, and operating on routes (e.g.
39 // posting messages or closing). 40 // posting messages or closing).
40 class MediaRouter { 41 class MediaRouter : public KeyedService {
41 public: 42 public:
42 using PresentationSessionMessageCallback = base::Callback<void( 43 using PresentationSessionMessageCallback = base::Callback<void(
43 scoped_ptr<ScopedVector<content::PresentationSessionMessage>>)>; 44 scoped_ptr<ScopedVector<content::PresentationSessionMessage>>)>;
44 using SendRouteMessageCallback = base::Callback<void(bool sent)>; 45 using SendRouteMessageCallback = base::Callback<void(bool sent)>;
45 46
46 virtual ~MediaRouter() {} 47 ~MediaRouter() override = default;
47 48
48 // Creates a media route from |source_id| to |sink_id|. 49 // Creates a media route from |source_id| to |sink_id|.
49 // |origin| is the URL of requestor's page. 50 // |origin| is the URL of requestor's page.
50 // |tab_id| is the ID of the tab in which the request was made. 51 // |tab_id| is the ID of the tab in which the request was made.
51 // |origin| and |tab_id| are used for enforcing same-origin and/or same-tab 52 // |origin| and |tab_id| are used for enforcing same-origin and/or same-tab
52 // scope for JoinRoute() requests. (e.g., if enforced, the page 53 // scope for JoinRoute() requests. (e.g., if enforced, the page
53 // requesting JoinRoute() must have the same origin as the page that requested 54 // requesting JoinRoute() must have the same origin as the page that requested
54 // CreateRoute()). 55 // CreateRoute()).
55 // The caller may pass in|kInvalidTabId| if tab is not applicable. 56 // The caller may pass in|kInvalidTabId| if tab is not applicable.
56 // Each callback in |callbacks| is invoked with a response indicating 57 // Each callback in |callbacks| is invoked with a response indicating
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // in undefined behavior. 140 // in undefined behavior.
140 virtual void RegisterIssuesObserver(IssuesObserver* observer) = 0; 141 virtual void RegisterIssuesObserver(IssuesObserver* observer) = 0;
141 142
142 // Removes the IssuesObserver |observer|. 143 // Removes the IssuesObserver |observer|.
143 virtual void UnregisterIssuesObserver(IssuesObserver* observer) = 0; 144 virtual void UnregisterIssuesObserver(IssuesObserver* observer) = 0;
144 }; 145 };
145 146
146 } // namespace media_router 147 } // namespace media_router
147 148
148 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ 149 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698