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

Unified Diff: chrome/browser/media/android/router/media_router_dialog_controller_android.cc

Issue 1534553002: [Cast, Android, Presentation API] Fix the logic for showing controller vs chooser dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-join
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/android/router/media_router_dialog_controller_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 86ab93287f5e68b19b85c9ff481fec800077f72e..cd153f6181d9039383005565476b1ad0891bc00f 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
@@ -93,9 +93,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,
@@ -124,11 +122,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(),
@@ -153,20 +154,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
« no previous file with comments | « chrome/browser/media/android/router/media_router_dialog_controller_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698