mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 865005 - Part 1: Refactor initialization and create loadStartupTab() for initial tab. r=mfinkle
This commit is contained in:
parent
3d525c91d6
commit
c51455c934
@ -649,30 +649,14 @@ abstract public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeChrome(String uri, boolean isExternalURL) {
|
||||
super.initializeChrome(uri, isExternalURL);
|
||||
protected void initializeChrome() {
|
||||
super.initializeChrome();
|
||||
|
||||
mBrowserToolbar.updateBackButton(false);
|
||||
mBrowserToolbar.updateForwardButton(false);
|
||||
|
||||
mDoorHangerPopup.setAnchor(mBrowserToolbar.mFavicon);
|
||||
|
||||
if (isExternalURL || mRestoreMode != RESTORE_NONE) {
|
||||
mAboutHomeStartupTimer.cancel();
|
||||
}
|
||||
|
||||
if (!mIsRestoringActivity) {
|
||||
if (!isExternalURL) {
|
||||
// show about:home if we aren't restoring previous session
|
||||
if (mRestoreMode == RESTORE_NONE) {
|
||||
Tab tab = Tabs.getInstance().loadUrl(ABOUT_HOME, Tabs.LOADURL_NEW_TAB);
|
||||
}
|
||||
} else {
|
||||
int flags = Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_USER_ENTERED;
|
||||
Tabs.getInstance().loadUrl(uri, flags);
|
||||
}
|
||||
}
|
||||
|
||||
// Listen to margin changes to position the toolbar correctly
|
||||
if (isDynamicToolbarEnabled()) {
|
||||
refreshToolbarHeight();
|
||||
@ -700,6 +684,16 @@ abstract public class BrowserApp extends GeckoApp
|
||||
Intent.ACTION_SEND, tab.getDisplayTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadStartupTab(String url) {
|
||||
// We aren't showing about:home, so cancel the telemetry timer
|
||||
if (url != null || mRestoreMode != RESTORE_NONE) {
|
||||
mAboutHomeStartupTimer.cancel();
|
||||
}
|
||||
|
||||
super.loadStartupTab(url);
|
||||
}
|
||||
|
||||
private void setToolbarMargin(int margin) {
|
||||
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).topMargin = margin;
|
||||
mGeckoLayout.requestLayout();
|
||||
|
@ -1374,7 +1374,7 @@ abstract public class GeckoApp
|
||||
GeckoAppShell.setNotificationClient(makeNotificationClient());
|
||||
}
|
||||
|
||||
protected void initializeChrome(String uri, boolean isExternalURL) {
|
||||
protected void initializeChrome() {
|
||||
mDoorHangerPopup = new DoorHangerPopup(this, null);
|
||||
mPluginContainer = (AbsoluteLayout) findViewById(R.id.plugin_container);
|
||||
mFormAssistPopup = (FormAssistPopup) findViewById(R.id.form_assist_popup);
|
||||
@ -1393,6 +1393,29 @@ abstract public class GeckoApp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the initial tab at Fennec startup.
|
||||
*
|
||||
* If Fennec was opened with an external URL, that URL will be loaded.
|
||||
* Otherwise, unless there was a session restore, the default URL
|
||||
* (about:home) be loaded.
|
||||
*
|
||||
* @param url External URL to load, or null to load the default URL
|
||||
*/
|
||||
protected void loadStartupTab(String url) {
|
||||
if (url == null) {
|
||||
if (mRestoreMode == RESTORE_NONE) {
|
||||
// Show about:home if we aren't restoring previous session and
|
||||
// there's no external URL
|
||||
Tab tab = Tabs.getInstance().loadUrl("about:home", Tabs.LOADURL_NEW_TAB);
|
||||
}
|
||||
} else {
|
||||
// If given an external URL, load it
|
||||
int flags = Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_USER_ENTERED;
|
||||
Tabs.getInstance().loadUrl(url, flags);
|
||||
}
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
mInitialized = true;
|
||||
|
||||
@ -1427,6 +1450,8 @@ abstract public class GeckoApp
|
||||
|
||||
Tabs.registerOnTabsChangedListener(this);
|
||||
|
||||
initializeChrome();
|
||||
|
||||
// If we are doing a restore, read the session data and send it to Gecko
|
||||
String restoreMessage = null;
|
||||
if (mRestoreMode != RESTORE_NONE && !mIsRestoringActivity) {
|
||||
@ -1488,6 +1513,10 @@ abstract public class GeckoApp
|
||||
|
||||
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Session:Restore", restoreMessage));
|
||||
|
||||
if (!mIsRestoringActivity) {
|
||||
loadStartupTab(isExternalURL ? passedUri : null);
|
||||
}
|
||||
|
||||
if (mRestoreMode == RESTORE_OOM) {
|
||||
// If we successfully did an OOM restore, we now have tab stubs
|
||||
// from the last session. Any future tabs should be animated.
|
||||
@ -1497,8 +1526,6 @@ abstract public class GeckoApp
|
||||
getProfile().moveSessionFile();
|
||||
}
|
||||
|
||||
initializeChrome(passedUri, isExternalURL);
|
||||
|
||||
if (mRestoreMode == RESTORE_NONE) {
|
||||
Tabs.getInstance().notifyListeners(null, Tabs.TabEvents.RESTORED);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class WebAppImpl extends GeckoApp {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeChrome(String uri, boolean isExternalURL) {
|
||||
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
|
||||
@ -93,8 +93,6 @@ public class WebAppImpl extends GeckoApp {
|
||||
startActivity(appIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
super.initializeChrome(uri, isExternalURL);
|
||||
}
|
||||
|
||||
private void showSplash() {
|
||||
|
Loading…
Reference in New Issue
Block a user