| Index: chrome/browser/media/android/router/media_router_dialog_controller_android.cc
|
| diff --git a/chrome/browser/media/android/router/media_router_dialog_controller_android.cc b/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
|
| index df69aee6de84716f6737817aedd58aa87f745f85..19cefff6b99ea88c8662e9c515da2ebcf6111cad 100644
|
| --- a/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
|
| +++ b/chrome/browser/media/android/router/media_router_dialog_controller_android.cc
|
| @@ -89,9 +89,7 @@ void MediaRouterDialogControllerAndroid::CancelPresentationRequest() {
|
|
|
| MediaRouterDialogControllerAndroid::MediaRouterDialogControllerAndroid(
|
| WebContents* web_contents)
|
| - : MediaRouterDialogController(web_contents),
|
| - MediaRoutesObserver(MediaRouterFactory::GetApiForBrowserContext(
|
| - initiator()->GetBrowserContext())) {
|
| + : MediaRouterDialogController(web_contents) {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| java_dialog_controller_.Reset(Java_ChromeMediaRouterDialogController_create(
|
| env,
|
| @@ -120,11 +118,14 @@ void MediaRouterDialogControllerAndroid::CreateMediaRouterDialog() {
|
| // TODO(avayvod): maybe this logic should be in
|
| // PresentationServiceDelegateImpl: if the route exists for the same frame
|
| // and tab, show the route controller dialog, if not, show the device picker.
|
| - if (single_existing_route_.get() &&
|
| - single_existing_route_->media_source().id() == source_id) {
|
| + MediaRouterAndroid* router = static_cast<MediaRouterAndroid*>(
|
| + MediaRouterFactory::GetApiForBrowserContext(
|
| + initiator()->GetBrowserContext()));
|
| + const MediaRoute* matching_route = router->FindRouteBySource(source_id);
|
| + if (matching_route) {
|
| ScopedJavaLocalRef<jstring> jmedia_route_id =
|
| base::android::ConvertUTF8ToJavaString(
|
| - env, single_existing_route_->media_route_id());
|
| + env, matching_route->media_route_id());
|
|
|
| Java_ChromeMediaRouterDialogController_openRouteControllerDialog(
|
| env, java_dialog_controller_.obj(), jsource_urn.obj(),
|
| @@ -149,20 +150,5 @@ bool MediaRouterDialogControllerAndroid::IsShowingMediaRouterDialog() const {
|
| env, java_dialog_controller_.obj());
|
| }
|
|
|
| -void MediaRouterDialogControllerAndroid::OnRoutesUpdated(
|
| - const std::vector<MediaRoute>& routes) {
|
| - if (routes.size() != 1) {
|
| - single_existing_route_.reset();
|
| - return;
|
| - }
|
| -
|
| - if (single_existing_route_.get() &&
|
| - single_existing_route_->media_route_id() == routes[0].media_route_id()) {
|
| - return;
|
| - }
|
| -
|
| - single_existing_route_.reset(new MediaRoute(routes[0]));
|
| -}
|
| -
|
| } // namespace media_router
|
|
|
|
|