зеркало из https://github.com/mozilla/gecko-dev.git
Bug 897711 - Show a notification when in a guest session. r=bnicholson
This commit is contained in:
Родитель
b8c500ff2b
Коммит
21c4dfab8a
|
@ -149,6 +149,11 @@
|
|||
<action android:name="org.mozilla.gecko.ACTION_ALERT_CALLBACK" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="org.mozilla.gecko.GUEST_SESSION_INPROGRESS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Notification API V2 -->
|
||||
<intent-filter>
|
||||
<action android:name="@ANDROID_PACKAGE_NAME@.helperBroadcastAction" />
|
||||
|
|
|
@ -185,7 +185,7 @@ public class BrowserApp extends GeckoApp
|
|||
}
|
||||
|
||||
// The types of guest mdoe dialogs we show
|
||||
private static enum GuestModeDialog {
|
||||
public static enum GuestModeDialog {
|
||||
ENTERING,
|
||||
LEAVING
|
||||
}
|
||||
|
@ -536,11 +536,15 @@ public class BrowserApp extends GeckoApp
|
|||
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
|
||||
mProgressView = (ToolbarProgressView) findViewById(R.id.progress);
|
||||
mBrowserToolbar.setProgressBar(mProgressView);
|
||||
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||
|
||||
final String action = intent.getAction();
|
||||
if (Intent.ACTION_VIEW.equals(action)) {
|
||||
// Show the target URL immediately in the toolbar.
|
||||
mBrowserToolbar.setTitle(intent.getDataString());
|
||||
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT);
|
||||
} else if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
|
||||
GuestSession.handleIntent(this, intent);
|
||||
}
|
||||
|
||||
if (NewTabletUI.isEnabled(this)) {
|
||||
|
@ -660,6 +664,13 @@ public class BrowserApp extends GeckoApp
|
|||
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 registerOnboardingReceiver(Context context) {
|
||||
|
@ -1033,6 +1044,8 @@ public class BrowserApp extends GeckoApp
|
|||
mBrowserHealthReporter = null;
|
||||
}
|
||||
|
||||
GuestSession.onDestroy(this);
|
||||
|
||||
EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener)this,
|
||||
"Menu:Update",
|
||||
"Reader:Added",
|
||||
|
@ -2831,7 +2844,7 @@ public class BrowserApp extends GeckoApp
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void showGuestModeDialog(final GuestModeDialog type) {
|
||||
public void showGuestModeDialog(final GuestModeDialog type) {
|
||||
final Prompt ps = new Prompt(this, new Prompt.PromptCallback() {
|
||||
@Override
|
||||
public void onPromptFinished(String result) {
|
||||
|
@ -2923,6 +2936,8 @@ public class BrowserApp extends GeckoApp
|
|||
// Only solicit feedback when the app has been launched from the icon shortcut.
|
||||
if (!Intent.ACTION_MAIN.equals(action)) {
|
||||
return;
|
||||
} else if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
|
||||
GuestSession.handleIntent(this, intent);
|
||||
}
|
||||
|
||||
// Check to see how many times the app has been launched.
|
||||
|
|
|
@ -331,7 +331,7 @@ public final class GeckoProfile {
|
|||
// If this dir doesn't exist getDir will create it for us
|
||||
final File lockFile = new File(getDir(), LOCK_FILE_NAME);
|
||||
final boolean result = lockFile.createNewFile();
|
||||
if (result) {
|
||||
if (lockFile.exists()) {
|
||||
mLocked = LockState.LOCKED;
|
||||
} else {
|
||||
mLocked = LockState.UNLOCKED;
|
||||
|
|
|
@ -505,6 +505,8 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
|||
<!ENTITY guest_session_dialog_cancel "Cancel">
|
||||
<!ENTITY new_guest_session_title "&brandShortName; will now restart">
|
||||
<!ENTITY new_guest_session_text "The person using it will not be able to see any of your personal browsing data (like saved passwords, history or bookmarks).\n\nWhen your guest is done, their browsing data will be deleted and your session will be restored.">
|
||||
<!ENTITY guest_browsing_notification_title "Guest browsing is enabled">
|
||||
<!ENTITY guest_browsing_notification_text "Tap to exit">
|
||||
|
||||
<!ENTITY exit_guest_session_title "&brandShortName; will now restart">
|
||||
<!ENTITY exit_guest_session_text "The browsing data from this session will be deleted.">
|
||||
|
|
|
@ -251,6 +251,7 @@ gbjar.sources += [
|
|||
'gfx/ViewTransform.java',
|
||||
'gfx/VirtualLayer.java',
|
||||
'GlobalHistory.java',
|
||||
'GuestSession.java',
|
||||
'health/BrowserHealthRecorder.java',
|
||||
'health/BrowserHealthReporter.java',
|
||||
'health/HealthRecorder.java',
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.json.JSONObject;
|
|||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.Tab;
|
||||
import org.mozilla.gecko.Tabs;
|
||||
|
@ -162,7 +163,10 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
|
|||
|
||||
private void create(String title, String text, PromptListItem[] listItems, int choiceMode)
|
||||
throws IllegalStateException {
|
||||
GeckoAppShell.getLayerView().abortPanning();
|
||||
final LayerView view = GeckoAppShell.getLayerView();
|
||||
if (view != null) {
|
||||
view.abortPanning();
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 782 B |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 669 B |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.5 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 891 B |
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<resources>
|
||||
|
||||
<item type="id" name="guestNotification"/>
|
||||
|
||||
</resources>
|
|
@ -454,6 +454,8 @@
|
|||
<string name="guest_session_dialog_cancel">&guest_session_dialog_cancel;</string>
|
||||
<string name="new_guest_session_title">&new_guest_session_title;</string>
|
||||
<string name="new_guest_session_text">&new_guest_session_text;</string>
|
||||
<string name="guest_browsing_notification_title">&guest_browsing_notification_title;</string>
|
||||
<string name="guest_browsing_notification_text">&guest_browsing_notification_text;</string>
|
||||
|
||||
<string name="exit_guest_session_title">&exit_guest_session_title;</string>
|
||||
<string name="exit_guest_session_text">&exit_guest_session_text;</string>
|
||||
|
|
Загрузка…
Ссылка в новой задаче