зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1c4cdf7294f4 (bug 1021443) until its dependent refactoring lands.
This commit is contained in:
Родитель
b7bf28a4e9
Коммит
33be465c4e
|
@ -5,6 +5,33 @@
|
|||
|
||||
package org.mozilla.gecko.webapp;
|
||||
|
||||
import org.mozilla.gecko.ActivityHandlerHelper;
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.favicons.decoders.FaviconDecoder;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.util.ActivityResultHandler;
|
||||
import org.mozilla.gecko.EventDispatcher;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.NativeEventListener;
|
||||
import org.mozilla.gecko.util.NativeJSObject;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.WebappAllocator;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -13,25 +40,6 @@ import java.util.Set;
|
|||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.ActivityHandlerHelper;
|
||||
import org.mozilla.gecko.EventDispatcher;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.util.ActivityResultHandler;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.NativeEventListener;
|
||||
import org.mozilla.gecko.util.NativeJSObject;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
public class EventListener implements NativeEventListener {
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@ import org.mozilla.gecko.GeckoAppShell;
|
|||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.NativeEventListener;
|
||||
import org.mozilla.gecko.util.NativeJSObject;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -29,7 +27,7 @@ import android.graphics.Bitmap;
|
|||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
public class InstallHelper implements NativeEventListener {
|
||||
public class InstallHelper implements GeckoEventListener {
|
||||
private static final String LOGTAG = "GeckoWebappInstallHelper";
|
||||
private static final String[] INSTALL_EVENT_NAMES = new String[] {"Webapps:Postinstall"};
|
||||
private final Context mContext;
|
||||
|
@ -38,7 +36,7 @@ public class InstallHelper implements NativeEventListener {
|
|||
|
||||
public static interface InstallCallback {
|
||||
// on the GeckoThread
|
||||
void installCompleted(InstallHelper installHelper, String event, NativeJSObject message);
|
||||
void installCompleted(InstallHelper installHelper, String event, JSONObject message);
|
||||
|
||||
// on the GeckoBackgroundThread
|
||||
void installErrored(InstallHelper installHelper, Exception exception);
|
||||
|
@ -164,7 +162,7 @@ public class InstallHelper implements NativeEventListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, NativeJSObject message, EventCallback callback) {
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener(this, INSTALL_EVENT_NAMES);
|
||||
|
||||
if (mCallback != null) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.mozilla.gecko.GeckoThread;
|
|||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Tab;
|
||||
import org.mozilla.gecko.Tabs;
|
||||
import org.mozilla.gecko.util.NativeJSObject;
|
||||
import org.mozilla.gecko.webapp.InstallHelper.InstallCallback;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@ -326,13 +325,13 @@ public class WebappImpl extends GeckoApp implements InstallCallback {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void installCompleted(InstallHelper installHelper, String event, NativeJSObject message) {
|
||||
public void installCompleted(InstallHelper installHelper, String event, JSONObject message) {
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.equals("Webapps:Postinstall")) {
|
||||
String origin = message.optString("origin", null);
|
||||
String origin = message.optString("origin");
|
||||
launchWebapp(origin);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче