mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1074343 - Dismiss guest mode notification on browser close. r=bnicholson
This commit is contained in:
parent
e1e7f60632
commit
56b6074a5b
@ -191,7 +191,7 @@ public class BrowserApp extends GeckoApp
|
|||||||
public boolean added; // So we can re-add after a locale change.
|
public boolean added; // So we can re-add after a locale change.
|
||||||
}
|
}
|
||||||
|
|
||||||
// The types of guest mdoe dialogs we show
|
// The types of guest mode dialogs we show.
|
||||||
public static enum GuestModeDialog {
|
public static enum GuestModeDialog {
|
||||||
ENTERING,
|
ENTERING,
|
||||||
LEAVING
|
LEAVING
|
||||||
@ -673,13 +673,6 @@ public class BrowserApp extends GeckoApp
|
|||||||
Log.e(LOGTAG, "Error initializing media manager", ex);
|
Log.e(LOGTAG, "Error initializing media manager", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getProfile().inGuestMode()) {
|
|
||||||
GuestSession.showNotification(this);
|
|
||||||
} else {
|
|
||||||
// If we're restarting, we won't destroy the activity. Make sure we remove any guest notifications that might have been shown.
|
|
||||||
GuestSession.hideNotification(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSystemUITinting() {
|
private void setupSystemUITinting() {
|
||||||
@ -790,6 +783,35 @@ public class BrowserApp extends GeckoApp
|
|||||||
lbm.unregisterReceiver(mOnboardingReceiver);
|
lbm.unregisterReceiver(mOnboardingReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
// Queue this work so that the first launch of the activity doesn't
|
||||||
|
// trigger profile init too early.
|
||||||
|
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (getProfile().inGuestMode()) {
|
||||||
|
GuestSession.showNotification(BrowserApp.this);
|
||||||
|
} else {
|
||||||
|
// If we're restarting, we won't destroy the activity.
|
||||||
|
// Make sure we remove any guest notifications that might
|
||||||
|
// have been shown.
|
||||||
|
GuestSession.hideNotification(BrowserApp.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
|
||||||
|
// We only show the guest mode notification when our activity is in the foreground.
|
||||||
|
GuestSession.hideNotification(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
@ -1087,8 +1109,6 @@ public class BrowserApp extends GeckoApp
|
|||||||
mBrowserHealthReporter = null;
|
mBrowserHealthReporter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuestSession.onDestroy(this);
|
|
||||||
|
|
||||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
|
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
|
||||||
"Menu:Update",
|
"Menu:Update",
|
||||||
"Reader:Added",
|
"Reader:Added",
|
||||||
@ -2939,6 +2959,9 @@ public class BrowserApp extends GeckoApp
|
|||||||
args = GUEST_BROWSING_ARG;
|
args = GUEST_BROWSING_ARG;
|
||||||
} else {
|
} else {
|
||||||
GeckoProfile.leaveGuestSession(BrowserApp.this);
|
GeckoProfile.leaveGuestSession(BrowserApp.this);
|
||||||
|
|
||||||
|
// Now's a good time to make sure we're not displaying the Guest Browsing notification.
|
||||||
|
GuestSession.hideNotification(BrowserApp.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GuestSession.isSecureKeyguardLocked(BrowserApp.this)) {
|
if (!GuestSession.isSecureKeyguardLocked(BrowserApp.this)) {
|
||||||
|
@ -9,7 +9,6 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -45,7 +44,6 @@ import org.mozilla.gecko.mozglue.GeckoLoader;
|
|||||||
import org.mozilla.gecko.preferences.ClearOnShutdownPref;
|
import org.mozilla.gecko.preferences.ClearOnShutdownPref;
|
||||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||||
import org.mozilla.gecko.prompts.PromptService;
|
import org.mozilla.gecko.prompts.PromptService;
|
||||||
import org.mozilla.gecko.SmsManager;
|
|
||||||
import org.mozilla.gecko.updater.UpdateService;
|
import org.mozilla.gecko.updater.UpdateService;
|
||||||
import org.mozilla.gecko.updater.UpdateServiceHelper;
|
import org.mozilla.gecko.updater.UpdateServiceHelper;
|
||||||
import org.mozilla.gecko.util.ActivityResultHandler;
|
import org.mozilla.gecko.util.ActivityResultHandler;
|
||||||
@ -443,6 +441,9 @@ public abstract class GeckoApp
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == R.id.quit) {
|
if (item.getItemId() == R.id.quit) {
|
||||||
|
// Make sure the Guest Browsing notification goes away when we quit.
|
||||||
|
GuestSession.hideNotification(this);
|
||||||
|
|
||||||
if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.GeckoRunning, GeckoThread.LaunchState.GeckoExiting)) {
|
if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.GeckoRunning, GeckoThread.LaunchState.GeckoExiting)) {
|
||||||
final SharedPreferences prefs = GeckoSharedPrefs.forProfile(this);
|
final SharedPreferences prefs = GeckoSharedPrefs.forProfile(this);
|
||||||
final Set<String> clearSet = PrefUtils.getStringSet(prefs, ClearOnShutdownPref.PREF, new HashSet<String>());
|
final Set<String> clearSet = PrefUtils.getStringSet(prefs, ClearOnShutdownPref.PREF, new HashSet<String>());
|
||||||
|
@ -4,29 +4,15 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
package org.mozilla.gecko;
|
package org.mozilla.gecko;
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
|
|
||||||
import org.mozilla.gecko.prompts.Prompt;
|
|
||||||
import org.mozilla.gecko.util.EventCallback;
|
|
||||||
import org.mozilla.gecko.util.NativeEventListener;
|
|
||||||
import org.mozilla.gecko.util.NativeJSObject;
|
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
// Utility methods for entering/exiting guest mode.
|
// Utility methods for entering/exiting guest mode.
|
||||||
public class GuestSession {
|
public class GuestSession {
|
||||||
@ -105,12 +91,6 @@ public class GuestSession {
|
|||||||
manager.cancel(R.id.guestNotification);
|
manager.cancel(R.id.guestNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onDestroy(Context context) {
|
|
||||||
if (GeckoProfile.get(context).inGuestMode()) {
|
|
||||||
hideNotification(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleIntent(BrowserApp context, Intent intent) {
|
public static void handleIntent(BrowserApp context, Intent intent) {
|
||||||
context.showGuestModeDialog(BrowserApp.GuestModeDialog.LEAVING);
|
context.showGuestModeDialog(BrowserApp.GuestModeDialog.LEAVING);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user