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

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

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 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 7b7736e430d7d70d440526e8155130b78dbcb1d9..ed6bafeea171b1422802641f910f75e2ed6a3a16 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
@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.media.router.cast;
import android.annotation.SuppressLint;
-import android.content.Context;
import android.os.Bundle;
import com.google.android.gms.cast.ApplicationMetadata;
@@ -18,6 +17,7 @@ import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
+import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.chrome.browser.media.router.ChromeMediaRouter;
import org.chromium.chrome.browser.media.router.MediaRoute;
@@ -164,15 +164,11 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
/**
* Starts the process of launching the application on the Cast device.
- * @param applicationContext application context
- * implementation provided by the caller.
*/
- public void start(Context applicationContext) {
- assert applicationContext != null;
-
+ public void start() {
if (mState != STATE_IDLE) throwInvalidState();
- mApiClient = createApiClient(mCastListener, applicationContext);
+ mApiClient = createApiClient(mCastListener);
mApiClient.connect();
mState = STATE_CONNECTING_TO_API;
}
@@ -233,13 +229,13 @@ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks,
reportError();
}
- private GoogleApiClient createApiClient(Cast.Listener listener, Context context) {
+ private GoogleApiClient createApiClient(Cast.Listener listener) {
Cast.CastOptions.Builder apiOptionsBuilder =
new Cast.CastOptions.Builder(mSink.getDevice(), listener)
// TODO(avayvod): hide this behind the flag or remove
.setVerboseLoggingEnabled(true);
- return new GoogleApiClient.Builder(context)
+ return new GoogleApiClient.Builder(ContextUtils.getApplicationContext())
.addApi(Cast.API, apiOptionsBuilder.build())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)

Powered by Google App Engine
This is Rietveld 408576698