Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Save the focused window between regular and private sessions #1745

Merged
merged 1 commit into from
Sep 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class WindowsState {
public static final int MAX_WINDOWS = 3;
private WindowWidget mFullscreenWindow;
private WindowPlacement mPrevWindowPlacement;
private WindowPlacement mRegularWindowPlacement;
private WindowPlacement mPrivateWindowPlacement;
private boolean mStoredCurvedMode = false;
private boolean mForcedCurvedMode = false;

Expand Down Expand Up @@ -98,6 +100,9 @@ public Windows(Context aContext) {
mRegularWindows = new ArrayList<>();
mPrivateWindows = new ArrayList<>();

mRegularWindowPlacement = WindowPlacement.FRONT;
mPrivateWindowPlacement = WindowPlacement.FRONT;

mStoredCurvedMode = SettingsStore.getInstance(mContext).getCylinderDensity() > 0.0f;

restoreWindows();
Expand Down Expand Up @@ -402,6 +407,7 @@ public void enterPrivateMode() {
}
mPrivateMode = true;
updateCurvedMode(true);
mRegularWindowPlacement = mFocusedWindow.getWindowPlacement();
for (WindowWidget window: mRegularWindows) {
setWindowVisible(window, false);
}
Expand All @@ -416,7 +422,7 @@ public void enterPrivateMode() {
}

} else {
focusWindow(getFrontWindow());
focusWindow(getWindowWithPlacement(mPrivateWindowPlacement));
}
updateViews();
mWidgetManager.pushWorldBrightness(this, WidgetManagerDelegate.DEFAULT_DIM_BRIGHTNESS);
Expand All @@ -428,13 +434,14 @@ public void exitPrivateMode() {
}
mPrivateMode = false;
updateCurvedMode(true);
mPrivateWindowPlacement = mFocusedWindow.getWindowPlacement();
for (WindowWidget window: mRegularWindows) {
setWindowVisible(window, true);
}
for (WindowWidget window: mPrivateWindows) {
setWindowVisible(window, false);
}
focusWindow(getFrontWindow());
focusWindow(getWindowWithPlacement(mRegularWindowPlacement));
updateViews();
mWidgetManager.popWorldBrightness(this);
}
Expand Down Expand Up @@ -866,6 +873,7 @@ public void onFullScreen(GeckoSession session, boolean aFullScreen) {
}
}

@Nullable
private WindowWidget getWindowWithSession(GeckoSession aSession) {
for (WindowWidget window: getCurrentWindows()) {
if (window.getSessionStack().containsSession(aSession)) {
Expand Down