Skip to content

Commit

Permalink
Revert "Add RemotingAppLauncher and DefaultRemotingApp"
Browse files Browse the repository at this point in the history
This reverts commit 43dcbdf.

Reason for revert: 902871

Original change's description:
> Add RemotingAppLauncher and DefaultRemotingApp
> 
> The RemotingAppLauncher instantiates RemotingApps at runtime. It uses
> the app manifest to find class names of RemotingApps, and loads them via
> reflection.
> 
> The DefaultRemotingApp is a simple wrapper around the default media
> receiver application.
> 
> Bug: 790766
> Change-Id: I01f51ebe90de361b947d67fe904a2faddc35f5de
> Reviewed-on: https://chromium-review.googlesource.com/c/1306778
> Reviewed-by: Zhiqiang Zhang <zqzhang@chromium.org>
> Reviewed-by: David Trainor <dtrainor@chromium.org>
> Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#605389}

TBR=dtrainor@chromium.org,zqzhang@chromium.org,tguilbert@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 790766
Change-Id: I3995a570a71923053711bb1ea491f9d24521fdea
Reviewed-on: https://chromium-review.googlesource.com/c/1324194
Reviewed-by: Thomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606160}
  • Loading branch information
tguilbert-google authored and Commit Bot committed Nov 7, 2018
1 parent 09760ce commit cb04d0b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 207 deletions.
2 changes: 0 additions & 2 deletions chrome/android/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1165,8 +1165,6 @@ android:value="true" />
controllers with its own list. -->
<meta-data android:name="org.chromium.content.browser.REMOTE_MEDIA_PLAYERS"
android:value="org.chromium.chrome.browser.media.remote.DefaultMediaRouteController"/>
<meta-data android:name="org.chromium.content.browser.REMOTE_PLAYBACK_APPS"
android:value="org.chromium.chrome.browser.media.router.cast.remoting.DefaultRemotingApp"/>

{% endblock %}
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ public void onConnected(Bundle connectionHint) {
if (mState == State.API_CONNECTION_SUSPENDED) return;

try {
launchApplication(mApiClient, mSource.getApplicationId(), true).setResultCallback(this);
launchApplication(mApiClient, mSource.getApplicationId(), true)
.setResultCallback(this);
mState = State.LAUNCHING_APPLICATION;
} catch (Exception e) {
// Do not log appId, as it can contain appIds overriden in downstream code that must not
// be leaked
Log.e(TAG, "Launch application failed", e);
Log.e(TAG, "Launch application failed: %s", mSource.getApplicationId(), e);
reportError();
}
}
Expand Down Expand Up @@ -210,10 +209,8 @@ public void onResult(Cast.ApplicationConnectionResult result) {

Status status = result.getStatus();
if (!status.isSuccess()) {
// Do not log appId, as it can contain appIds overriden in downstream code that must not
// be leaked
Log.e(TAG, "Launch application failed with status: %d, %s", status.getStatusCode(),
status.getStatusMessage());
Log.e(TAG, "Launch application failed with status: %s, %d, %s",
mSource.getApplicationId(), status.getStatusCode(), status.getStatusMessage());
reportError();
return;
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class RemotingMediaSource implements MediaSource {
/**
* The Cast application id.
*/
private String mApplicationId = null;
private final String mApplicationId;

/**
* The URL to fling to the Cast device.
Expand Down Expand Up @@ -61,7 +61,9 @@ public static RemotingMediaSource from(String sourceId) {
return null;
}

return new RemotingMediaSource(sourceId, mediaUrl);
// TODO(avayvod): check the content URL and override the app id if needed.
String applicationId = CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID;
return new RemotingMediaSource(sourceId, applicationId, mediaUrl);
}

/**
Expand All @@ -73,7 +75,7 @@ public static RemotingMediaSource from(String sourceId) {
@Override
public MediaRouteSelector buildRouteSelector() {
return new MediaRouteSelector.Builder()
.addControlCategory(CastMediaControlIntent.categoryForCast(getApplicationId()))
.addControlCategory(CastMediaControlIntent.categoryForCast(mApplicationId))
.build();
}

Expand All @@ -82,12 +84,6 @@ public MediaRouteSelector buildRouteSelector() {
*/
@Override
public String getApplicationId() {
if (mApplicationId == null) {
RemotingAppLauncher.RemotingApp app =
RemotingAppLauncher.instance().getRemotingApp(this);

mApplicationId = (app != null) ? app.getApplicationId() : "";
}
return mApplicationId;
}

Expand All @@ -106,8 +102,9 @@ public String getMediaUrl() {
return mMediaUrl;
}

private RemotingMediaSource(String sourceId, String mediaUrl) {
private RemotingMediaSource(String sourceId, String applicationId, String mediaUrl) {
mSourceId = sourceId;
mApplicationId = applicationId;
mMediaUrl = mediaUrl;
}
}
2 changes: 0 additions & 2 deletions chrome/android/java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/media/router/cast/CastSessionInfo.java",
"java/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManager.java",
"java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java",
"java/src/org/chromium/chrome/browser/media/router/cast/remoting/DefaultRemotingApp.java",
"java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingAppLauncher.java",
"java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingCastSession.java",
"java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java",
"java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaSource.java",
Expand Down

0 comments on commit cb04d0b

Please sign in to comment.