diff options
author | Pierre-Antoine LaFayette <plafayet@codeaurora.org> | 2012-03-02 16:56:50 -0500 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-01-20 18:36:32 -0800 |
commit | 08fab3352a7cee93121b58ce7b4b2807314dd141 (patch) | |
tree | e405dbfcb264a1ad2328579815c09a06e2ce90eb /src/com/android/browser | |
parent | 2e5518fe20adbe127e86c9e0d18eb32277d6afeb (diff) | |
download | packages_apps_browser-08fab3352a7cee93121b58ce7b4b2807314dd141.zip packages_apps_browser-08fab3352a7cee93121b58ce7b4b2807314dd141.tar.gz packages_apps_browser-08fab3352a7cee93121b58ce7b4b2807314dd141.tar.bz2 |
Runtime enablement of WebGL
Add Labs setting for enabling and disabling WebGL. Need to make sure
WebGL has been compiled in before showing runtime enablement settings in
Labs menu. Requesting information from the native side through JNI.
(cherry-picked commit from a2f7564cd95da42fad70e3c54497df7e7e8b1ea9)
Change-Id: Ie11bfa69941c2d75cfec04132908e07391c602fd
Diffstat (limited to 'src/com/android/browser')
-rw-r--r-- | src/com/android/browser/BrowserSettings.java | 16 | ||||
-rw-r--r-- | src/com/android/browser/PreferenceKeys.java | 1 | ||||
-rw-r--r-- | src/com/android/browser/preferences/LabPreferencesFragment.java | 9 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index 4073f1c..8ed824e 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -129,6 +129,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, private static String sFactoryResetUrl; + private static boolean sWebGLAvailable; + public static void initialize(final Context context) { sInstance = new BrowserSettings(context); } @@ -275,6 +277,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, settings.setSaveFormData(saveFormdata()); settings.setUseWideViewPort(isWideViewport()); settings.setAutoFillProfile(getAutoFillProfile()); + setIsWebGLAvailable(settings.isWebGLAvailable()); + settings.setWebGLEnabled(isWebGLAvailable() && isWebGLEnabled()); String ua = mCustomUserAgents.get(settings); if (ua != null) { @@ -841,6 +845,10 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, return 1 + (mPrefs.getInt(PREF_INVERTED_CONTRAST, 0) / 10f); } + public boolean isWebGLEnabled() { + return mPrefs.getBoolean(PREF_ENABLE_WEBGL, true); + } + // ----------------------------- // getter/setters for privacy_security_preferences.xml // ----------------------------- @@ -917,6 +925,14 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, return mPrefs.getString(PREF_LINK_PREFETCH, getDefaultLinkPrefetchSetting()); } + private static void setIsWebGLAvailable(boolean available) { + sWebGLAvailable = available; + } + + public static boolean isWebGLAvailable() { + return sWebGLAvailable; + } + // ----------------------------- // getter/setters for browser recovery // ----------------------------- diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java index 1828032..2de1073 100644 --- a/src/com/android/browser/PreferenceKeys.java +++ b/src/com/android/browser/PreferenceKeys.java @@ -83,6 +83,7 @@ public interface PreferenceKeys { // ---------------------- static final String PREF_ENABLE_QUICK_CONTROLS = "enable_quick_controls"; static final String PREF_FULLSCREEN = "fullscreen"; + static final String PREF_ENABLE_WEBGL = "enable_webgl"; // ---------------------- // Keys for privacy_security_preferences.xml diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java index 222b5fa..8d33c95 100644 --- a/src/com/android/browser/preferences/LabPreferencesFragment.java +++ b/src/com/android/browser/preferences/LabPreferencesFragment.java @@ -17,8 +17,10 @@ package com.android.browser.preferences; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.preference.PreferenceScreen; import com.android.browser.BrowserSettings; import com.android.browser.PreferenceKeys; @@ -32,5 +34,12 @@ public class LabPreferencesFragment extends PreferenceFragment { super.onCreate(savedInstanceState); // Load the XML preferences file addPreferencesFromResource(R.xml.lab_preferences); + + if (!BrowserSettings.isWebGLAvailable()) { + CheckBoxPreference webGL = (CheckBoxPreference) + findPreference(PreferenceKeys.PREF_ENABLE_WEBGL); + PreferenceScreen screen = getPreferenceScreen(); + screen.removePreference(webGL); + } } } |