From a1d48c2e262383473ed554f59bbe483e1274317d Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Wed, 30 Mar 2016 10:21:29 -0700 Subject: [PATCH] Bug 1258464 - Part 1: Remove vestigial GeckoView attrs and initialization. r=snorp These have no consumer and deserve to be properly reworked. MozReview-Commit-ID: KmjE44nmLXx --HG-- extra : rebase_source : 973f13ad0c111413aa73dff233fd771d9f641191 extra : source : dcffecae84b741d837295ad77d0dd9e7ece391eb --- .../java/org/mozilla/gecko/GeckoView.java | 74 +------------------ .../base/resources/layout/gecko_app.xml | 1 - .../android/base/resources/values/attrs.xml | 5 -- 3 files changed, 3 insertions(+), 77 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoView.java b/mobile/android/base/java/org/mozilla/gecko/GeckoView.java index 88b4c1b7720e..a839bb3a1f0f 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoView.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoView.java @@ -16,21 +16,16 @@ import org.mozilla.gecko.annotation.ReflectionTarget; import org.mozilla.gecko.annotation.WrapForJNI; import org.mozilla.gecko.gfx.GLController; import org.mozilla.gecko.gfx.LayerView; -import org.mozilla.gecko.mozglue.GeckoLoader; import org.mozilla.gecko.mozglue.JNIObject; -import org.mozilla.gecko.util.Clipboard; import org.mozilla.gecko.util.EventCallback; import org.mozilla.gecko.util.GeckoEventListener; -import org.mozilla.gecko.util.HardwareUtils; import org.mozilla.gecko.util.NativeEventListener; import org.mozilla.gecko.util.NativeJSObject; import org.mozilla.gecko.util.ThreadUtils; import android.app.Activity; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; -import android.content.res.TypedArray; import android.os.Binder; import android.os.Bundle; import android.os.Handler; @@ -180,20 +175,15 @@ public class GeckoView extends LayerView public GeckoView(Context context) { super(context); - init(context, null, true); + init(context); } public GeckoView(Context context, AttributeSet attrs) { super(context, attrs); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.GeckoView); - String url = a.getString(R.styleable.GeckoView_url); - boolean doInit = a.getBoolean(R.styleable.GeckoView_doinit, true); - a.recycle(); - init(context, url, doInit); + init(context); } - private void init(Context context, String url, boolean doInit) { - + private void init(Context context) { if (GeckoAppShell.getApplicationContext() == null) { GeckoAppShell.setApplicationContext(context.getApplicationContext()); } @@ -209,64 +199,6 @@ public class GeckoView extends LayerView GeckoAppShell.setLayerView(this); initializeView(EventDispatcher.getInstance()); - - // TODO: Fennec currently takes care of its own initialization, so this - // flag is a hack used in Fennec to prevent GeckoView initialization. - // This should go away once Fennec also uses GeckoView for - // initialization. - if (!doInit) - return; - - // If running outside of a GeckoActivity (eg, from a library project), - // load the native code and disable content providers - boolean isGeckoActivity = false; - try { - isGeckoActivity = context instanceof GeckoActivity; - } catch (NoClassDefFoundError ex) {} - - if (!isGeckoActivity) { - Clipboard.init(context); - HardwareUtils.init(context); - - // If you want to use GeckoNetworkManager, start it. - - final GeckoProfile profile = GeckoProfile.get(context); - } - - GeckoThread.ensureInit(null, null); - if (url != null) { - GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(url)); - } - - if (context instanceof Activity) { - Tabs tabs = Tabs.getInstance(); - tabs.attachToContext(context); - } - - EventDispatcher.getInstance().registerGeckoThreadListener(mGeckoEventListener, - "Gecko:Ready", - "Accessibility:Event", - "Content:StateChange", - "Content:LoadError", - "Content:PageShow", - "DOMTitleChanged", - "Link:Favicon", - "Prompt:Show", - "Prompt:ShowTop"); - - EventDispatcher.getInstance().registerGeckoThreadListener(mNativeEventListener, - "Accessibility:Ready", - "GeckoView:Message"); - - if (GeckoThread.launch()) { - // This is the first launch, so finish initialization and go. - GeckoProfile profile = GeckoProfile.get(context).forceCreate(); - - } else if (GeckoThread.isRunning()) { - // If Gecko is already running, that means the Activity was - // destroyed, so we need to re-attach Gecko to this GeckoView. - connectToGecko(); - } } @Override diff --git a/mobile/android/base/resources/layout/gecko_app.xml b/mobile/android/base/resources/layout/gecko_app.xml index 96bae71e9657..7549e66d6c92 100644 --- a/mobile/android/base/resources/layout/gecko_app.xml +++ b/mobile/android/base/resources/layout/gecko_app.xml @@ -27,7 +27,6 @@ android:layout_above="@+id/find_in_page"> diff --git a/mobile/android/base/resources/values/attrs.xml b/mobile/android/base/resources/values/attrs.xml index 720d49e08234..fd2da3dd438b 100644 --- a/mobile/android/base/resources/values/attrs.xml +++ b/mobile/android/base/resources/values/attrs.xml @@ -140,11 +140,6 @@ - - - - -