--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -174,40 +174,40 @@
<receiver android:name="org.mozilla.gecko.webapp.UninstallListener" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</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>
<action android:name="org.mozilla.gecko.WEBAPP" />
</intent-filter>
<intent-filter>
<action android:name="org.mozilla.gecko.ACTION_ALERT_CALLBACK" />
</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
android:name="com.android.internal.app.ResolverActivity"
android:targetActivity=".App"
android:exported="true" />
<receiver android:name="org.mozilla.gecko.GeckoUpdateReceiver">
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -2716,17 +2716,17 @@ public abstract class GeckoApp
versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
} catch (NameNotFoundException e) {
Log.wtf(LOGTAG, getPackageName() + " not found", e);
}
return versionCode;
}
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).
return false;
// If we ever want to expose this for Fennec, here's how we would do it:
// int flags = 0;
// try {
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -715,17 +715,17 @@ public class GeckoAppShell
System.exit(0);
}
@WrapElementForJNI
static void scheduleRestart() {
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) {
Allocator slots = Allocator.getInstance(getContext());
int index = slots.getIndexForOrigin(aOrigin);
if (index == -1) {
return null;
@@ -733,31 +733,31 @@ public class GeckoAppShell
String packageName = slots.getAppForIndex(index);
intent = getContext().getPackageManager().getLaunchIntentForPackage(packageName);
if (aURI != null) {
intent.setData(Uri.parse(aURI));
}
} 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));
intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.ANDROID_PACKAGE_NAME + ".WebApps$WebApp" + aIndex);
return intent;
}
@@ -802,17 +802,17 @@ public class GeckoAppShell
/**
* Call this method only on the background thread.
*/
private static void doCreateShortcut(final String aTitle, final String aURI, final String aUniqueURI,
final Bitmap aIcon, final String aType) {
// 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);
shortcutIntent.setData(Uri.parse(aURI));
shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS);
}
@@ -839,17 +839,17 @@ public class GeckoAppShell
public static void removeShortcut(final String aTitle, final String aURI, final String aUniqueURI, final String aType) {
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
// 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 {
shortcutIntent = new Intent();
shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS);
shortcutIntent.setData(Uri.parse(aURI));
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -37,17 +37,17 @@ DEFINES += \
-DMOZ_ANDROID_SHARED_FXACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_FXACCOUNT_TYPE)" \
-DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID) \
-DMOZ_BUILD_TIMESTAMP=$(MOZ_BUILD_TIMESTAMP) \
-DUA_BUILDID=$(UA_BUILDID) \
$(NULL)
GARBAGE += \
AndroidManifest.xml \
- WebAppManifestFragment.xml.frag \
+ WebappManifestFragment.xml.frag \
classes.dex \
gecko.ap_ \
res/values/strings.xml \
.aapt.deps \
fennec_ids.txt \
javah.out \
jni-stubs.inc \
GeneratedJNIWrappers.cpp \
@@ -127,17 +127,17 @@ android_package_dir = $(addprefix genera
# These _PP_JAVAFILES are specified in moz.build and defined in
# backend.mk, which is included by config.mk. Therefore this needs to
# be defined after config.mk is included.
PP_JAVAFILES := $(filter-out $(gecko_package_dir)/R.java,$(gecko-mozglue_PP_JAVAFILES) $(gecko-browser_PP_JAVAFILES))
manifest := \
AndroidManifest.xml.in \
- WebAppManifestFragment.xml.frag.in \
+ WebappManifestFragment.xml.frag.in \
$(NULL)
PP_TARGETS += manifest
# Certain source files need to be preprocessed. This special rule
# generates these files into generated/org/mozilla/gecko for
# consumption by the build system and IDEs.
@@ -179,17 +179,17 @@ android_res_files := $(wildcard $(addsuf
# makefile, and trying to work around the lack of information, we
# force a rebuild of gecko.ap_ during packaging. See below.
res/values/strings.xml: FORCE
$(MAKE) -C locales
all_resources = \
$(CURDIR)/AndroidManifest.xml \
- $(CURDIR)/WebAppManifestFragment.xml.frag \
+ $(CURDIR)/WebappManifestFragment.xml.frag \
$(android_res_files) \
$(ANDROID_GENERATED_RESFILES) \
$(NULL)
# All of generated/org/mozilla/gecko/R.java, gecko.ap_, and R.txt are
# produced by aapt; this saves aapt invocations.
$(gecko_package_dir)/R.java: .aapt.deps
--- a/mobile/android/base/WebApps.java.in
+++ b/mobile/android/base/WebApps.java.in
@@ -2,16 +2,16 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution
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
}
rename from mobile/android/base/WebApp.java.in
rename to mobile/android/base/Webapp.java.in
--- a/mobile/android/base/WebApp.java.in
+++ b/mobile/android/base/Webapp.java.in
@@ -2,17 +2,17 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution
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 {}
rename from mobile/android/base/WebAppAllocator.java
rename to mobile/android/base/WebappAllocator.java
--- a/mobile/android/base/WebAppAllocator.java
+++ b/mobile/android/base/WebappAllocator.java
@@ -11,37 +11,37 @@ import org.mozilla.gecko.util.ThreadUtil
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.Bitmap;
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;
}
SharedPreferences mPrefs;
- protected WebAppAllocator(Context context) {
+ protected WebappAllocator(Context context) {
mPrefs = context.getSharedPreferences("webapps", Context.MODE_PRIVATE | Context.MODE_MULTI_PROCESS);
}
public static String appKey(int index) {
return "app" + index;
}
static public String iconKey(int index) {
rename from mobile/android/base/WebAppFragmentRepeater.inc
rename to mobile/android/base/WebappFragmentRepeater.inc
rename from mobile/android/base/WebAppImpl.java
rename to mobile/android/base/WebappImpl.java
--- a/mobile/android/base/WebAppImpl.java
+++ b/mobile/android/base/WebappImpl.java
@@ -21,18 +21,18 @@ import android.graphics.drawable.Gradien
import android.view.animation.AnimationUtils;
import android.view.animation.Animation;
import android.widget.ImageView;
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;
private View mTitlebar = null;
private View mSplashscreen;
protected int getIndex() { return 0; }
@@ -57,22 +57,22 @@ public class WebAppImpl extends GeckoApp
String action = getIntent().getAction();
Bundle extras = getIntent().getExtras();
String title = extras != null ? extras.getString(Intent.EXTRA_SHORTCUT_NAME) : null;
setTitle(title != null ? title : "Web App");
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) {
// If we can't parse the this is an app protocol, just settle for not having an origin
if (!origin.startsWith("app://")) {
return;
}
@@ -85,32 +85,32 @@ public class WebAppImpl extends GeckoApp
}
}
}
@Override
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();
}
}
private void showSplash() {
SharedPreferences prefs = getSharedPreferences("webapps", Context.MODE_PRIVATE | Context.MODE_MULTI_PROCESS);
// 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];
Color.colorToHSV(dominantColor, f);
f[2] = Math.min(f[2]*2, 1.0f);
colors[0] = Color.HSVToColor(255, f);
// now generate a second, slightly darker version of the same color
@@ -139,17 +139,17 @@ public class WebAppImpl extends GeckoApp
image.startAnimation(fadein);
}
}
@Override
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;
}
return "webapp" + action.substring(ACTION_WEBAPP_PREFIX.length());
}
@Override
protected boolean getSessionRestoreState(Bundle savedInstanceState) {
rename from mobile/android/base/WebAppManifestFragment.xml.frag.in
rename to mobile/android/base/WebappManifestFragment.xml.frag.in
--- a/mobile/android/base/WebAppManifestFragment.xml.frag.in
+++ b/mobile/android/base/WebappManifestFragment.xml.frag.in
@@ -1,13 +1,13 @@
<activity android:name=".WebApps$WebApp@APPNUM@"
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"
android:exported="true"
/>
#else
android:launchMode="singleTask"
android:taskAffinity="org.mozilla.gecko.WEBAPP@APPNUM@"
rename from mobile/android/base/WebAppsFragment.java.frag
rename to mobile/android/base/WebappsFragment.java.frag
--- a/mobile/android/base/WebAppsFragment.java.frag
+++ b/mobile/android/base/WebappsFragment.java.frag
@@ -1,5 +1,5 @@
-public static class WebApp@APPNUM@ extends WebApp {
+public static class WebApp@APPNUM@ extends Webapp {
@Override
protected int getIndex() { return @APPNUM@; }
}
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -339,19 +339,19 @@ gbjar.sources += [
'VideoPlayer.java',
'webapp/Allocator.java',
'webapp/ApkResources.java',
'webapp/Dispatcher.java',
'webapp/EventListener.java',
'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',
'widget/ArrowPopup.java',
'widget/BasicColorPicker.java',
'widget/ButtonToast.java',
'widget/CheckableLinearLayout.java',
'widget/ClickableWhenDisabledEditText.java',
@@ -375,17 +375,17 @@ gbjar.sources += [ thirdparty_source_dir
'com/googlecode/eyesfree/braille/selfbraille/SelfBrailleClient.java',
'com/googlecode/eyesfree/braille/selfbraille/WriteData.java',
] ]
android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
# All generated sources are handled specially in Makefile.in. And
# 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 += [
'org/mozilla/gecko/AppConstants.java',
'org/mozilla/gecko/R.java',
'org/mozilla/gecko/SysInfo.java',
'org/mozilla/gecko/widget/GeckoEditText.java',
'org/mozilla/gecko/widget/GeckoImageButton.java',
--- a/mobile/android/base/webapp/Allocator.java
+++ b/mobile/android/base/webapp/Allocator.java
@@ -13,22 +13,22 @@ import android.content.SharedPreferences
import android.content.SharedPreferences.Editor;
import java.util.ArrayList;
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;
public static Allocator getInstance() {
return getInstance(GeckoAppShell.getContext());
}
public static synchronized Allocator getInstance(Context cx) {
--- a/mobile/android/base/webapp/ApkResources.java
+++ b/mobile/android/base/webapp/ApkResources.java
@@ -16,17 +16,17 @@ import android.content.pm.PackageManager
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
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;
public ApkResources(Context context, String packageName) throws NameNotFoundException {
mPackageName = packageName;
mInfo = context.getPackageManager().getApplicationInfo(
mPackageName, PackageManager.GET_META_DATA);
@@ -53,17 +53,17 @@ public class ApkResources {
return readResource(context, "mini");
}
public String getManifestUrl() {
return metadata().getString("manifestUrl");
}
public boolean isPackaged() {
- return "packaged".equals(getWebAppType());
+ return "packaged".equals(getWebappType());
}
public boolean isDebuggable() {
return (mInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
private String readResource(Context context, String resourceName) {
Uri resourceUri = Uri.parse("android.resource://" + mPackageName
@@ -89,17 +89,17 @@ public class ApkResources {
public Uri getAppIconUri() {
return Uri.parse("android.resource://" + mPackageName + "/" + info().icon);
}
public Drawable getAppIcon() {
return info().loadIcon(mContext.getPackageManager());
}
- public String getWebAppType() {
+ public String getWebappType() {
return metadata().getString("webapp");
}
public String getAppName() {
return info().name;
}
/**
--- a/mobile/android/base/webapp/Dispatcher.java
+++ b/mobile/android/base/webapp/Dispatcher.java
@@ -6,17 +6,17 @@
package org.mozilla.gecko.webapp;
import android.app.Activity;
import android.content.Intent;
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) {
super.onCreate(bundle);
Allocator allocator = Allocator.getInstance(getApplicationContext());
if (bundle == null) {
--- a/mobile/android/base/webapp/EventListener.java
+++ b/mobile/android/base/webapp/EventListener.java
@@ -10,17 +10,17 @@ import org.mozilla.gecko.GeckoAppShell;
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.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;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -35,17 +35,17 @@ import java.util.List;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class EventListener implements GeckoEventListener, GeckoEventResponder {
- private static final String LOGTAG = "GeckoWebAppEventListener";
+ private static final String LOGTAG = "GeckoWebappEventListener";
private EventListener() { }
private static EventListener mEventListener;
private String mCurrentResponse = "";
private static EventListener getEventListener() {
if (mEventListener == null) {
@@ -58,127 +58,127 @@ public class EventListener implements Ge
GeckoAppShell.getEventDispatcher().registerEventListener(event, EventListener.getEventListener());
}
private static void unregisterEventListener(String event) {
GeckoAppShell.getEventDispatcher().unregisterEventListener(event, EventListener.getEventListener());
}
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();
}
} catch (Exception e) {
Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
}
}
public String getResponse(JSONObject origMessage) {
String res = mCurrentResponse;
mCurrentResponse = "";
return res;
}
// 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;
final int preferredSize = GeckoAppShell.getPreferredIconSize();
Bitmap icon = FaviconDecoder.getMostSuitableBitmapFromDataURI(aIconURL, preferredSize);
assert aOrigin != null && index != -1;
allocator.updateAppAllocation(aOrigin, index, icon);
GeckoAppShell.createShortcut(aTitle, aURI, aOrigin, icon, "webapp");
}
// 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
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
int index;
index = Allocator.getInstance(GeckoAppShell.getContext()).releaseIndexForApp(uniqueURI);
// if -1, nothing to do; we didn't think it was installed anyway
if (index == -1)
return;
// 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();
if (procs != null) {
for (ActivityManager.RunningAppProcessInfo proc : procs) {
if (proc.processName.equals(targetProcessName)) {
android.os.Process.killProcess(proc.pid);
break;
--- a/mobile/android/base/webapp/InstallHelper.java
+++ b/mobile/android/base/webapp/InstallHelper.java
@@ -22,18 +22,18 @@ import org.mozilla.gecko.util.GeckoEvent
import org.mozilla.gecko.util.ThreadUtils;
import android.content.Context;
import android.graphics.Bitmap;
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;
public static interface InstallCallback {
// on the GeckoThread
void installCompleted(InstallHelper installHelper, String event, JSONObject message);
@@ -81,17 +81,17 @@ public class InstallHelper implements Ge
GeckoProfile profile = GeckoProfile.get(mContext, profileName);
try {
message.put("apkPackageName", mApkResources.getPackageName());
message.put("manifestUrl", mApkResources.getManifestUrl());
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)));
}
message.putOpt("profilePath", profile.getDir());
if (mApkResources.isPackaged()) {
--- a/mobile/android/base/webapp/InstallListener.java
+++ b/mobile/android/base/webapp/InstallListener.java
@@ -19,17 +19,17 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Environment;
import android.text.TextUtils;
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;
public InstallListener(String manifestUrl, JSONObject data) {
mData = data;
mManifestUrl = manifestUrl;
assert mManifestUrl != null;
}
--- a/mobile/android/base/webapp/UninstallListener.java
+++ b/mobile/android/base/webapp/UninstallListener.java
@@ -23,17 +23,17 @@ import android.content.pm.PackageManager
import java.util.HashSet;
import java.util.List;
import java.util.Set;
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) {
if (intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
Log.i(LOGTAG, "Package is being replaced; ignoring removal intent");
return;
}
rename from mobile/android/base/webapp/WebAppImpl.java
rename to mobile/android/base/webapp/WebappImpl.java
--- a/mobile/android/base/webapp/WebAppImpl.java
+++ b/mobile/android/base/webapp/WebappImpl.java
@@ -37,18 +37,18 @@ import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.animation.Animation;
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;
private View mTitlebar = null;
private View mSplashscreen;
private ApkResources mApkResources;
@@ -122,17 +122,17 @@ public class WebAppImpl extends GeckoApp
}
} else {
// an install is already happening, so we should let it complete.
Log.i(LOGTAG, "Waiting for existing install to complete");
installHelper.registerGeckoListener();
}
return;
} else {
- launchWebApp(origin, mApkResources.getManifestUrl(), mApkResources.getAppName());
+ launchWebapp(origin, mApkResources.getManifestUrl(), mApkResources.getAppName());
}
setTitle(mApkResources.getAppName());
}
@Override
protected String getURIFromIntent(Intent intent) {
String uri = super.getURIFromIntent(intent);
@@ -285,28 +285,28 @@ public class WebAppImpl extends GeckoApp
}
@Override
public void installCompleted(InstallHelper installHelper, String event, JSONObject message) {
if (event == null) {
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());
}
}
@Override
public void installErrored(InstallHelper installHelper, Exception exception) {
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) {
// If we can't parse the this is an app protocol, just settle for not having an origin
if (!origin.startsWith("app://")) {
return;
}
rename from mobile/android/chrome/content/WebAppRT.js
rename to mobile/android/chrome/content/WebappRT.js
--- a/mobile/android/chrome/content/WebAppRT.js
+++ b/mobile/android/chrome/content/WebappRT.js
@@ -19,17 +19,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
function pref(name, value) {
return {
name: name,
value: value
}
}
-let WebAppRT = {
+let WebappRT = {
DEFAULT_PREFS_FILENAME: "default-prefs.js",
prefs: [
// Disable all add-on locations other than the profile (which can't be disabled this way)
pref("extensions.enabledScopes", 1),
// Auto-disable any add-ons that are "dropped in" to the profile
pref("extensions.autoDisableScopes", 1),
// Disable add-on installation via the web-exposed APIs
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -463,19 +463,19 @@ var BrowserApp = {
*/
setLocale: function (locale) {
console.log("browser.js: requesting locale set: " + locale);
sendMessageToJava({ type: "Locale:Set", locale: locale });
},
_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() {
// TODO: These should eventually move into more appropriate classes
NativeWindow.contextmenus.add(Strings.browser.GetStringFromName("contextmenu.openInNewTab"),
NativeWindow.contextmenus.linkOpenableNonPrivateContext,
function(aTarget) {
let url = NativeWindow.contextmenus._getLinkURL(aTarget);
@@ -7127,33 +7127,33 @@ var WebappsUI = {
case "webapps-ask-install":
this.doInstall(data);
break;
case "webapps-launch":
this.openURL(data.manifestURL, data.origin);
break;
case "webapps-uninstall":
sendMessageToJava({
- type: "WebApps:Uninstall",
+ type: "Webapps:Uninstall",
origin: data.origin
});
break;
}
},
doInstall: function doInstall(aData) {
let jsonManifest = aData.isPackage ? aData.app.updateManifest : aData.app.manifest;
let manifest = new ManifestHelper(jsonManifest, aData.app.origin);
let showPrompt = true;
if (!showPrompt || Services.prompt.confirm(null, Strings.browser.GetStringFromName("webapps.installTitle"), manifest.name + "\n" + aData.app.origin)) {
// 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
});
if (profilePath) {
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(profilePath);
@@ -7175,17 +7175,17 @@ var WebappsUI = {
persist.persistFlags = Ci.nsIWebBrowserPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
persist.persistFlags |= Ci.nsIWebBrowserPersist.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
let source = Services.io.newURI(fullsizeIcon, "UTF8", null);
persist.saveURI(source, null, null, null, null, iconFile, null);
// 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,
origin: aData.app.origin,
iconURL: fullsizeIcon
});
if (!!aData.isPackage) {
// For packaged apps, put a notification in the notification bar.
@@ -7243,17 +7243,17 @@ var WebappsUI = {
OS.File.writeAtomic(aFile.path, array, { tmpPath: aFile.path + ".tmp" }).then(null, function onError(reason) {
console.log("Error writing default prefs: " + reason);
});
}
},
openURL: function openURL(aManifestURL, aOrigin) {
sendMessageToJava({
- type: "WebApps:Open",
+ type: "Webapps:Open",
manifestURL: aManifestURL,
origin: aOrigin
});
},
get iconSize() {
let iconSize = 64;
try {
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -35,17 +35,17 @@ chrome.jar:
content/bindings/checkbox.xml (content/bindings/checkbox.xml)
content/bindings/settings.xml (content/bindings/settings.xml)
content/exceptions.js (content/exceptions.js)
content/downloads.js (content/downloads.js)
content/netError.xhtml (content/netError.xhtml)
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)
content/ConsoleAPI.js (content/ConsoleAPI.js)
content/PluginHelper.js (content/PluginHelper.js)
content/OfflineApps.js (content/OfflineApps.js)
content/MasterPassword.js (content/MasterPassword.js)
content/FindHelper.js (content/FindHelper.js)
--- a/mobile/android/modules/WebappManager.jsm
+++ b/mobile/android/modules/WebappManager.jsm
@@ -80,17 +80,17 @@ this.WebappManager = {
} catch(ex) {
aMessage.error = ex;
aMessageManager.sendAsyncMessage("Webapps:Install:Return:KO", aMessage);
log("error downloading APK: " + ex);
return;
}
sendMessageToJava({
- type: "WebApps:InstallApk",
+ type: "Webapps:InstallApk",
filePath: filePath,
data: JSON.stringify(aMessage),
});
}).bind(this)); },
_downloadApk: function(aManifestUrl) {
log("_downloadApk for " + aManifestUrl);
let deferred = Promise.defer();
@@ -152,31 +152,31 @@ this.WebappManager = {
}
DOMApplicationRegistry.registryReady.then(() => {
DOMApplicationRegistry.confirmInstall(aData, file, (function(aManifest) {
let localeManifest = new ManifestHelper(aManifest, aData.app.origin);
// 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,
});
this.writeDefaultPrefs(file, localeManifest);
}).bind(this));
});
},
launch: function({ manifestURL, origin }) {
log("launchWebapp: " + manifestURL);
sendMessageToJava({
- type: "WebApps:Open",
+ type: "Webapps:Open",
manifestURL: manifestURL,
origin: origin
});
},
uninstall: function(aData) {
log("uninstall: " + aData.manifestURL);
@@ -280,17 +280,17 @@ this.WebappManager = {
try {
let installedApps = yield this._getInstalledApps();
if (installedApps.length === 0) {
return;
}
// 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)
}));
// Map manifest URLs to APK versions, which is what the service needs
// in order to tell us which apps are outdated; and also map them to app
// objects, which the downloader/installer uses to download/install APKs.
// XXX Will this cause us to update apps without packages, and if so,
// does that satisfy the legacy migration story?
@@ -445,21 +445,21 @@ this.WebappManager = {
icon: "drawable://alert_app",
}).dismissed;
if (accepted) {
// The user accepted the notification, so install the downloaded APKs.
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),
});
}
} else {
// The user cancelled the notification, so remove the downloaded APKs.
for (let apk of downloadedApks) {
try {