| 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_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ | 5 #ifndef CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ |
| 6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ | 6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 | 31 |
| 32 // Callback from MediaRouter when a response to a media route request is | 32 // Callback from MediaRouter when a response to a media route request is |
| 33 // received. | 33 // received. |
| 34 void OnRouteResponseReceived(const RouteRequestResult& result); | 34 void OnRouteResponseReceived(const RouteRequestResult& result); |
| 35 | 35 |
| 36 // Initializes |observer_| to listen for sinks compatible with |source|, | 36 // Initializes |observer_| to listen for sinks compatible with |source|, |
| 37 // finds sink with name matching receiver_, and establishes media | 37 // finds sink with name matching receiver_, and establishes media |
| 38 // route between the source and sink. | 38 // route between the source and sink. |
| 39 // |observer_| and |route_id_| will be initialized. | 39 // |observer_| and |route_id_| will be initialized. |
| 40 // |origin| is the URL of requestor's page. | |
| 41 // |web_contents| identifies the tab in which the request was made. | 40 // |web_contents| identifies the tab in which the request was made. |
| 42 // |origin| and |web_contents| are used for enforcing same-origin and/or | 41 // |source| and |web_contents| are used for enforcing same-origin and/or |
| 43 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page | 42 // same-tab scope for JoinRoute() requests. (e.g., if enforced, the page |
| 44 // requesting JoinRoute() must have the same origin as the page that | 43 // requesting JoinRoute() must have the same origin as the page that |
| 45 // requested CreateRoute()). | 44 // requested CreateRoute()). |
| 46 void CreateMediaRoute(const MediaSource& source, | 45 void CreateMediaRoute(const MediaSource& source, |
| 47 const GURL& origin, | |
| 48 content::WebContents* web_contents); | 46 content::WebContents* web_contents); |
| 49 | 47 |
| 50 // Stops the established media route and unregisters |observer_|. | 48 // Stops the established media route and unregisters |observer_|. |
| 51 // Note that the route may not be stopped immediately, as it makes an | 49 // Note that the route may not be stopped immediately, as it makes an |
| 52 // async call to the Media Route Provider. | 50 // async call to the Media Route Provider. |
| 53 // |observer_| and |route_id_| will be reset. | 51 // |observer_| and |route_id_| will be reset. |
| 54 void StopMediaRoute(); | 52 void StopMediaRoute(); |
| 55 | 53 |
| 56 bool IsSinkDiscovered() const; | 54 bool IsSinkDiscovered() const; |
| 57 bool IsRouteCreated() const; | 55 bool IsRouteCreated() const; |
| 58 | 56 |
| 59 void OpenMediaPage(); | 57 void OpenMediaPage(); |
| 60 | 58 |
| 61 private: | 59 private: |
| 62 MediaRouter* media_router_; | 60 MediaRouter* media_router_; |
| 63 scoped_ptr<TestMediaSinksObserver> observer_; | 61 scoped_ptr<TestMediaSinksObserver> observer_; |
| 64 MediaRoute::Id route_id_; | 62 MediaRoute::Id route_id_; |
| 65 }; | 63 }; |
| 66 | 64 |
| 67 } // namespace media_router | 65 } // namespace media_router |
| 68 | 66 |
| 69 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ | 67 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ |
| OLD | NEW |