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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java

Issue 1883423002: [Android,MediaRouter,Cast] implement onterminate and onclose. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable more disabled tests Created 4 years, 8 months 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
Index: chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java
index ce4a2beca4dec668dc7bddfb851efabf3ff2da83..7139eaa8ac0fee35cc997289273e579ea58ae021 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java
@@ -38,13 +38,6 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
private static final int STATE_LAUNCH_SUCCEEDED = 4;
private static final int STATE_TERMINATED = 5;
- private static final String ERROR_NEW_ROUTE_LAUNCH_APPLICATION_FAILED =
- "Launch application failed: %s, %s";
- private static final String ERROR_NEW_ROUTE_LAUNCH_APPLICATION_FAILED_STATUS =
- "Launch application failed with status: %s, %d, %s";
- private static final String ERROR_NEW_ROUTE_CLIENT_CONNECTION_FAILED =
- "GoogleApiClient connection failed: %d, %b";
-
private class CastListener extends Cast.Listener {
private CastSession mSession;
@@ -195,8 +188,8 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
.setResultCallback(this);
mState = STATE_LAUNCHING_APPLICATION;
} catch (Exception e) {
- reportError(String.format(ERROR_NEW_ROUTE_LAUNCH_APPLICATION_FAILED,
- mSource.getApplicationId(), e));
+ Log.e(TAG, "Launch application failed: %s", mSource.getApplicationId(), e);
+ reportError();
}
}
@@ -216,11 +209,9 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
Status status = result.getStatus();
if (!status.isSuccess()) {
- reportError(String.format(
- ERROR_NEW_ROUTE_LAUNCH_APPLICATION_FAILED_STATUS,
- mSource.getApplicationId(),
- status.getStatusCode(),
- status.getStatusMessage()));
+ Log.e(TAG, "Launch application failed with status: %s, %d, %s",
+ mSource.getApplicationId(), status.getStatusCode(), status.getStatusMessage());
+ reportError();
}
mState = STATE_LAUNCH_SUCCEEDED;
@@ -233,10 +224,9 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
public void onConnectionFailed(ConnectionResult result) {
if (mState != STATE_CONNECTING_TO_API) throwInvalidState();
- reportError(String.format(
- ERROR_NEW_ROUTE_CLIENT_CONNECTION_FAILED,
- result.getErrorCode(),
- result.hasResolution()));
+ Log.e(TAG, "GoogleApiClient connection failed: %d, %b",
+ result.getErrorCode(), result.hasResolution());
+ reportError();
}
private GoogleApiClient createApiClient(Cast.Listener listener, Context context) {
@@ -283,11 +273,11 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
terminate();
}
- private void reportError(String message) {
+ private void reportError() {
if (mState == STATE_TERMINATED) throwInvalidState();
assert mRouteProvider != null;
- mRouteProvider.onRouteRequestError(message, mRequestId);
+ mRouteProvider.onLaunchError();
terminate();
}

Powered by Google App Engine
This is Rietveld 408576698