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
This commit is contained in:
Nick Alexander 2016-03-30 10:21:29 -07:00
Родитель a48823544b
Коммит a1d48c2e26
3 изменённых файлов: 3 добавлений и 77 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -27,7 +27,6 @@
android:layout_above="@+id/find_in_page">
<org.mozilla.gecko.GeckoView android:id="@+id/layer_view"
gecko:doinit="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"/>

Просмотреть файл

@ -140,11 +140,6 @@
<attr name="state_open" format="boolean"/>
</declare-styleable>
<declare-styleable name="GeckoView">
<attr name="url" format="string"/>
<attr name="doinit" format="boolean"/>
</declare-styleable>
<declare-styleable name="IconTabWidget">
<attr name="android:layout"/>