зеркало из https://github.com/mozilla/gecko-dev.git
bug 930070 - GeckoView should handle not having fennec-specific classes r=mfinkle
This commit is contained in:
Родитель
66795dc491
Коммит
d3ac1ff71a
|
@ -172,7 +172,6 @@ abstract public class GeckoApp
|
||||||
public static int mOrientation;
|
public static int mOrientation;
|
||||||
protected boolean mIsRestoringActivity;
|
protected boolean mIsRestoringActivity;
|
||||||
private String mCurrentResponse = "";
|
private String mCurrentResponse = "";
|
||||||
public static boolean sIsUsingCustomProfile = false;
|
|
||||||
|
|
||||||
private ContactService mContactService;
|
private ContactService mContactService;
|
||||||
private PromptService mPromptService;
|
private PromptService mPromptService;
|
||||||
|
@ -1175,7 +1174,7 @@ abstract public class GeckoApp
|
||||||
if (profileName == null)
|
if (profileName == null)
|
||||||
profileName = "default";
|
profileName = "default";
|
||||||
}
|
}
|
||||||
GeckoApp.sIsUsingCustomProfile = true;
|
GeckoProfile.sIsUsingCustomProfile = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profileName != null || profilePath != null) {
|
if (profileName != null || profilePath != null) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ public final class GeckoProfile {
|
||||||
private final String mName;
|
private final String mName;
|
||||||
private File mMozDir;
|
private File mMozDir;
|
||||||
private File mDir;
|
private File mDir;
|
||||||
|
public static boolean sIsUsingCustomProfile = false;
|
||||||
|
|
||||||
// Constants to cache whether or not a profile is "locked".
|
// Constants to cache whether or not a profile is "locked".
|
||||||
private enum LockState {
|
private enum LockState {
|
||||||
|
@ -60,7 +61,13 @@ public final class GeckoProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GeckoProfile get(Context context) {
|
public static GeckoProfile get(Context context) {
|
||||||
if (context instanceof GeckoApp) {
|
boolean isGeckoApp = false;
|
||||||
|
try {
|
||||||
|
isGeckoApp = context instanceof GeckoApp;
|
||||||
|
} catch (NoClassDefFoundError ex) {}
|
||||||
|
|
||||||
|
|
||||||
|
if (isGeckoApp) {
|
||||||
// Check for a cached profile on this context already
|
// Check for a cached profile on this context already
|
||||||
// TODO: We should not be caching profile information on the Activity context
|
// TODO: We should not be caching profile information on the Activity context
|
||||||
if (((GeckoApp)context).mProfile != null) {
|
if (((GeckoApp)context).mProfile != null) {
|
||||||
|
@ -74,7 +81,7 @@ public final class GeckoProfile {
|
||||||
return guest;
|
return guest;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context instanceof GeckoApp) {
|
if (isGeckoApp) {
|
||||||
// Otherwise, get the default profile for the Activity
|
// Otherwise, get the default profile for the Activity
|
||||||
return get(context, ((GeckoApp)context).getDefaultProfileName());
|
return get(context, ((GeckoApp)context).getDefaultProfileName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class GeckoThread extends Thread implements GeckoEventListener {
|
||||||
if (args == null || !args.contains(BrowserApp.GUEST_BROWSING_ARG)) {
|
if (args == null || !args.contains(BrowserApp.GUEST_BROWSING_ARG)) {
|
||||||
guest = " " + BrowserApp.GUEST_BROWSING_ARG;
|
guest = " " + BrowserApp.GUEST_BROWSING_ARG;
|
||||||
}
|
}
|
||||||
} else if (!GeckoApp.sIsUsingCustomProfile) {
|
} else if (!GeckoProfile.sIsUsingCustomProfile) {
|
||||||
// If nothing was passed in in the intent, force Gecko to use the default profile for
|
// If nothing was passed in in the intent, force Gecko to use the default profile for
|
||||||
// for this activity
|
// for this activity
|
||||||
profile = " -P " + GeckoAppShell.getGeckoInterface().getProfile().getName();
|
profile = " -P " + GeckoAppShell.getGeckoInterface().getProfile().getName();
|
||||||
|
|
|
@ -46,7 +46,12 @@ public class GeckoView extends LayerView
|
||||||
|
|
||||||
// If running outside of a GeckoActivity (eg, from a library project),
|
// If running outside of a GeckoActivity (eg, from a library project),
|
||||||
// load the native code and disable content providers
|
// load the native code and disable content providers
|
||||||
if (!(context instanceof GeckoActivity)) {
|
boolean isGeckoActivity = false;
|
||||||
|
try {
|
||||||
|
isGeckoActivity = context instanceof GeckoActivity;
|
||||||
|
} catch (NoClassDefFoundError ex) {}
|
||||||
|
|
||||||
|
if (!isGeckoActivity) {
|
||||||
// Set the GeckoInterface if the context is an activity and the GeckoInterface
|
// Set the GeckoInterface if the context is an activity and the GeckoInterface
|
||||||
// has not already been set
|
// has not already been set
|
||||||
if (context instanceof Activity && getGeckoInterface() == null) {
|
if (context instanceof Activity && getGeckoInterface() == null) {
|
||||||
|
@ -59,7 +64,7 @@ public class GeckoView extends LayerView
|
||||||
|
|
||||||
GeckoLoader.loadMozGlue();
|
GeckoLoader.loadMozGlue();
|
||||||
BrowserDB.setEnableContentProviders(false);
|
BrowserDB.setEnableContentProviders(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
GeckoThread.setUri(url);
|
GeckoThread.setUri(url);
|
||||||
|
|
|
@ -896,16 +896,20 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setShadowVisibility() {
|
private void setShadowVisibility() {
|
||||||
ThreadUtils.postToUiThread(new Runnable() {
|
try {
|
||||||
@Override
|
if (BrowserApp.mBrowserToolbar == null) // this will throw if we don't have BrowserApp
|
||||||
public void run() {
|
return;
|
||||||
if (BrowserApp.mBrowserToolbar == null) {
|
ThreadUtils.postToUiThread(new Runnable() {
|
||||||
return;
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (BrowserApp.mBrowserToolbar == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ImmutableViewportMetrics m = mViewportMetrics;
|
||||||
|
BrowserApp.mBrowserToolbar.setShadowVisibility(m.viewportRectTop >= m.pageRectTop);
|
||||||
}
|
}
|
||||||
ImmutableViewportMetrics m = mViewportMetrics;
|
});
|
||||||
BrowserApp.mBrowserToolbar.setShadowVisibility(m.viewportRectTop >= m.pageRectTop);
|
} catch (NoClassDefFoundError ex) {}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implementation of PanZoomTarget */
|
/** Implementation of PanZoomTarget */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче