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

Unified Diff: web_apks/minting_example/src/org/chromium/minting/MintingServiceFactory.java

Issue 1888773004: 🙅 Bind a WebAPK to its "host" browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add template apk 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: web_apks/minting_example/src/org/chromium/minting/MintingServiceFactory.java
diff --git a/web_apks/minting_example/src/org/chromium/minting/MintingServiceFactory.java b/web_apks/minting_example/src/org/chromium/minting/MintingServiceFactory.java
index 8812c36c39853dbab4958862763fc32a551b279f..a1badbd04a5aa934ee7b6c8f1212886e3aa6eaed 100644
--- a/web_apks/minting_example/src/org/chromium/minting/MintingServiceFactory.java
+++ b/web_apks/minting_example/src/org/chromium/minting/MintingServiceFactory.java
@@ -10,6 +10,8 @@ import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
+import org.chromium.minting.lib.common.WebAPKUtils;
+
import java.io.File;
import java.lang.reflect.Constructor;
@@ -31,10 +33,7 @@ public class MintingServiceFactory extends Service {
// TODO(pkotwicz): Add dex to application's ClassLoader. Only load dex the first time that
// {@link MintingServiceFactory#onBind()} is called.
- String remotePackageName = getSharedPreferences(MintingApplication.MINT_PREFS, MODE_PRIVATE)
- .getString(MintingApplication.HOST_PACKAGE_PREF,
- MintingApplication.DEFAULT_CHROME_PACKAGE_NAME);
- Context remoteContext = DexLoader.getRemoteContext(this, remotePackageName);
+ Context remoteContext = WebAPKUtils.getHostBrowserContext(this);
if (remoteContext == null) {
Log.w(TAG, "Failed to get remote context.");
}
@@ -50,9 +49,10 @@ public class MintingServiceFactory extends Service {
}
try {
+
Class<?> mintedServiceImplClass =
webApkClassLoader.loadClass(MINTED_SERVICE_IMPL_CLASS_NAME);
- Constructor mintedServiceImplConstructor =
+ Constructor<?> mintedServiceImplConstructor =
mintedServiceImplClass.getConstructor(Context.class);
return (IBinder) mintedServiceImplConstructor.newInstance(new Object[] {this});
} catch (Exception e) {

Powered by Google App Engine
This is Rietveld 408576698