зеркало из https://github.com/mozilla/gecko-dev.git
bug 958358 - make webapp capitalisation consistent; r=wesj
--HG-- rename : mobile/android/base/WebApp.java.in => mobile/android/base/Webapp.java.in rename : mobile/android/base/WebAppAllocator.java => mobile/android/base/WebappAllocator.java rename : mobile/android/base/WebAppFragmentRepeater.inc => mobile/android/base/WebappFragmentRepeater.inc rename : mobile/android/base/WebAppImpl.java => mobile/android/base/WebappImpl.java rename : mobile/android/base/WebAppManifestFragment.xml.frag.in => mobile/android/base/WebappManifestFragment.xml.frag.in rename : mobile/android/base/WebAppsFragment.java.frag => mobile/android/base/WebappsFragment.java.frag rename : mobile/android/base/webapp/WebAppImpl.java => mobile/android/base/webapp/WebappImpl.java rename : mobile/android/chrome/content/WebAppRT.js => mobile/android/chrome/content/WebappRT.js
This commit is contained in:
Родитель
a729acfc4a
Коммит
becdd19ff7
|
@ -179,13 +179,13 @@
|
|||
</receiver>
|
||||
#endif
|
||||
|
||||
<activity android:name=".WebApp"
|
||||
<activity android:name=".Webapp"
|
||||
android:label="@string/webapp_generic_name"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize"
|
||||
android:windowSoftInputMode="stateUnspecified|adjustResize"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity="org.mozilla.gecko.WEBAPP"
|
||||
android:process=":@ANDROID_PACKAGE_NAME@.WebApp"
|
||||
android:process=":@ANDROID_PACKAGE_NAME@.Webapp"
|
||||
android:excludeFromRecents="true"
|
||||
android:theme="@style/Gecko.App">
|
||||
<intent-filter>
|
||||
|
@ -196,13 +196,13 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Declare a predefined number of WebApp<num> activities. These are
|
||||
<!-- Declare a predefined number of Webapp<num> activities. These are
|
||||
used so that each web app can launch in its own process. Keep
|
||||
this number in sync with the total number of web apps handled in
|
||||
WebAppAllocator. -->
|
||||
WebappAllocator. -->
|
||||
|
||||
#define FRAGMENT WebAppManifestFragment.xml.frag.in
|
||||
#include WebAppFragmentRepeater.inc
|
||||
#define FRAGMENT WebappManifestFragment.xml.frag.in
|
||||
#include WebappFragmentRepeater.inc
|
||||
|
||||
<!-- Masquerade as the Resolver so that we can be opened from the Marketplace. -->
|
||||
<activity-alias
|
||||
|
|
|
@ -2715,7 +2715,7 @@ public abstract class GeckoApp
|
|||
}
|
||||
|
||||
protected boolean getIsDebuggable() {
|
||||
// Return false so Fennec doesn't appear to be debuggable. WebAppImpl
|
||||
// Return false so Fennec doesn't appear to be debuggable. WebappImpl
|
||||
// then overrides this and returns the value of android:debuggable for
|
||||
// the webapp APK, so webapps get the behavior supported by this method
|
||||
// (i.e. automatic configuration and enabling of the remote debugger).
|
||||
|
|
|
@ -720,7 +720,7 @@ public class GeckoAppShell
|
|||
gRestartScheduled = true;
|
||||
}
|
||||
|
||||
public static Intent getWebAppIntent(String aURI, String aOrigin, String aTitle, Bitmap aIcon) {
|
||||
public static Intent getWebappIntent(String aURI, String aOrigin, String aTitle, Bitmap aIcon) {
|
||||
Intent intent;
|
||||
|
||||
if (AppConstants.MOZ_ANDROID_SYNTHAPKS) {
|
||||
|
@ -738,21 +738,21 @@ public class GeckoAppShell
|
|||
} else {
|
||||
int index;
|
||||
if (aIcon != null && !TextUtils.isEmpty(aTitle))
|
||||
index = WebAppAllocator.getInstance(getContext()).findAndAllocateIndex(aOrigin, aTitle, aIcon);
|
||||
index = WebappAllocator.getInstance(getContext()).findAndAllocateIndex(aOrigin, aTitle, aIcon);
|
||||
else
|
||||
index = WebAppAllocator.getInstance(getContext()).getIndexForApp(aOrigin);
|
||||
index = WebappAllocator.getInstance(getContext()).getIndexForApp(aOrigin);
|
||||
|
||||
if (index == -1)
|
||||
return null;
|
||||
|
||||
intent = getWebAppIntent(index, aURI);
|
||||
intent = getWebappIntent(index, aURI);
|
||||
}
|
||||
|
||||
return intent;
|
||||
}
|
||||
|
||||
// The old implementation of getWebAppIntent. Not used by MOZ_ANDROID_SYNTHAPKS.
|
||||
public static Intent getWebAppIntent(int aIndex, String aURI) {
|
||||
// The old implementation of getWebappIntent. Not used by MOZ_ANDROID_SYNTHAPKS.
|
||||
public static Intent getWebappIntent(int aIndex, String aURI) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(GeckoApp.ACTION_WEBAPP_PREFIX + aIndex);
|
||||
intent.setData(Uri.parse(aURI));
|
||||
|
@ -807,7 +807,7 @@ public class GeckoAppShell
|
|||
// The intent to be launched by the shortcut.
|
||||
Intent shortcutIntent;
|
||||
if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
|
||||
shortcutIntent = getWebAppIntent(aURI, aUniqueURI, aTitle, aIcon);
|
||||
shortcutIntent = getWebappIntent(aURI, aUniqueURI, aTitle, aIcon);
|
||||
} else {
|
||||
shortcutIntent = new Intent();
|
||||
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
|
||||
|
@ -844,7 +844,7 @@ public class GeckoAppShell
|
|||
// the intent to be launched by the shortcut
|
||||
Intent shortcutIntent;
|
||||
if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
|
||||
shortcutIntent = getWebAppIntent(aURI, aUniqueURI, "", null);
|
||||
shortcutIntent = getWebappIntent(aURI, aUniqueURI, "", null);
|
||||
if (shortcutIntent == null)
|
||||
return;
|
||||
} else {
|
||||
|
|
|
@ -44,7 +44,7 @@ DEFINES += \
|
|||
|
||||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
WebAppManifestFragment.xml.frag \
|
||||
WebappManifestFragment.xml.frag \
|
||||
classes.dex \
|
||||
gecko.ap_ \
|
||||
res/values/strings.xml \
|
||||
|
@ -142,7 +142,7 @@ PP_JAVAFILES := $(filter-out $(gecko_package_dir)/R.java,$(gecko-mozglue_PP_JAVA
|
|||
|
||||
manifest := \
|
||||
AndroidManifest.xml.in \
|
||||
WebAppManifestFragment.xml.frag.in \
|
||||
WebappManifestFragment.xml.frag.in \
|
||||
$(NULL)
|
||||
|
||||
PP_TARGETS += manifest
|
||||
|
@ -220,7 +220,7 @@ res/values/strings.xml: FORCE
|
|||
|
||||
all_resources = \
|
||||
$(CURDIR)/AndroidManifest.xml \
|
||||
$(CURDIR)/WebAppManifestFragment.xml.frag \
|
||||
$(CURDIR)/WebappManifestFragment.xml.frag \
|
||||
$(android_res_files) \
|
||||
$(ANDROID_GENERATED_RESFILES) \
|
||||
$(NULL)
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
package @ANDROID_PACKAGE_NAME@;
|
||||
|
||||
/**
|
||||
* Declare a predefined number of WebApp<num> classes to the WebApps class.
|
||||
* Declare a predefined number of Webapp<num> classes to the Webapps class.
|
||||
* These are used so that each web app can launch in its own process. Keep this
|
||||
* number in sync with the number of web apps handled in WebAppAllocator.
|
||||
* number in sync with the number of web apps handled in WebappAllocator.
|
||||
*/
|
||||
public final class WebApps {
|
||||
#define FRAGMENT WebAppsFragment.java.frag
|
||||
#include WebAppFragmentRepeater.inc
|
||||
#define FRAGMENT WebappsFragment.java.frag
|
||||
#include WebappFragmentRepeater.inc
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
package @ANDROID_PACKAGE_NAME@;
|
||||
|
||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||
import org.mozilla.gecko.webapp.WebAppImpl;
|
||||
import org.mozilla.gecko.webapp.WebappImpl;
|
||||
#else
|
||||
import org.mozilla.gecko.WebAppImpl;
|
||||
import org.mozilla.gecko.WebappImpl;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This class serves only as a namespace wrapper for WebAppImpl.
|
||||
* This class serves only as a namespace wrapper for WebappImpl.
|
||||
*/
|
||||
public class WebApp extends WebAppImpl {}
|
||||
public class Webapp extends WebappImpl {}
|
|
@ -16,19 +16,19 @@ import android.util.Log;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WebAppAllocator {
|
||||
private final String LOGTAG = "GeckoWebAppAllocator";
|
||||
// The number of WebApp# and WEBAPP# activites/apps/intents
|
||||
public class WebappAllocator {
|
||||
private final String LOGTAG = "GeckoWebappAllocator";
|
||||
// The number of Webapp# and WEBAPP# activites/apps/intents
|
||||
private final static int MAX_WEB_APPS = 100;
|
||||
|
||||
protected static WebAppAllocator sInstance = null;
|
||||
public static WebAppAllocator getInstance() {
|
||||
protected static WebappAllocator sInstance = null;
|
||||
public static WebappAllocator getInstance() {
|
||||
return getInstance(GeckoAppShell.getContext());
|
||||
}
|
||||
|
||||
public static synchronized WebAppAllocator getInstance(Context cx) {
|
||||
public static synchronized WebappAllocator getInstance(Context cx) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new WebAppAllocator(cx);
|
||||
sInstance = new WebappAllocator(cx);
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
|
@ -36,7 +36,7 @@ public class WebAppAllocator {
|
|||
|
||||
SharedPreferences mPrefs;
|
||||
|
||||
protected WebAppAllocator(Context context) {
|
||||
protected WebappAllocator(Context context) {
|
||||
mPrefs = context.getSharedPreferences("webapps", Context.MODE_PRIVATE | Context.MODE_MULTI_PROCESS);
|
||||
}
|
||||
|
|
@ -26,8 +26,8 @@ import android.view.Display;
|
|||
import java.net.URL;
|
||||
import java.io.File;
|
||||
|
||||
public class WebAppImpl extends GeckoApp {
|
||||
private static final String LOGTAG = "GeckoWebAppImpl";
|
||||
public class WebappImpl extends GeckoApp {
|
||||
private static final String LOGTAG = "GeckoWebappImpl";
|
||||
|
||||
private URL mOrigin;
|
||||
private TextView mTitlebarText = null;
|
||||
|
@ -62,12 +62,12 @@ public class WebAppImpl extends GeckoApp {
|
|||
mTitlebarText = (TextView)findViewById(R.id.webapp_title);
|
||||
mTitlebar = findViewById(R.id.webapp_titlebar);
|
||||
if (!action.startsWith(ACTION_WEBAPP_PREFIX)) {
|
||||
Log.e(LOGTAG, "WebApp launch, but intent action is " + action + "!");
|
||||
Log.e(LOGTAG, "Webapp launch, but intent action is " + action + "!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to use the origin stored in the WebAppAllocator first
|
||||
String origin = WebAppAllocator.getInstance(this).getAppForIndex(getIndex());
|
||||
// Try to use the origin stored in the WebappAllocator first
|
||||
String origin = WebappAllocator.getInstance(this).getAppForIndex(getIndex());
|
||||
try {
|
||||
mOrigin = new URL(origin);
|
||||
} catch (java.net.MalformedURLException ex) {
|
||||
|
@ -90,11 +90,11 @@ public class WebAppImpl extends GeckoApp {
|
|||
protected void loadStartupTab(String uri) {
|
||||
String action = getIntent().getAction();
|
||||
if (GeckoApp.ACTION_WEBAPP_PREFIX.equals(action)) {
|
||||
// This action assumes the uri is not an installed WebApp. We will
|
||||
// use the WebAppAllocator to register the uri with an Android
|
||||
// This action assumes the uri is not an installed Webapp. We will
|
||||
// use the WebappAllocator to register the uri with an Android
|
||||
// process so it can run chromeless.
|
||||
int index = WebAppAllocator.getInstance(this).findAndAllocateIndex(uri, "App", (Bitmap) null);
|
||||
Intent appIntent = GeckoAppShell.getWebAppIntent(index, uri);
|
||||
int index = WebappAllocator.getInstance(this).findAndAllocateIndex(uri, "App", (Bitmap) null);
|
||||
Intent appIntent = GeckoAppShell.getWebappIntent(index, uri);
|
||||
startActivity(appIntent);
|
||||
finish();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class WebAppImpl extends GeckoApp {
|
|||
|
||||
// get the favicon dominant color, stored when the app was installed
|
||||
int[] colors = new int[2];
|
||||
int dominantColor = prefs.getInt(WebAppAllocator.iconKey(getIndex()), -1);
|
||||
int dominantColor = prefs.getInt(WebappAllocator.iconKey(getIndex()), -1);
|
||||
|
||||
// now lighten it, to ensure that the icon stands out in the center
|
||||
float[] f = new float[3];
|
||||
|
@ -144,7 +144,7 @@ public class WebAppImpl extends GeckoApp {
|
|||
protected String getDefaultProfileName() {
|
||||
String action = getIntent().getAction();
|
||||
if (!action.startsWith(ACTION_WEBAPP_PREFIX)) {
|
||||
Log.e(LOGTAG, "WebApp launch, but intent action is " + action + "!");
|
||||
Log.e(LOGTAG, "Webapp launch, but intent action is " + action + "!");
|
||||
return null;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
android:label="@string/webapp_generic_name"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize"
|
||||
android:windowSoftInputMode="stateUnspecified|adjustResize"
|
||||
android:process=":@ANDROID_PACKAGE_NAME@.WebApp@APPNUM@"
|
||||
android:process=":@ANDROID_PACKAGE_NAME@.Webapp@APPNUM@"
|
||||
android:theme="@style/Gecko.App"
|
||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||
android:launchMode="singleTop"
|
|
@ -1,4 +1,4 @@
|
|||
public static class WebApp@APPNUM@ extends WebApp {
|
||||
public static class WebApp@APPNUM@ extends Webapp {
|
||||
@Override
|
||||
protected int getIndex() { return @APPNUM@; }
|
||||
}
|
|
@ -349,9 +349,9 @@ gbjar.sources += [
|
|||
'webapp/InstallHelper.java',
|
||||
'webapp/InstallListener.java',
|
||||
'webapp/UninstallListener.java',
|
||||
'webapp/WebAppImpl.java',
|
||||
'WebAppAllocator.java',
|
||||
'WebAppImpl.java',
|
||||
'webapp/WebappImpl.java',
|
||||
'WebappAllocator.java',
|
||||
'WebappImpl.java',
|
||||
'widget/ActivityChooserModel.java',
|
||||
'widget/AllCapsTextView.java',
|
||||
'widget/AnimatedHeightLayout.java',
|
||||
|
@ -385,7 +385,7 @@ android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
|
|||
# R.java is handled even more specially than the others!
|
||||
gbjar.generated_sources += [ android_package_dir + f for f in [
|
||||
'/App.java',
|
||||
'/WebApp.java',
|
||||
'/Webapp.java',
|
||||
'/WebApps.java',
|
||||
] ]
|
||||
gbjar.generated_sources += [
|
||||
|
|
|
@ -18,12 +18,12 @@ import android.util.Log;
|
|||
|
||||
public class Allocator {
|
||||
|
||||
private final String LOGTAG = "GeckoWebAppAllocator";
|
||||
private final String LOGTAG = "GeckoWebappAllocator";
|
||||
|
||||
private static final String PREFIX_ORIGIN = "webapp-origin-";
|
||||
private static final String PREFIX_PACKAGE_NAME = "webapp-package-name-";
|
||||
|
||||
// The number of WebApp# and WEBAPP# activites/apps/intents
|
||||
// The number of Webapp# and WEBAPP# activities/apps/intents
|
||||
private final static int MAX_WEB_APPS = 100;
|
||||
|
||||
protected static Allocator sInstance = null;
|
||||
|
|
|
@ -21,7 +21,7 @@ import android.os.Environment;
|
|||
import android.util.Log;
|
||||
|
||||
public class ApkResources {
|
||||
private static final String LOGTAG = "GeckoWebAppApkResources";
|
||||
private static final String LOGTAG = "GeckoWebappApkResources";
|
||||
private final String mPackageName;
|
||||
private final ApplicationInfo mInfo;
|
||||
private final Context mContext;
|
||||
|
@ -58,7 +58,7 @@ public class ApkResources {
|
|||
}
|
||||
|
||||
public boolean isPackaged() {
|
||||
return "packaged".equals(getWebAppType());
|
||||
return "packaged".equals(getWebappType());
|
||||
}
|
||||
|
||||
public boolean isDebuggable() {
|
||||
|
@ -94,7 +94,7 @@ public class ApkResources {
|
|||
return info().loadIcon(mContext.getPackageManager());
|
||||
}
|
||||
|
||||
public String getWebAppType() {
|
||||
public String getWebappType() {
|
||||
return metadata().getString("webapp");
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.os.Bundle;
|
|||
import android.util.Log;
|
||||
|
||||
public class Dispatcher extends Activity {
|
||||
private static final String LOGTAG = "GeckoWebAppDispatcher";
|
||||
private static final String LOGTAG = "GeckoWebappDispatcher";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.mozilla.gecko.util.EventDispatcher;
|
|||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.GeckoEventResponder;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.WebAppAllocator;
|
||||
import org.mozilla.gecko.WebappAllocator;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
|
@ -40,7 +40,7 @@ import org.json.JSONObject;
|
|||
|
||||
public class EventListener implements GeckoEventListener, GeckoEventResponder {
|
||||
|
||||
private static final String LOGTAG = "GeckoWebAppEventListener";
|
||||
private static final String LOGTAG = "GeckoWebappEventListener";
|
||||
|
||||
private EventListener() { }
|
||||
|
||||
|
@ -63,55 +63,55 @@ public class EventListener implements GeckoEventListener, GeckoEventResponder {
|
|||
}
|
||||
|
||||
public static void registerEvents() {
|
||||
registerEventListener("WebApps:PreInstall");
|
||||
registerEventListener("WebApps:InstallApk");
|
||||
registerEventListener("WebApps:PostInstall");
|
||||
registerEventListener("WebApps:Open");
|
||||
registerEventListener("WebApps:Uninstall");
|
||||
registerEventListener("WebApps:GetApkVersions");
|
||||
registerEventListener("Webapps:Preinstall");
|
||||
registerEventListener("Webapps:InstallApk");
|
||||
registerEventListener("Webapps:Postinstall");
|
||||
registerEventListener("Webapps:Open");
|
||||
registerEventListener("Webapps:Uninstall");
|
||||
registerEventListener("Webapps:GetApkVersions");
|
||||
}
|
||||
|
||||
public static void unregisterEvents() {
|
||||
unregisterEventListener("WebApps:PreInstall");
|
||||
unregisterEventListener("WebApps:InstallApk");
|
||||
unregisterEventListener("WebApps:PostInstall");
|
||||
unregisterEventListener("WebApps:Open");
|
||||
unregisterEventListener("WebApps:Uninstall");
|
||||
unregisterEventListener("WebApps:GetApkVersions");
|
||||
unregisterEventListener("Webapps:Preinstall");
|
||||
unregisterEventListener("Webapps:InstallApk");
|
||||
unregisterEventListener("Webapps:Postinstall");
|
||||
unregisterEventListener("Webapps:Open");
|
||||
unregisterEventListener("Webapps:Uninstall");
|
||||
unregisterEventListener("Webapps:GetApkVersions");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (AppConstants.MOZ_ANDROID_SYNTHAPKS && event.equals("WebApps:InstallApk")) {
|
||||
if (AppConstants.MOZ_ANDROID_SYNTHAPKS && event.equals("Webapps:InstallApk")) {
|
||||
installApk(GeckoAppShell.getGeckoInterface().getActivity(), message.getString("filePath"), message.getString("data"));
|
||||
} else if (event.equals("WebApps:PostInstall")) {
|
||||
} else if (event.equals("Webapps:Postinstall")) {
|
||||
if (AppConstants.MOZ_ANDROID_SYNTHAPKS) {
|
||||
postInstallWebApp(message.getString("apkPackageName"), message.getString("origin"));
|
||||
postInstallWebapp(message.getString("apkPackageName"), message.getString("origin"));
|
||||
} else {
|
||||
postInstallWebApp(message.getString("name"),
|
||||
postInstallWebapp(message.getString("name"),
|
||||
message.getString("manifestURL"),
|
||||
message.getString("origin"),
|
||||
message.getString("iconURL"),
|
||||
message.getString("originalOrigin"));
|
||||
}
|
||||
} else if (event.equals("WebApps:Open")) {
|
||||
Intent intent = GeckoAppShell.getWebAppIntent(message.getString("manifestURL"),
|
||||
} else if (event.equals("Webapps:Open")) {
|
||||
Intent intent = GeckoAppShell.getWebappIntent(message.getString("manifestURL"),
|
||||
message.getString("origin"),
|
||||
"", null);
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
GeckoAppShell.getGeckoInterface().getActivity().startActivity(intent);
|
||||
} else if (!AppConstants.MOZ_ANDROID_SYNTHAPKS && event.equals("WebApps:Uninstall")) {
|
||||
uninstallWebApp(message.getString("origin"));
|
||||
} else if (!AppConstants.MOZ_ANDROID_SYNTHAPKS && event.equals("WebApps:PreInstall")) {
|
||||
} else if (!AppConstants.MOZ_ANDROID_SYNTHAPKS && event.equals("Webapps:Uninstall")) {
|
||||
uninstallWebapp(message.getString("origin"));
|
||||
} else if (!AppConstants.MOZ_ANDROID_SYNTHAPKS && event.equals("Webapps:Preinstall")) {
|
||||
String name = message.getString("name");
|
||||
String manifestURL = message.getString("manifestURL");
|
||||
String origin = message.getString("origin");
|
||||
|
||||
// preInstallWebapp will return a File object pointing to the profile directory of the webapp
|
||||
mCurrentResponse = preInstallWebApp(name, manifestURL, origin).toString();
|
||||
mCurrentResponse = preInstallWebapp(name, manifestURL, origin).toString();
|
||||
} else if (event.equals("WebApps:GetApkVersions")) {
|
||||
mCurrentResponse = getApkVersions(GeckoAppShell.getGeckoInterface().getActivity(),
|
||||
message.getJSONArray("packageNames")).toString();
|
||||
|
@ -128,15 +128,15 @@ public class EventListener implements GeckoEventListener, GeckoEventResponder {
|
|||
}
|
||||
|
||||
// Not used by MOZ_ANDROID_SYNTHAPKS.
|
||||
public static File preInstallWebApp(String aTitle, String aURI, String aOrigin) {
|
||||
int index = WebAppAllocator.getInstance(GeckoAppShell.getContext()).findAndAllocateIndex(aOrigin, aTitle, (String) null);
|
||||
public static File preInstallWebapp(String aTitle, String aURI, String aOrigin) {
|
||||
int index = WebappAllocator.getInstance(GeckoAppShell.getContext()).findAndAllocateIndex(aOrigin, aTitle, (String) null);
|
||||
GeckoProfile profile = GeckoProfile.get(GeckoAppShell.getContext(), "webapp" + index);
|
||||
return profile.getDir();
|
||||
}
|
||||
|
||||
// Not used by MOZ_ANDROID_SYNTHAPKS.
|
||||
public static void postInstallWebApp(String aTitle, String aURI, String aOrigin, String aIconURL, String aOriginalOrigin) {
|
||||
WebAppAllocator allocator = WebAppAllocator.getInstance(GeckoAppShell.getContext());
|
||||
public static void postInstallWebapp(String aTitle, String aURI, String aOrigin, String aIconURL, String aOriginalOrigin) {
|
||||
WebappAllocator allocator = WebappAllocator.getInstance(GeckoAppShell.getContext());
|
||||
int index = allocator.getIndexForApp(aOriginalOrigin);
|
||||
|
||||
assert aIconURL != null;
|
||||
|
@ -151,13 +151,13 @@ public class EventListener implements GeckoEventListener, GeckoEventResponder {
|
|||
}
|
||||
|
||||
// Used by MOZ_ANDROID_SYNTHAPKS.
|
||||
public static void postInstallWebApp(String aPackageName, String aOrigin) {
|
||||
public static void postInstallWebapp(String aPackageName, String aOrigin) {
|
||||
Allocator allocator = Allocator.getInstance(GeckoAppShell.getContext());
|
||||
int index = allocator.findOrAllocatePackage(aPackageName);
|
||||
allocator.putOrigin(index, aOrigin);
|
||||
}
|
||||
|
||||
public static void uninstallWebApp(final String uniqueURI) {
|
||||
public static void uninstallWebapp(final String uniqueURI) {
|
||||
// On uninstall, we need to do a couple of things:
|
||||
// 1. nuke the running app process.
|
||||
// 2. nuke the profile that was assigned to that webapp
|
||||
|
@ -173,7 +173,7 @@ public class EventListener implements GeckoEventListener, GeckoEventResponder {
|
|||
|
||||
// kill the app if it's running
|
||||
String targetProcessName = GeckoAppShell.getContext().getPackageName();
|
||||
targetProcessName = targetProcessName + ":" + targetProcessName + ".WebApp" + index;
|
||||
targetProcessName = targetProcessName + ":" + targetProcessName + ".Webapp" + index;
|
||||
|
||||
ActivityManager am = (ActivityManager) GeckoAppShell.getContext().getSystemService(Context.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningAppProcessInfo> procs = am.getRunningAppProcesses();
|
||||
|
|
|
@ -27,8 +27,8 @@ import android.net.Uri;
|
|||
import android.util.Log;
|
||||
|
||||
public class InstallHelper implements GeckoEventListener {
|
||||
private static final String LOGTAG = "GeckoWebAppInstallHelper";
|
||||
private static final String[] INSTALL_EVENT_NAMES = new String[] {"WebApps:PostInstall"};
|
||||
private static final String LOGTAG = "GeckoWebappInstallHelper";
|
||||
private static final String[] INSTALL_EVENT_NAMES = new String[] {"Webapps:Postinstall"};
|
||||
private final Context mContext;
|
||||
private final InstallCallback mCallback;
|
||||
private final ApkResources mApkResources;
|
||||
|
@ -86,7 +86,7 @@ public class InstallHelper implements GeckoEventListener {
|
|||
message.put("title", mApkResources.getAppName());
|
||||
message.put("manifest", new JSONObject(mApkResources.getManifest(mContext)));
|
||||
|
||||
String appType = mApkResources.getWebAppType();
|
||||
String appType = mApkResources.getWebappType();
|
||||
message.putOpt("type", appType);
|
||||
if ("packaged".equals(appType)) {
|
||||
message.putOpt("updateManifest", new JSONObject(mApkResources.getMiniManifest(mContext)));
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.util.Log;
|
|||
|
||||
public class InstallListener extends BroadcastReceiver {
|
||||
|
||||
private static String LOGTAG = "GeckoWebAppInstallListener";
|
||||
private static String LOGTAG = "GeckoWebappInstallListener";
|
||||
private JSONObject mData = null;
|
||||
private String mManifestUrl;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.ArrayList;
|
|||
|
||||
public class UninstallListener extends BroadcastReceiver {
|
||||
|
||||
private static String LOGTAG = "GeckoWebAppUninstallListener";
|
||||
private static String LOGTAG = "GeckoWebappUninstallListener";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
|
|
@ -42,8 +42,8 @@ import android.view.animation.AnimationUtils;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class WebAppImpl extends GeckoApp implements InstallCallback {
|
||||
private static final String LOGTAG = "GeckoWebAppImpl";
|
||||
public class WebappImpl extends GeckoApp implements InstallCallback {
|
||||
private static final String LOGTAG = "GeckoWebappImpl";
|
||||
|
||||
private URL mOrigin;
|
||||
private TextView mTitlebarText = null;
|
||||
|
@ -127,7 +127,7 @@ public class WebAppImpl extends GeckoApp implements InstallCallback {
|
|||
}
|
||||
return;
|
||||
} else {
|
||||
launchWebApp(origin, mApkResources.getManifestUrl(), mApkResources.getAppName());
|
||||
launchWebapp(origin, mApkResources.getManifestUrl(), mApkResources.getAppName());
|
||||
}
|
||||
|
||||
setTitle(mApkResources.getAppName());
|
||||
|
@ -290,9 +290,9 @@ public class WebAppImpl extends GeckoApp implements InstallCallback {
|
|||
return;
|
||||
}
|
||||
|
||||
if (event.equals("WebApps:PostInstall")) {
|
||||
if (event.equals("Webapps:Postinstall")) {
|
||||
String origin = message.optString("origin");
|
||||
launchWebApp(origin, mApkResources.getManifestUrl(), mApkResources.getAppName());
|
||||
launchWebapp(origin, mApkResources.getManifestUrl(), mApkResources.getAppName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ public class WebAppImpl extends GeckoApp implements InstallCallback {
|
|||
Log.e(LOGTAG, "Install errored", exception);
|
||||
}
|
||||
|
||||
public void launchWebApp(String origin, String manifestUrl, String name) {
|
||||
public void launchWebapp(String origin, String manifestUrl, String name) {
|
||||
try {
|
||||
mOrigin = new URL(origin);
|
||||
} catch (java.net.MalformedURLException ex) {
|
|
@ -24,7 +24,7 @@ function pref(name, value) {
|
|||
}
|
||||
}
|
||||
|
||||
let WebAppRT = {
|
||||
let WebappRT = {
|
||||
DEFAULT_PREFS_FILENAME: "default-prefs.js",
|
||||
|
||||
prefs: [
|
|
@ -460,9 +460,9 @@ var BrowserApp = {
|
|||
|
||||
_initRuntime: function(status, url, callback) {
|
||||
let sandbox = {};
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/WebAppRT.js", sandbox);
|
||||
window.WebAppRT = sandbox.WebAppRT;
|
||||
WebAppRT.init(status, url, callback);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/WebappRT.js", sandbox);
|
||||
window.WebappRT = sandbox.WebappRT;
|
||||
WebappRT.init(status, url, callback);
|
||||
},
|
||||
|
||||
initContextMenu: function ba_initContextMenu() {
|
||||
|
@ -7116,7 +7116,7 @@ var WebappsUI = {
|
|||
break;
|
||||
case "webapps-uninstall":
|
||||
sendMessageToJava({
|
||||
type: "WebApps:Uninstall",
|
||||
type: "Webapps:Uninstall",
|
||||
origin: data.origin
|
||||
});
|
||||
break;
|
||||
|
@ -7132,7 +7132,7 @@ var WebappsUI = {
|
|||
// Get a profile for the app to be installed in. We'll download everything before creating the icons.
|
||||
let origin = aData.app.origin;
|
||||
let profilePath = sendMessageToJava({
|
||||
type: "WebApps:PreInstall",
|
||||
type: "Webapps:Preinstall",
|
||||
name: manifest.name,
|
||||
manifestURL: aData.app.manifestURL,
|
||||
origin: origin
|
||||
|
@ -7164,7 +7164,7 @@ var WebappsUI = {
|
|||
|
||||
// aData.app.origin may now point to the app: url that hosts this app
|
||||
sendMessageToJava({
|
||||
type: "WebApps:PostInstall",
|
||||
type: "Webapps:Postinstall",
|
||||
name: localeManifest.name,
|
||||
manifestURL: aData.app.manifestURL,
|
||||
originalOrigin: origin,
|
||||
|
@ -7232,7 +7232,7 @@ var WebappsUI = {
|
|||
|
||||
openURL: function openURL(aManifestURL, aOrigin) {
|
||||
sendMessageToJava({
|
||||
type: "WebApps:Open",
|
||||
type: "Webapps:Open",
|
||||
manifestURL: aManifestURL,
|
||||
origin: aOrigin
|
||||
});
|
||||
|
|
|
@ -40,7 +40,7 @@ chrome.jar:
|
|||
content/SelectHelper.js (content/SelectHelper.js)
|
||||
content/SelectionHandler.js (content/SelectionHandler.js)
|
||||
content/dbg-browser-actors.js (content/dbg-browser-actors.js)
|
||||
* content/WebAppRT.js (content/WebAppRT.js)
|
||||
* content/WebappRT.js (content/WebappRT.js)
|
||||
content/InputWidgetHelper.js (content/InputWidgetHelper.js)
|
||||
content/WebrtcUI.js (content/WebrtcUI.js)
|
||||
content/MemoryObserver.js (content/MemoryObserver.js)
|
||||
|
|
|
@ -85,7 +85,7 @@ this.WebappManager = {
|
|||
}
|
||||
|
||||
sendMessageToJava({
|
||||
type: "WebApps:InstallApk",
|
||||
type: "Webapps:InstallApk",
|
||||
filePath: filePath,
|
||||
data: JSON.stringify(aMessage),
|
||||
});
|
||||
|
@ -157,7 +157,7 @@ this.WebappManager = {
|
|||
|
||||
// aData.app.origin may now point to the app: url that hosts this app.
|
||||
sendMessageToJava({
|
||||
type: "WebApps:PostInstall",
|
||||
type: "Webapps:Postinstall",
|
||||
apkPackageName: aData.app.apkPackageName,
|
||||
origin: aData.app.origin,
|
||||
});
|
||||
|
@ -171,7 +171,7 @@ this.WebappManager = {
|
|||
log("launchWebapp: " + manifestURL);
|
||||
|
||||
sendMessageToJava({
|
||||
type: "WebApps:Open",
|
||||
type: "Webapps:Open",
|
||||
manifestURL: manifestURL,
|
||||
origin: origin
|
||||
});
|
||||
|
@ -285,7 +285,7 @@ this.WebappManager = {
|
|||
|
||||
// Map APK names to APK versions.
|
||||
let apkNameToVersion = JSON.parse(sendMessageToJava({
|
||||
type: "WebApps:GetApkVersions",
|
||||
type: "Webapps:GetApkVersions",
|
||||
packageNames: installedApps.map(app => app.packageName).filter(packageName => !!packageName)
|
||||
}));
|
||||
|
||||
|
@ -450,11 +450,11 @@ this.WebappManager = {
|
|||
for (let apk of downloadedApks) {
|
||||
let msg = {
|
||||
app: apk.app,
|
||||
// TODO: figure out why WebApps:InstallApk needs the "from" property.
|
||||
// TODO: figure out why Webapps:InstallApk needs the "from" property.
|
||||
from: apk.app.installOrigin,
|
||||
};
|
||||
sendMessageToJava({
|
||||
type: "WebApps:InstallApk",
|
||||
type: "Webapps:InstallApk",
|
||||
filePath: apk.filePath,
|
||||
data: JSON.stringify(msg),
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче