OLD | NEW |
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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // updates, handling route requests/responses, and operating on routes (e.g. | 58 // updates, handling route requests/responses, and operating on routes (e.g. |
59 // posting messages or closing). | 59 // posting messages or closing). |
60 // TODO(imcheng): Reduce number of parameters by putting them into structs. | 60 // TODO(imcheng): Reduce number of parameters by putting them into structs. |
61 class MediaRouter : public KeyedService { | 61 class MediaRouter : public KeyedService { |
62 public: | 62 public: |
63 using SendRouteMessageCallback = base::Callback<void(bool sent)>; | 63 using SendRouteMessageCallback = base::Callback<void(bool sent)>; |
64 | 64 |
65 ~MediaRouter() override = default; | 65 ~MediaRouter() override = default; |
66 | 66 |
67 // Creates a media route from |source_id| to |sink_id|. | 67 // Creates a media route from |source_id| to |sink_id|. |
68 // |origin| is the URL of requestor's page. | 68 // |origin| is the origin of requestor's page. |
69 // |web_contents| is the WebContents of the tab in which the request was made. | 69 // |web_contents| is the WebContents of the tab in which the request was made. |
70 // |origin| and |web_contents| are used for enforcing same-origin and/or | 70 // |origin| and |web_contents| are used for enforcing same-origin and/or |
71 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page | 71 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page |
72 // requesting JoinRoute() must have the same origin as the page that requested | 72 // requesting JoinRoute() must have the same origin as the page that requested |
73 // CreateRoute()). | 73 // CreateRoute()). |
74 // The caller may pass in nullptr for |web_contents| if tab is not applicable. | 74 // The caller may pass in nullptr for |web_contents| if tab is not applicable. |
75 // Each callback in |callbacks| is invoked with a response indicating | 75 // Each callback in |callbacks| is invoked with a response indicating |
76 // success or failure, in the order they are listed. | 76 // success or failure, in the order they are listed. |
77 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked | 77 // If |timeout| is positive, then any un-invoked |callbacks| will be invoked |
78 // with a timeout error after the timeout expires. | 78 // with a timeout error after the timeout expires. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 // Unregisters a previously registered RouteMessagesObserver. |observer| will | 240 // Unregisters a previously registered RouteMessagesObserver. |observer| will |
241 // stop receiving further updates. | 241 // stop receiving further updates. |
242 virtual void UnregisterRouteMessageObserver( | 242 virtual void UnregisterRouteMessageObserver( |
243 RouteMessageObserver* observer) = 0; | 243 RouteMessageObserver* observer) = 0; |
244 }; | 244 }; |
245 | 245 |
246 } // namespace media_router | 246 } // namespace media_router |
247 | 247 |
248 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ | 248 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_H_ |
OLD | NEW |