Bug 1065004 - Provide an option to always open external tabs in Private Browsing.r=margaret

This commit is contained in:
Allison Naaktgeboren 2015-05-26 15:26:33 -07:00
Родитель 74c9aa4946
Коммит 6e1d5e3eed
7 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -36,6 +36,7 @@ import android.net.Uri;
import android.os.Handler;
import android.provider.Browser;
import android.util.Log;
import android.content.SharedPreferences;
public class Tabs implements GeckoEventListener {
private static final String LOGTAG = "GeckoTabs";
@ -851,6 +852,12 @@ public class Tabs implements GeckoEventListener {
boolean desktopMode = (flags & LOADURL_DESKTOP) != 0;
boolean external = (flags & LOADURL_EXTERNAL) != 0;
final SharedPreferences sharedPrefs = GeckoSharedPrefs.forApp(mAppContext);
final boolean isPrivatePref = sharedPrefs.getBoolean("android.not_a_preference.openExternalURLsPrivately", false);
if (isPrivatePref && external) {
isPrivate = true;
}
args.put("url", url);
args.put("engine", searchEngine);
args.put("parentId", parentId);

Просмотреть файл

@ -156,6 +156,8 @@
<!ENTITY pref_developer_remotedebugging "Remote debugging">
<!ENTITY pref_category_logins "Logins">
<!ENTITY pref_remember_signons "Remember passwords">
<!ENTITY pref_open_external_urls_privately_title "Open links in Private browsing">
<!ENTITY pref_open_external_urls_privately_summary "For all external links opened in &brandShortName;">
<!ENTITY pref_manage_logins "Manage logins">
<!ENTITY pref_category_home "Home">

Просмотреть файл

@ -127,6 +127,7 @@ OnSharedPreferenceChangeListener
private static final String PREFS_SYNC = NON_PREF_PREFIX + "sync";
private static final String PREFS_TRACKING_PROTECTION = "privacy.trackingprotection.enabled";
private static final String PREFS_TRACKING_PROTECTION_LEARN_MORE = NON_PREF_PREFIX + "trackingprotection.learn_more";
private static final String PREFS_OPEN_URLS_IN_PRIVATE = NON_PREF_PREFIX + "openExternalURLsPrivately";
private static final String ACTION_STUMBLER_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".STUMBLER_PREF";
@ -702,6 +703,12 @@ OnSharedPreferenceChangeListener
preferences.removePreference(pref);
i--;
continue;
} else if (AppConstants.RELEASE_BUILD &&
PREFS_OPEN_URLS_IN_PRIVATE.equals(key)) {
// Remove UI for opening external links in private borwsing onrelease builds.
preferences.removePreference(pref);
i--;
continue;
} else if (!AppConstants.NIGHTLY_BUILD &&
(PREFS_TRACKING_PROTECTION.equals(key) ||
PREFS_TRACKING_PROTECTION_LEARN_MORE.equals(key))) {

Просмотреть файл

@ -35,6 +35,11 @@
android:summary="@string/pref_tab_queue_summary"
android:defaultValue="false" />
<CheckBoxPreference android:key="android.not_a_preference.openExternalURLsPrivately"
android:title="@string/pref_open_external_urls_privately_title"
android:summary="@string/pref_open_external_urls_privately_summary"
android:defaultValue="false" />
<org.mozilla.gecko.preferences.AndroidImportPreference
android:key="android.not_a_preference.import_android"
gecko:entries="@array/pref_import_android_entries"

Просмотреть файл

@ -42,6 +42,11 @@
android:summary="@string/pref_tab_queue_summary"
android:defaultValue="false" />
<CheckBoxPreference android:key="android.not_a_preference.openExternalURLsPrivately"
android:title="@string/pref_open_external_urls_privately_title"
android:summary="@string/pref_open_external_urls_privately_summary"
android:defaultValue="false" />
<org.mozilla.gecko.preferences.AndroidImportPreference
android:key="android.not_a_preference.import_android"
gecko:entries="@array/pref_import_android_entries"

Просмотреть файл

@ -42,6 +42,11 @@
android:summary="@string/pref_tab_queue_summary"
android:defaultValue="false" />
<CheckBoxPreference android:key="android.not_a_preference.openExternalURLsPrivately"
android:title="@string/pref_open_external_urls_privately_title"
android:summary="@string/pref_open_external_urls_privately_summary"
android:defaultValue="false" />
<org.mozilla.gecko.preferences.AndroidImportPreference
android:key="android.not_a_preference.import_android"
gecko:entries="@array/pref_import_android_entries"

Просмотреть файл

@ -177,6 +177,10 @@
<string name="pref_category_logins">&pref_category_logins;</string>
<string name="pref_remember_signons">&pref_remember_signons;</string>
<string name="pref_open_external_urls_privately_title">&pref_open_external_urls_privately_title;</string>
<string name="pref_open_external_urls_privately_summary">&pref_open_external_urls_privately_summary;</string>
<string name="pref_manage_logins">&pref_manage_logins;</string>
<string name="pref_cookies_menu">&pref_cookies_menu;</string>