Bug 1285926 - Add preference for enabling/disabling custom tabs support. r=grisha

MozReview-Commit-ID: 8KmJo5IM7JS

--HG--
extra : rebase_source : 276e646d04b1060f5e0a2575408dac266d94f28d
This commit is contained in:
Sebastian Kaspari 2016-07-11 15:41:55 +02:00
Родитель 95fad96712
Коммит 19871f936c
5 изменённых файлов: 25 добавлений и 1 удалений

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

@ -12,6 +12,7 @@ import android.support.customtabs.CustomTabsIntent;
import org.mozilla.gecko.customtabs.CustomTabsActivity;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.tabqueue.TabQueueHelper;
import org.mozilla.gecko.tabqueue.TabQueueService;
@ -25,7 +26,7 @@ public class LauncherActivity extends Activity {
GeckoAppShell.ensureCrashHandling();
if (AppConstants.MOZ_ANDROID_CUSTOM_TABS && isCustomTabsIntent()) {
if (AppConstants.MOZ_ANDROID_CUSTOM_TABS && isCustomTabsIntent() && isCustomTabsEnabled()) {
dispatchCustomTabsIntent();
} else if (isViewIntentWithURL()) {
dispatchViewIntent();
@ -84,4 +85,8 @@ public class LauncherActivity extends Activity {
return isViewIntentWithURL()
&& getIntent().hasExtra(CustomTabsIntent.EXTRA_SESSION);
}
private boolean isCustomTabsEnabled() {
return GeckoSharedPrefs.forApp(this).getBoolean(GeckoPreferences.PREFS_CUSTOM_TABS, false);
}
}

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

@ -164,6 +164,7 @@ OnSharedPreferenceChangeListener
public static final String PREFS_APP_UPDATE_LAST_BUILD_ID = "app.update.last_build_id";
public static final String PREFS_READ_PARTNER_CUSTOMIZATIONS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_customizations_provider";
public static final String PREFS_READ_PARTNER_BOOKMARKS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_bookmarks_provider";
public static final String PREFS_CUSTOM_TABS = NON_PREF_PREFIX + "customtabs";
private static final String ACTION_STUMBLER_UPLOAD_PREF = "STUMBLER_PREF";
@ -881,6 +882,10 @@ OnSharedPreferenceChangeListener
i--;
continue;
}
} else if (PREFS_CUSTOM_TABS.equals(key) && !AppConstants.MOZ_ANDROID_CUSTOM_TABS) {
preferences.removePreference(pref);
i--;
continue;
}
// Some Preference UI elements are not actually preferences,

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

@ -272,6 +272,12 @@
<!ENTITY pref_whats_new_notification "What\'s new in &brandShortName;">
<!ENTITY pref_whats_new_notification_summary "Learn about new features after an update">
<!-- Custom Tabs is an Android API for allowing third-party apps to open URLs in a customized UI.
Instead of switching to the browser it appears as if the user stays in the third-party app.
For more see: https://developer.chrome.com/multidevice/android/customtabs -->
<!ENTITY pref_custom_tabs "Custom Tabs">
<!ENTITY pref_custom_tabs_summary "Allow third-party apps to open URLs with a customized look and feel. ">
<!ENTITY tracking_protection_prompt_title "Now with Tracking Protection">
<!ENTITY tracking_protection_prompt_text "Actively block tracking elements so you don\'t have to worry.">
<!ENTITY tracking_protection_prompt_tip_text "Visit Privacy settings to learn more">

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

@ -38,6 +38,11 @@
android:entryValues="@array/pref_char_encoding_values"
android:persistent="false" />
<SwitchPreference android:key="android.not_a_preference.customtabs"
android:title="@string/pref_custom_tabs"
android:summary="@string/pref_custom_tabs_summary"
android:defaultValue="false" />
<PreferenceCategory android:title="@string/pref_category_data_saver">
<ListPreference android:key="browser.image_blocking"

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

@ -234,6 +234,9 @@
<string name="pref_whats_new_notification">&pref_whats_new_notification;</string>
<string name="pref_whats_new_notification_summary">&pref_whats_new_notification_summary;</string>
<string name="pref_custom_tabs">&pref_custom_tabs;</string>
<string name="pref_custom_tabs_summary">&pref_custom_tabs_summary;</string>
<string name="pref_char_encoding">&pref_char_encoding;</string>
<string name="pref_char_encoding_on">&pref_char_encoding_on;</string>
<string name="pref_char_encoding_off">&pref_char_encoding_off;</string>