Cary Clark | f2407c6 | 2009-09-04 12:25:10 -0400 | [diff] [blame] | 1 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2007 The Android Open Source Project |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | package com.android.browser; |
| 19 | |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 20 | import com.android.browser.homepages.HomeProvider; |
Bjorn Bringert | d69f51d | 2010-09-13 14:06:41 +0100 | [diff] [blame] | 21 | import com.android.browser.search.SearchEngine; |
| 22 | import com.android.browser.search.SearchEngines; |
| 23 | |
Grace Kloba | 9804c43 | 2009-12-02 11:07:40 -0800 | [diff] [blame] | 24 | import android.app.ActivityManager; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 25 | import android.content.ContentResolver; |
| 26 | import android.content.Context; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 27 | import android.content.SharedPreferences; |
| 28 | import android.content.SharedPreferences.Editor; |
John Reck | 812d2d6 | 2011-01-18 14:16:15 -0800 | [diff] [blame] | 29 | import android.content.SharedPreferences.OnSharedPreferenceChangeListener; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 30 | import android.database.Cursor; |
Jeff Davidson | 4361029 | 2010-07-16 16:03:58 -0700 | [diff] [blame] | 31 | import android.net.Uri; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 32 | import android.os.AsyncTask; |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 33 | import android.os.Message; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 34 | import android.preference.PreferenceManager; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 35 | import android.provider.Browser; |
Bjorn Bringert | d69f51d | 2010-09-13 14:06:41 +0100 | [diff] [blame] | 36 | import android.util.Log; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 37 | import android.webkit.CookieManager; |
Steve Block | f344d03 | 2009-07-30 10:50:45 +0100 | [diff] [blame] | 38 | import android.webkit.GeolocationPermissions; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 39 | import android.webkit.WebIconDatabase; |
| 40 | import android.webkit.WebSettings; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 41 | import android.webkit.WebSettings.AutoFillProfile; |
Nicolas Roard | 78a98e4 | 2009-05-11 13:34:17 +0100 | [diff] [blame] | 42 | import android.webkit.WebStorage; |
John Reck | 812d2d6 | 2011-01-18 14:16:15 -0800 | [diff] [blame] | 43 | import android.webkit.WebView; |
| 44 | import android.webkit.WebViewDatabase; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 45 | |
| 46 | import java.util.HashMap; |
| 47 | import java.util.Observable; |
| 48 | |
| 49 | /* |
| 50 | * Package level class for storing various WebView and Browser settings. To use |
| 51 | * this class: |
| 52 | * BrowserSettings s = BrowserSettings.getInstance(); |
| 53 | * s.addObserver(webView.getSettings()); |
| 54 | * s.loadFromDb(context); // Only needed on app startup |
| 55 | * s.javaScriptEnabled = true; |
| 56 | * ... // set any other settings |
| 57 | * s.update(); // this will update all the observers |
| 58 | * |
| 59 | * To remove an observer: |
| 60 | * s.deleteObserver(webView.getSettings()); |
| 61 | */ |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 62 | public class BrowserSettings extends Observable implements OnSharedPreferenceChangeListener { |
Leon Scroggins | 9ac587d | 2009-04-20 12:53:46 -0400 | [diff] [blame] | 63 | // Private variables for settings |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 64 | // NOTE: these defaults need to be kept in sync with the XML |
| 65 | // until the performance of PreferenceManager.setDefaultValues() |
| 66 | // is improved. |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 67 | // Note: boolean variables are set inside reset function. |
| 68 | private boolean loadsImagesAutomatically; |
| 69 | private boolean javaScriptEnabled; |
Patrick Scott | e536b33 | 2010-03-22 10:19:32 -0400 | [diff] [blame] | 70 | private WebSettings.PluginState pluginState; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 71 | private boolean javaScriptCanOpenWindowsAutomatically; |
| 72 | private boolean showSecurityWarnings; |
| 73 | private boolean rememberPasswords; |
| 74 | private boolean saveFormData; |
Ben Murdoch | ce549fc | 2010-09-09 10:28:08 +0100 | [diff] [blame] | 75 | private boolean autoFillEnabled; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 76 | private boolean openInBackground; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 77 | private String defaultTextEncodingName; |
Grace Kloba | f2c5c1b | 2009-05-26 10:48:31 -0700 | [diff] [blame] | 78 | private String homeUrl = ""; |
Bjorn Bringert | d69f51d | 2010-09-13 14:06:41 +0100 | [diff] [blame] | 79 | private SearchEngine searchEngine; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 80 | private boolean autoFitPage; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 81 | private boolean loadsPageInOverviewMode; |
| 82 | private boolean showDebugSettings; |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 83 | // HTML5 API flags |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 84 | private boolean appCacheEnabled; |
| 85 | private boolean databaseEnabled; |
| 86 | private boolean domStorageEnabled; |
| 87 | private boolean geolocationEnabled; |
| 88 | private boolean workersEnabled; // only affects V8. JSC does not have a similar setting |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 89 | // HTML5 API configuration params |
| 90 | private long appCacheMaxSize = Long.MAX_VALUE; |
| 91 | private String appCachePath; // default value set in loadFromDb(). |
| 92 | private String databasePath; // default value set in loadFromDb() |
Steve Block | 5029cf0 | 2009-08-21 13:16:58 +0100 | [diff] [blame] | 93 | private String geolocationDatabasePath; // default value set in loadFromDb() |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 94 | private WebStorageSizeManager webStorageSizeManager; |
| 95 | |
| 96 | private String jsFlags = ""; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 97 | |
Nicolas Roard | 78a98e4 | 2009-05-11 13:34:17 +0100 | [diff] [blame] | 98 | private final static String TAG = "BrowserSettings"; |
| 99 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 100 | // Development settings |
| 101 | public WebSettings.LayoutAlgorithm layoutAlgorithm = |
| 102 | WebSettings.LayoutAlgorithm.NARROW_COLUMNS; |
| 103 | private boolean useWideViewPort = true; |
| 104 | private int userAgent = 0; |
| 105 | private boolean tracing = false; |
| 106 | private boolean lightTouch = false; |
| 107 | private boolean navDump = false; |
Derek Sollenberger | 8de8285 | 2010-11-18 19:51:50 -0500 | [diff] [blame] | 108 | private boolean hardwareAccelerated = true; |
Teng-Hui Zhu | 930ea22 | 2011-02-16 11:22:21 -0800 | [diff] [blame] | 109 | private boolean showVisualIndicator = false; |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 110 | // Lab settings |
| 111 | private boolean quickControls = false; |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 112 | private boolean useMostVisitedHomepage = false; |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 113 | private boolean useInstant = false; |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 114 | |
Ben Murdoch | bff2d60 | 2009-07-01 20:19:05 +0100 | [diff] [blame] | 115 | // By default the error console is shown once the user navigates to about:debug. |
| 116 | // The setting can be then toggled from the settings menu. |
| 117 | private boolean showConsole = true; |
| 118 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 119 | // Private preconfigured values |
Shimeng (Simon) Wang | b4fb25c | 2010-07-13 15:18:10 -0700 | [diff] [blame] | 120 | private static int minimumFontSize = 1; |
| 121 | private static int minimumLogicalFontSize = 1; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 122 | private static int defaultFontSize = 16; |
| 123 | private static int defaultFixedFontSize = 13; |
| 124 | private static WebSettings.TextSize textSize = |
| 125 | WebSettings.TextSize.NORMAL; |
Grace Kloba | 2f83068 | 2009-06-25 11:08:53 -0700 | [diff] [blame] | 126 | private static WebSettings.ZoomDensity zoomDensity = |
| 127 | WebSettings.ZoomDensity.MEDIUM; |
Grace Kloba | 9804c43 | 2009-12-02 11:07:40 -0800 | [diff] [blame] | 128 | private static int pageCacheCapacity; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 129 | |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 130 | |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 131 | private AutoFillProfile autoFillProfile; |
Ben Murdoch | 6fa32ba | 2010-10-20 14:01:25 +0100 | [diff] [blame] | 132 | // Default to zero. In the case no profile is set up, the initial |
| 133 | // value will come from the AutoFillSettingsFragment when the user |
| 134 | // creates a profile. Otherwise, we'll read the ID of the last used |
| 135 | // profile from the prefs db. |
| 136 | private int autoFillActiveProfileId; |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 137 | private static final int NO_AUTOFILL_PROFILE_SET = 0; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 138 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 139 | // Preference keys that are used outside this class |
| 140 | public final static String PREF_CLEAR_CACHE = "privacy_clear_cache"; |
| 141 | public final static String PREF_CLEAR_COOKIES = "privacy_clear_cookies"; |
| 142 | public final static String PREF_CLEAR_HISTORY = "privacy_clear_history"; |
| 143 | public final static String PREF_HOMEPAGE = "homepage"; |
Bjorn Bringert | d69f51d | 2010-09-13 14:06:41 +0100 | [diff] [blame] | 144 | public final static String PREF_SEARCH_ENGINE = "search_engine"; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 145 | public final static String PREF_CLEAR_FORM_DATA = |
| 146 | "privacy_clear_form_data"; |
| 147 | public final static String PREF_CLEAR_PASSWORDS = |
| 148 | "privacy_clear_passwords"; |
| 149 | public final static String PREF_EXTRAS_RESET_DEFAULTS = |
| 150 | "reset_default_preferences"; |
| 151 | public final static String PREF_DEBUG_SETTINGS = "debug_menu"; |
Nicolas Roard | e46990e | 2009-06-19 16:27:49 +0100 | [diff] [blame] | 152 | public final static String PREF_WEBSITE_SETTINGS = "website_settings"; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 153 | public final static String PREF_TEXT_SIZE = "text_size"; |
Grace Kloba | 2f83068 | 2009-06-25 11:08:53 -0700 | [diff] [blame] | 154 | public final static String PREF_DEFAULT_ZOOM = "default_zoom"; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 155 | public final static String PREF_DEFAULT_TEXT_ENCODING = |
| 156 | "default_text_encoding"; |
Steve Block | c6f577f | 2009-08-20 18:11:08 +0100 | [diff] [blame] | 157 | public final static String PREF_CLEAR_GEOLOCATION_ACCESS = |
| 158 | "privacy_clear_geolocation_access"; |
Ben Murdoch | af55452 | 2010-09-10 22:09:30 +0100 | [diff] [blame] | 159 | public final static String PREF_AUTOFILL_ENABLED = "autofill_enabled"; |
| 160 | public final static String PREF_AUTOFILL_PROFILE = "autofill_profile"; |
Ben Murdoch | 6fa32ba | 2010-10-20 14:01:25 +0100 | [diff] [blame] | 161 | public final static String PREF_AUTOFILL_ACTIVE_PROFILE_ID = "autofill_active_profile_id"; |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 162 | public final static String PREF_HARDWARE_ACCEL = "enable_hardware_accel"; |
Teng-Hui Zhu | 930ea22 | 2011-02-16 11:22:21 -0800 | [diff] [blame] | 163 | public final static String PREF_VISUAL_INDICATOR = "enable_visual_indicator"; |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 164 | public final static String PREF_USER_AGENT = "user_agent"; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 165 | |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 166 | public final static String PREF_QUICK_CONTROLS = "enable_quick_controls"; |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 167 | public final static String PREF_MOST_VISITED_HOMEPAGE = "use_most_visited_homepage"; |
John Reck | 282431b | 2011-01-20 17:38:37 -0800 | [diff] [blame] | 168 | public final static String PREF_PLUGIN_STATE = "plugin_state"; |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 169 | public final static String PREF_USE_INSTANT = "use_instant_search"; |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 170 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 171 | private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " + |
Bart Sears | f6915fb | 2010-07-08 19:58:22 -0700 | [diff] [blame] | 172 | "U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " + |
| 173 | "like Gecko) Version/5.0 Safari/533.16"; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 174 | |
| 175 | private static final String IPHONE_USERAGENT = "Mozilla/5.0 (iPhone; U; " + |
Bart Sears | f6915fb | 2010-07-08 19:58:22 -0700 | [diff] [blame] | 176 | "CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 " + |
| 177 | "(KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"; |
| 178 | |
| 179 | private static final String IPAD_USERAGENT = "Mozilla/5.0 (iPad; U; " + |
| 180 | "CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 " + |
| 181 | "(KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10"; |
| 182 | |
| 183 | private static final String FROYO_USERAGENT = "Mozilla/5.0 (Linux; U; " + |
| 184 | "Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 " + |
| 185 | "(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 186 | |
| 187 | // Value to truncate strings when adding them to a TextView within |
| 188 | // a ListView |
| 189 | public final static int MAX_TEXTVIEW_LEN = 80; |
| 190 | |
Jeff Davidson | 4361029 | 2010-07-16 16:03:58 -0700 | [diff] [blame] | 191 | public static final String RLZ_PROVIDER = "com.google.android.partnersetup.rlzappprovider"; |
| 192 | |
| 193 | public static final Uri RLZ_PROVIDER_URI = Uri.parse("content://" + RLZ_PROVIDER + "/"); |
| 194 | |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 195 | // Set to true to enable some of the about:debug options |
John Reck | 9eed0ef | 2011-01-11 17:11:37 -0800 | [diff] [blame] | 196 | public static final boolean DEV_BUILD = false; |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 197 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 198 | private Controller mController; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 199 | |
| 200 | // Single instance of the BrowserSettings for use in the Browser app. |
| 201 | private static BrowserSettings sSingleton; |
| 202 | |
| 203 | // Private map of WebSettings to Observer objects used when deleting an |
| 204 | // observer. |
| 205 | private HashMap<WebSettings,Observer> mWebSettingsToObservers = |
| 206 | new HashMap<WebSettings,Observer>(); |
| 207 | |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 208 | private boolean mLoadFromDbComplete; |
| 209 | |
| 210 | public void waitForLoadFromDbToComplete() { |
| 211 | synchronized (sSingleton) { |
| 212 | while (!mLoadFromDbComplete) { |
| 213 | try { |
| 214 | sSingleton.wait(); |
| 215 | } catch (InterruptedException e) { } |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 220 | /* |
| 221 | * An observer wrapper for updating a WebSettings object with the new |
| 222 | * settings after a call to BrowserSettings.update(). |
| 223 | */ |
| 224 | static class Observer implements java.util.Observer { |
| 225 | // Private WebSettings object that will be updated. |
| 226 | private WebSettings mSettings; |
| 227 | |
| 228 | Observer(WebSettings w) { |
| 229 | mSettings = w; |
| 230 | } |
| 231 | |
| 232 | public void update(Observable o, Object arg) { |
| 233 | BrowserSettings b = (BrowserSettings)o; |
| 234 | WebSettings s = mSettings; |
| 235 | |
| 236 | s.setLayoutAlgorithm(b.layoutAlgorithm); |
| 237 | if (b.userAgent == 0) { |
| 238 | // use the default ua string |
| 239 | s.setUserAgentString(null); |
| 240 | } else if (b.userAgent == 1) { |
| 241 | s.setUserAgentString(DESKTOP_USERAGENT); |
| 242 | } else if (b.userAgent == 2) { |
| 243 | s.setUserAgentString(IPHONE_USERAGENT); |
Bart Sears | f6915fb | 2010-07-08 19:58:22 -0700 | [diff] [blame] | 244 | } else if (b.userAgent == 3) { |
| 245 | s.setUserAgentString(IPAD_USERAGENT); |
| 246 | } else if (b.userAgent == 4) { |
| 247 | s.setUserAgentString(FROYO_USERAGENT); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 248 | } |
| 249 | s.setUseWideViewPort(b.useWideViewPort); |
| 250 | s.setLoadsImagesAutomatically(b.loadsImagesAutomatically); |
| 251 | s.setJavaScriptEnabled(b.javaScriptEnabled); |
Teng-Hui Zhu | 930ea22 | 2011-02-16 11:22:21 -0800 | [diff] [blame] | 252 | s.setShowVisualIndicator(b.showVisualIndicator); |
Patrick Scott | e536b33 | 2010-03-22 10:19:32 -0400 | [diff] [blame] | 253 | s.setPluginState(b.pluginState); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 254 | s.setJavaScriptCanOpenWindowsAutomatically( |
| 255 | b.javaScriptCanOpenWindowsAutomatically); |
| 256 | s.setDefaultTextEncodingName(b.defaultTextEncodingName); |
| 257 | s.setMinimumFontSize(b.minimumFontSize); |
| 258 | s.setMinimumLogicalFontSize(b.minimumLogicalFontSize); |
| 259 | s.setDefaultFontSize(b.defaultFontSize); |
| 260 | s.setDefaultFixedFontSize(b.defaultFixedFontSize); |
| 261 | s.setNavDump(b.navDump); |
| 262 | s.setTextSize(b.textSize); |
Grace Kloba | 2f83068 | 2009-06-25 11:08:53 -0700 | [diff] [blame] | 263 | s.setDefaultZoom(b.zoomDensity); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 264 | s.setLightTouchEnabled(b.lightTouch); |
| 265 | s.setSaveFormData(b.saveFormData); |
Ben Murdoch | ce549fc | 2010-09-09 10:28:08 +0100 | [diff] [blame] | 266 | s.setAutoFillEnabled(b.autoFillEnabled); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 267 | s.setSavePassword(b.rememberPasswords); |
Grace Kloba | 5b4b8f1 | 2009-08-05 17:19:17 -0700 | [diff] [blame] | 268 | s.setLoadWithOverviewMode(b.loadsPageInOverviewMode); |
Grace Kloba | 7956503 | 2009-11-24 14:23:39 -0800 | [diff] [blame] | 269 | s.setPageCacheCapacity(pageCacheCapacity); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 270 | |
| 271 | // WebView inside Browser doesn't want initial focus to be set. |
| 272 | s.setNeedInitialFocus(false); |
| 273 | // Browser supports multiple windows |
| 274 | s.setSupportMultipleWindows(true); |
Grace Kloba | 61fc77c | 2010-06-22 09:57:33 -0700 | [diff] [blame] | 275 | // enable smooth transition for better performance during panning or |
| 276 | // zooming |
| 277 | s.setEnableSmoothTransition(true); |
Patrick Scott | b92bbb4 | 2011-01-05 11:38:58 -0500 | [diff] [blame] | 278 | // disable content url access |
| 279 | s.setAllowContentAccess(false); |
Ben Murdoch | 092dd5d | 2009-04-22 12:34:12 +0100 | [diff] [blame] | 280 | |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 281 | // HTML5 API flags |
| 282 | s.setAppCacheEnabled(b.appCacheEnabled); |
Ben Murdoch | 092dd5d | 2009-04-22 12:34:12 +0100 | [diff] [blame] | 283 | s.setDatabaseEnabled(b.databaseEnabled); |
Ben Murdoch | 734a066 | 2009-06-02 19:11:52 +0100 | [diff] [blame] | 284 | s.setDomStorageEnabled(b.domStorageEnabled); |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 285 | s.setWorkersEnabled(b.workersEnabled); // This only affects V8. |
Steve Block | 97b0802 | 2009-08-21 10:26:25 +0100 | [diff] [blame] | 286 | s.setGeolocationEnabled(b.geolocationEnabled); |
Ben Murdoch | 092dd5d | 2009-04-22 12:34:12 +0100 | [diff] [blame] | 287 | |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 288 | // HTML5 configuration parameters. |
Andrei Popescu | 20634ce | 2009-07-22 16:46:55 +0100 | [diff] [blame] | 289 | s.setAppCacheMaxSize(b.appCacheMaxSize); |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 290 | s.setAppCachePath(b.appCachePath); |
| 291 | s.setDatabasePath(b.databasePath); |
Steve Block | 5029cf0 | 2009-08-21 13:16:58 +0100 | [diff] [blame] | 292 | s.setGeolocationDatabasePath(b.geolocationDatabasePath); |
Ben Murdoch | bff2d60 | 2009-07-01 20:19:05 +0100 | [diff] [blame] | 293 | |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 294 | // Active AutoFill profile data. |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 295 | s.setAutoFillProfile(b.autoFillProfile); |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 296 | |
Shimeng (Simon) Wang | 161974f | 2010-03-09 14:30:07 -0800 | [diff] [blame] | 297 | b.updateTabControlSettings(); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 298 | } |
| 299 | } |
| 300 | |
| 301 | /** |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 302 | * Load settings from the browser app's database. It is performed in |
| 303 | * an AsyncTask as it involves plenty of slow disk IO. |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 304 | * NOTE: Strings used for the preferences must match those specified |
Jeff Hamilton | 175ab30 | 2010-10-04 12:53:49 -0500 | [diff] [blame] | 305 | * in the various preference XML files. |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 306 | * @param ctx A Context object used to query the browser's settings |
| 307 | * database. If the database exists, the saved settings will be |
| 308 | * stored in this BrowserSettings object. This will update all |
| 309 | * observers of this object. |
| 310 | */ |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 311 | public void asyncLoadFromDb(final Context ctx) { |
| 312 | mLoadFromDbComplete = false; |
| 313 | // Run the initial settings load in an AsyncTask as it hits the |
| 314 | // disk multiple times through SharedPreferences and SQLite. We |
| 315 | // need to be certain though that this has completed before we start |
| 316 | // to load pages though, so in the worst case we will block waiting |
| 317 | // for it to finish in BrowserActivity.onCreate(). |
| 318 | new LoadFromDbTask(ctx).execute(); |
| 319 | } |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 320 | |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 321 | private class LoadFromDbTask extends AsyncTask<Void, Void, Void> { |
| 322 | private Context mContext; |
| 323 | |
| 324 | public LoadFromDbTask(Context context) { |
| 325 | mContext = context; |
Shimeng (Simon) Wang | e83e906 | 2010-03-29 16:13:09 -0700 | [diff] [blame] | 326 | } |
Ramanan Rajeswaran | dd4f429 | 2009-03-24 20:41:19 -0700 | [diff] [blame] | 327 | |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 328 | protected Void doInBackground(Void... unused) { |
| 329 | SharedPreferences p = |
| 330 | PreferenceManager.getDefaultSharedPreferences(mContext); |
| 331 | // Set the default value for the Application Caches path. |
| 332 | appCachePath = mContext.getDir("appcache", 0).getPath(); |
| 333 | // Determine the maximum size of the application cache. |
| 334 | webStorageSizeManager = new WebStorageSizeManager( |
| 335 | mContext, |
| 336 | new WebStorageSizeManager.StatFsDiskInfo(appCachePath), |
| 337 | new WebStorageSizeManager.WebKitAppCacheInfo(appCachePath)); |
| 338 | appCacheMaxSize = webStorageSizeManager.getAppCacheMaxSize(); |
| 339 | // Set the default value for the Database path. |
| 340 | databasePath = mContext.getDir("databases", 0).getPath(); |
| 341 | // Set the default value for the Geolocation database path. |
| 342 | geolocationDatabasePath = mContext.getDir("geolocation", 0).getPath(); |
| 343 | |
John Reck | ef07426 | 2010-12-02 16:09:14 -0800 | [diff] [blame] | 344 | if (p.getString(PREF_HOMEPAGE, null) == null) { |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 345 | // No home page preferences is set, set it to default. |
| 346 | setHomePage(mContext, getFactoryResetHomeUrl(mContext)); |
| 347 | } |
| 348 | |
| 349 | // the cost of one cached page is ~3M (measured using nytimes.com). For |
| 350 | // low end devices, we only cache one page. For high end devices, we try |
| 351 | // to cache more pages, currently choose 5. |
| 352 | ActivityManager am = (ActivityManager) mContext |
| 353 | .getSystemService(Context.ACTIVITY_SERVICE); |
| 354 | if (am.getMemoryClass() > 16) { |
| 355 | pageCacheCapacity = 5; |
| 356 | } else { |
| 357 | pageCacheCapacity = 1; |
| 358 | } |
| 359 | |
| 360 | // Read the last active AutoFill profile id. |
| 361 | autoFillActiveProfileId = p.getInt( |
| 362 | PREF_AUTOFILL_ACTIVE_PROFILE_ID, autoFillActiveProfileId); |
| 363 | |
| 364 | // Load the autofill profile data from the database. We use a database separate |
| 365 | // to the browser preference DB to make it easier to support multiple profiles |
| 366 | // and switching between them. |
| 367 | AutoFillProfileDatabase autoFillDb = AutoFillProfileDatabase.getInstance(mContext); |
| 368 | Cursor c = autoFillDb.getProfile(autoFillActiveProfileId); |
| 369 | |
| 370 | if (c.getCount() > 0) { |
| 371 | c.moveToFirst(); |
| 372 | |
| 373 | String fullName = c.getString(c.getColumnIndex( |
| 374 | AutoFillProfileDatabase.Profiles.FULL_NAME)); |
| 375 | String email = c.getString(c.getColumnIndex( |
| 376 | AutoFillProfileDatabase.Profiles.EMAIL_ADDRESS)); |
| 377 | String company = c.getString(c.getColumnIndex( |
| 378 | AutoFillProfileDatabase.Profiles.COMPANY_NAME)); |
| 379 | String addressLine1 = c.getString(c.getColumnIndex( |
| 380 | AutoFillProfileDatabase.Profiles.ADDRESS_LINE_1)); |
| 381 | String addressLine2 = c.getString(c.getColumnIndex( |
| 382 | AutoFillProfileDatabase.Profiles.ADDRESS_LINE_2)); |
| 383 | String city = c.getString(c.getColumnIndex( |
| 384 | AutoFillProfileDatabase.Profiles.CITY)); |
| 385 | String state = c.getString(c.getColumnIndex( |
| 386 | AutoFillProfileDatabase.Profiles.STATE)); |
| 387 | String zip = c.getString(c.getColumnIndex( |
| 388 | AutoFillProfileDatabase.Profiles.ZIP_CODE)); |
| 389 | String country = c.getString(c.getColumnIndex( |
| 390 | AutoFillProfileDatabase.Profiles.COUNTRY)); |
| 391 | String phone = c.getString(c.getColumnIndex( |
| 392 | AutoFillProfileDatabase.Profiles.PHONE_NUMBER)); |
| 393 | autoFillProfile = new AutoFillProfile(autoFillActiveProfileId, |
| 394 | fullName, email, company, addressLine1, addressLine2, city, |
| 395 | state, zip, country, phone); |
| 396 | } |
| 397 | c.close(); |
| 398 | autoFillDb.close(); |
| 399 | |
| 400 | // PreferenceManager.setDefaultValues is TOO SLOW, need to manually keep |
| 401 | // the defaults in sync |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 402 | p.registerOnSharedPreferenceChangeListener(BrowserSettings.this); |
Ben Murdoch | ef67165 | 2010-11-25 17:17:58 +0000 | [diff] [blame] | 403 | syncSharedPreferences(mContext, p); |
| 404 | |
| 405 | synchronized (sSingleton) { |
| 406 | mLoadFromDbComplete = true; |
| 407 | sSingleton.notify(); |
| 408 | } |
| 409 | return null; |
Grace Kloba | 9804c43 | 2009-12-02 11:07:40 -0800 | [diff] [blame] | 410 | } |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 411 | } |
| 412 | |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 413 | private void updateSearchEngine(Context ctx, String searchEngineName, boolean force) { |
| 414 | if (force || searchEngine == null || |
| 415 | !searchEngine.getName().equals(searchEngineName)) { |
| 416 | if (searchEngine != null) { |
| 417 | if (searchEngine.supportsVoiceSearch()) { |
| 418 | // One or more tabs could have been in voice search mode. |
| 419 | // Clear it, since the new SearchEngine may not support |
| 420 | // it, or may handle it differently. |
| 421 | for (int i = 0; i < mController.getTabControl().getTabCount(); i++) { |
| 422 | mController.getTabControl().getTab(i).revertVoiceSearchMode(); |
| 423 | } |
| 424 | } |
| 425 | searchEngine.close(); |
| 426 | } |
| 427 | searchEngine = SearchEngines.get(ctx, searchEngineName); |
| 428 | |
| 429 | if (mController != null && (searchEngine instanceof InstantSearchEngine)) { |
| 430 | ((InstantSearchEngine) searchEngine).setController(mController); |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
Bjorn Bringert | d69f51d | 2010-09-13 14:06:41 +0100 | [diff] [blame] | 435 | /* package */ void syncSharedPreferences(Context ctx, SharedPreferences p) { |
Ramanan Rajeswaran | dd4f429 | 2009-03-24 20:41:19 -0700 | [diff] [blame] | 436 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 437 | homeUrl = |
| 438 | p.getString(PREF_HOMEPAGE, homeUrl); |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 439 | |
| 440 | useInstant = p.getBoolean(PREF_USE_INSTANT, useInstant); |
Leon Scroggins III | 3130660 | 2010-09-17 11:10:29 -0400 | [diff] [blame] | 441 | String searchEngineName = p.getString(PREF_SEARCH_ENGINE, |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 442 | SearchEngine.GOOGLE); |
| 443 | updateSearchEngine(ctx, searchEngineName, false); |
Ramanan Rajeswaran | dd4f429 | 2009-03-24 20:41:19 -0700 | [diff] [blame] | 444 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 445 | loadsImagesAutomatically = p.getBoolean("load_images", |
| 446 | loadsImagesAutomatically); |
| 447 | javaScriptEnabled = p.getBoolean("enable_javascript", |
| 448 | javaScriptEnabled); |
Patrick Scott | e536b33 | 2010-03-22 10:19:32 -0400 | [diff] [blame] | 449 | pluginState = WebSettings.PluginState.valueOf( |
John Reck | 282431b | 2011-01-20 17:38:37 -0800 | [diff] [blame] | 450 | p.getString(PREF_PLUGIN_STATE, pluginState.name())); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 451 | javaScriptCanOpenWindowsAutomatically = !p.getBoolean( |
| 452 | "block_popup_windows", |
| 453 | !javaScriptCanOpenWindowsAutomatically); |
| 454 | showSecurityWarnings = p.getBoolean("show_security_warnings", |
| 455 | showSecurityWarnings); |
| 456 | rememberPasswords = p.getBoolean("remember_passwords", |
| 457 | rememberPasswords); |
| 458 | saveFormData = p.getBoolean("save_formdata", |
| 459 | saveFormData); |
Ben Murdoch | af55452 | 2010-09-10 22:09:30 +0100 | [diff] [blame] | 460 | autoFillEnabled = p.getBoolean("autofill_enabled", autoFillEnabled); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 461 | boolean accept_cookies = p.getBoolean("accept_cookies", |
| 462 | CookieManager.getInstance().acceptCookie()); |
| 463 | CookieManager.getInstance().setAcceptCookie(accept_cookies); |
| 464 | openInBackground = p.getBoolean("open_in_background", openInBackground); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 465 | textSize = WebSettings.TextSize.valueOf( |
| 466 | p.getString(PREF_TEXT_SIZE, textSize.name())); |
Grace Kloba | 2f83068 | 2009-06-25 11:08:53 -0700 | [diff] [blame] | 467 | zoomDensity = WebSettings.ZoomDensity.valueOf( |
| 468 | p.getString(PREF_DEFAULT_ZOOM, zoomDensity.name())); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 469 | autoFitPage = p.getBoolean("autofit_pages", autoFitPage); |
Grace Kloba | 5b4b8f1 | 2009-08-05 17:19:17 -0700 | [diff] [blame] | 470 | loadsPageInOverviewMode = p.getBoolean("load_page", |
| 471 | loadsPageInOverviewMode); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 472 | useWideViewPort = true; // use wide view port for either setting |
| 473 | if (autoFitPage) { |
| 474 | layoutAlgorithm = WebSettings.LayoutAlgorithm.NARROW_COLUMNS; |
| 475 | } else { |
| 476 | layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL; |
| 477 | } |
| 478 | defaultTextEncodingName = |
| 479 | p.getString(PREF_DEFAULT_TEXT_ENCODING, |
| 480 | defaultTextEncodingName); |
| 481 | |
| 482 | showDebugSettings = |
| 483 | p.getBoolean(PREF_DEBUG_SETTINGS, showDebugSettings); |
| 484 | // Debug menu items have precidence if the menu is visible |
| 485 | if (showDebugSettings) { |
| 486 | boolean small_screen = p.getBoolean("small_screen", |
| 487 | layoutAlgorithm == |
| 488 | WebSettings.LayoutAlgorithm.SINGLE_COLUMN); |
| 489 | if (small_screen) { |
| 490 | layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN; |
| 491 | } else { |
| 492 | boolean normal_layout = p.getBoolean("normal_layout", |
| 493 | layoutAlgorithm == WebSettings.LayoutAlgorithm.NORMAL); |
| 494 | if (normal_layout) { |
| 495 | layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL; |
| 496 | } else { |
| 497 | layoutAlgorithm = |
| 498 | WebSettings.LayoutAlgorithm.NARROW_COLUMNS; |
| 499 | } |
| 500 | } |
| 501 | useWideViewPort = p.getBoolean("wide_viewport", useWideViewPort); |
| 502 | tracing = p.getBoolean("enable_tracing", tracing); |
| 503 | lightTouch = p.getBoolean("enable_light_touch", lightTouch); |
| 504 | navDump = p.getBoolean("enable_nav_dump", navDump); |
Teng-Hui Zhu | 930ea22 | 2011-02-16 11:22:21 -0800 | [diff] [blame] | 505 | showVisualIndicator = p.getBoolean(PREF_VISUAL_INDICATOR, showVisualIndicator); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 506 | } |
Derek Sollenberger | ffa561e | 2010-11-16 14:19:01 -0500 | [diff] [blame] | 507 | |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 508 | quickControls = p.getBoolean(PREF_QUICK_CONTROLS, quickControls); |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 509 | useMostVisitedHomepage = p.getBoolean(PREF_MOST_VISITED_HOMEPAGE, useMostVisitedHomepage); |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 510 | |
John Reck | 3db2e07 | 2011-01-24 14:57:18 -0800 | [diff] [blame] | 511 | // Only set these if this is a dev build or debug is enabled |
| 512 | if (DEV_BUILD || showDebugSettings()) { |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 513 | userAgent = Integer.parseInt(p.getString(PREF_USER_AGENT, "0")); |
| 514 | hardwareAccelerated = p.getBoolean(PREF_HARDWARE_ACCEL, hardwareAccelerated); |
| 515 | } |
Derek Sollenberger | ffa561e | 2010-11-16 14:19:01 -0500 | [diff] [blame] | 516 | |
Feng Qian | b3c02da | 2009-06-29 15:58:08 -0700 | [diff] [blame] | 517 | // JS flags is loaded from DB even if showDebugSettings is false, |
| 518 | // so that it can be set once and be effective all the time. |
| 519 | jsFlags = p.getString("js_engine_flags", ""); |
Ben Murdoch | bff2d60 | 2009-07-01 20:19:05 +0100 | [diff] [blame] | 520 | |
| 521 | // Read the setting for showing/hiding the JS Console always so that should the |
| 522 | // user enable debug settings, we already know if we should show the console. |
| 523 | // The user will never see the console unless they navigate to about:debug, |
| 524 | // regardless of the setting we read here. This setting is only used after debug |
| 525 | // is enabled. |
| 526 | showConsole = p.getBoolean("javascript_console", showConsole); |
Grace Kloba | d9ee139 | 2009-07-20 11:53:33 -0700 | [diff] [blame] | 527 | |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 528 | // HTML5 API flags |
| 529 | appCacheEnabled = p.getBoolean("enable_appcache", appCacheEnabled); |
| 530 | databaseEnabled = p.getBoolean("enable_database", databaseEnabled); |
| 531 | domStorageEnabled = p.getBoolean("enable_domstorage", domStorageEnabled); |
Steve Block | f344d03 | 2009-07-30 10:50:45 +0100 | [diff] [blame] | 532 | geolocationEnabled = p.getBoolean("enable_geolocation", geolocationEnabled); |
Andrei Popescu | 0106870 | 2009-08-03 16:03:24 +0100 | [diff] [blame] | 533 | workersEnabled = p.getBoolean("enable_workers", workersEnabled); |
Steve Block | f344d03 | 2009-07-30 10:50:45 +0100 | [diff] [blame] | 534 | |
Grace Kloba | d9ee139 | 2009-07-20 11:53:33 -0700 | [diff] [blame] | 535 | update(); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 536 | } |
| 537 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 538 | public String getHomePage() { |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 539 | if (useMostVisitedHomepage) { |
| 540 | return HomeProvider.MOST_VISITED; |
| 541 | } |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 542 | return homeUrl; |
| 543 | } |
| 544 | |
Bjorn Bringert | d69f51d | 2010-09-13 14:06:41 +0100 | [diff] [blame] | 545 | public SearchEngine getSearchEngine() { |
| 546 | return searchEngine; |
| 547 | } |
| 548 | |
Feng Qian | b3c02da | 2009-06-29 15:58:08 -0700 | [diff] [blame] | 549 | public String getJsFlags() { |
| 550 | return jsFlags; |
| 551 | } |
| 552 | |
Andrei Popescu | 79e82b7 | 2009-07-27 12:01:59 +0100 | [diff] [blame] | 553 | public WebStorageSizeManager getWebStorageSizeManager() { |
| 554 | return webStorageSizeManager; |
| 555 | } |
| 556 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 557 | public void setHomePage(Context context, String url) { |
| 558 | Editor ed = PreferenceManager. |
| 559 | getDefaultSharedPreferences(context).edit(); |
| 560 | ed.putString(PREF_HOMEPAGE, url); |
Brad Fitzpatrick | 1a6e0e8 | 2010-09-01 16:29:03 -0700 | [diff] [blame] | 561 | ed.apply(); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 562 | homeUrl = url; |
| 563 | } |
| 564 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 565 | public WebSettings.TextSize getTextSize() { |
| 566 | return textSize; |
| 567 | } |
| 568 | |
Grace Kloba | 2f83068 | 2009-06-25 11:08:53 -0700 | [diff] [blame] | 569 | public WebSettings.ZoomDensity getDefaultZoom() { |
| 570 | return zoomDensity; |
| 571 | } |
| 572 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 573 | public boolean openInBackground() { |
| 574 | return openInBackground; |
| 575 | } |
| 576 | |
| 577 | public boolean showSecurityWarnings() { |
| 578 | return showSecurityWarnings; |
| 579 | } |
| 580 | |
| 581 | public boolean isTracing() { |
| 582 | return tracing; |
| 583 | } |
| 584 | |
| 585 | public boolean isLightTouch() { |
| 586 | return lightTouch; |
| 587 | } |
| 588 | |
| 589 | public boolean isNavDump() { |
| 590 | return navDump; |
| 591 | } |
| 592 | |
Derek Sollenberger | ffa561e | 2010-11-16 14:19:01 -0500 | [diff] [blame] | 593 | public boolean isHardwareAccelerated() { |
| 594 | return hardwareAccelerated; |
| 595 | } |
| 596 | |
Teng-Hui Zhu | 930ea22 | 2011-02-16 11:22:21 -0800 | [diff] [blame] | 597 | public boolean showVisualIndicator() { |
| 598 | return showVisualIndicator; |
| 599 | } |
| 600 | |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 601 | public boolean useQuickControls() { |
| 602 | return quickControls; |
| 603 | } |
| 604 | |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 605 | public boolean useMostVisitedHomepage() { |
| 606 | return useMostVisitedHomepage; |
| 607 | } |
| 608 | |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 609 | public boolean useInstant() { |
| 610 | return useInstant; |
| 611 | } |
| 612 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 613 | public boolean showDebugSettings() { |
| 614 | return showDebugSettings; |
| 615 | } |
| 616 | |
John Reck | 3db2e07 | 2011-01-24 14:57:18 -0800 | [diff] [blame] | 617 | public void toggleDebugSettings(Context context) { |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 618 | showDebugSettings = !showDebugSettings; |
| 619 | navDump = showDebugSettings; |
John Reck | 3db2e07 | 2011-01-24 14:57:18 -0800 | [diff] [blame] | 620 | syncSharedPreferences(context, |
| 621 | PreferenceManager.getDefaultSharedPreferences(context)); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 622 | update(); |
| 623 | } |
| 624 | |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 625 | public void setAutoFillProfile(Context ctx, AutoFillProfile profile, Message msg) { |
| 626 | if (profile != null) { |
| 627 | setActiveAutoFillProfileId(ctx, profile.getUniqueId()); |
| 628 | // Update the AutoFill DB with the new profile. |
| 629 | new SaveProfileToDbTask(ctx, msg).execute(profile); |
| 630 | } else { |
| 631 | // Delete the current profile. |
Ben Murdoch | e8a2833 | 2010-11-17 14:16:21 +0000 | [diff] [blame] | 632 | if (autoFillProfile != null) { |
| 633 | new DeleteProfileFromDbTask(ctx, msg).execute(autoFillProfile.getUniqueId()); |
| 634 | setActiveAutoFillProfileId(ctx, NO_AUTOFILL_PROFILE_SET); |
| 635 | } |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 636 | } |
| 637 | autoFillProfile = profile; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 638 | } |
| 639 | |
| 640 | public AutoFillProfile getAutoFillProfile() { |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 641 | return autoFillProfile; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 642 | } |
| 643 | |
Ben Murdoch | 6fa32ba | 2010-10-20 14:01:25 +0100 | [diff] [blame] | 644 | private void setActiveAutoFillProfileId(Context context, int activeProfileId) { |
| 645 | autoFillActiveProfileId = activeProfileId; |
| 646 | Editor ed = PreferenceManager. |
| 647 | getDefaultSharedPreferences(context).edit(); |
| 648 | ed.putInt(PREF_AUTOFILL_ACTIVE_PROFILE_ID, activeProfileId); |
| 649 | ed.apply(); |
| 650 | } |
| 651 | |
Ben Murdoch | 8029a77 | 2010-11-16 11:58:21 +0000 | [diff] [blame] | 652 | /* package */ void disableAutoFill(Context ctx) { |
| 653 | autoFillEnabled = false; |
| 654 | Editor ed = PreferenceManager.getDefaultSharedPreferences(ctx).edit(); |
| 655 | ed.putBoolean(PREF_AUTOFILL_ENABLED, false); |
| 656 | ed.apply(); |
| 657 | } |
| 658 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 659 | /** |
| 660 | * Add a WebSettings object to the list of observers that will be updated |
| 661 | * when update() is called. |
| 662 | * |
| 663 | * @param s A WebSettings object that is strictly tied to the life of a |
| 664 | * WebView. |
| 665 | */ |
| 666 | public Observer addObserver(WebSettings s) { |
| 667 | Observer old = mWebSettingsToObservers.get(s); |
| 668 | if (old != null) { |
| 669 | super.deleteObserver(old); |
| 670 | } |
| 671 | Observer o = new Observer(s); |
| 672 | mWebSettingsToObservers.put(s, o); |
| 673 | super.addObserver(o); |
| 674 | return o; |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * Delete the given WebSettings observer from the list of observers. |
| 679 | * @param s The WebSettings object to be deleted. |
| 680 | */ |
| 681 | public void deleteObserver(WebSettings s) { |
| 682 | Observer o = mWebSettingsToObservers.get(s); |
| 683 | if (o != null) { |
| 684 | mWebSettingsToObservers.remove(s); |
| 685 | super.deleteObserver(o); |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | /* |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 690 | * Application level method for obtaining a single app instance of the |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 691 | * BrowserSettings. |
| 692 | */ |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 693 | public static BrowserSettings getInstance() { |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 694 | if (sSingleton == null ) { |
| 695 | sSingleton = new BrowserSettings(); |
| 696 | } |
| 697 | return sSingleton; |
| 698 | } |
| 699 | |
| 700 | /* |
| 701 | * Package level method for associating the BrowserSettings with TabControl |
| 702 | */ |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 703 | /* package */void setController(Controller ctrl) { |
| 704 | mController = ctrl; |
Shimeng (Simon) Wang | 161974f | 2010-03-09 14:30:07 -0800 | [diff] [blame] | 705 | updateTabControlSettings(); |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 706 | |
| 707 | if (mController != null && (searchEngine instanceof InstantSearchEngine)) { |
| 708 | ((InstantSearchEngine) searchEngine).setController(mController); |
| 709 | } |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | /* |
| 713 | * Update all the observers of the object. |
| 714 | */ |
| 715 | /*package*/ void update() { |
| 716 | setChanged(); |
| 717 | notifyObservers(); |
| 718 | } |
| 719 | |
| 720 | /*package*/ void clearCache(Context context) { |
| 721 | WebIconDatabase.getInstance().removeAllIcons(); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 722 | if (mController != null) { |
| 723 | WebView current = mController.getCurrentWebView(); |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 724 | if (current != null) { |
| 725 | current.clearCache(true); |
| 726 | } |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | /*package*/ void clearCookies(Context context) { |
| 731 | CookieManager.getInstance().removeAllCookie(); |
| 732 | } |
| 733 | |
| 734 | /* package */void clearHistory(Context context) { |
| 735 | ContentResolver resolver = context.getContentResolver(); |
| 736 | Browser.clearHistory(resolver); |
| 737 | Browser.clearSearches(resolver); |
| 738 | } |
| 739 | |
| 740 | /* package */ void clearFormData(Context context) { |
| 741 | WebViewDatabase.getInstance(context).clearFormData(); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 742 | if (mController!= null) { |
| 743 | WebView currentTopView = mController.getCurrentTopWebView(); |
Henrik Baard | 794dc72 | 2010-02-19 16:28:06 +0100 | [diff] [blame] | 744 | if (currentTopView != null) { |
| 745 | currentTopView.clearFormData(); |
| 746 | } |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 747 | } |
| 748 | } |
| 749 | |
| 750 | /*package*/ void clearPasswords(Context context) { |
| 751 | WebViewDatabase db = WebViewDatabase.getInstance(context); |
| 752 | db.clearUsernamePassword(); |
| 753 | db.clearHttpAuthUsernamePassword(); |
| 754 | } |
| 755 | |
Shimeng (Simon) Wang | 161974f | 2010-03-09 14:30:07 -0800 | [diff] [blame] | 756 | private void updateTabControlSettings() { |
| 757 | // Enable/disable the error console. |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 758 | mController.setShouldShowErrorConsole( |
Shimeng (Simon) Wang | 161974f | 2010-03-09 14:30:07 -0800 | [diff] [blame] | 759 | showDebugSettings && showConsole); |
Shimeng (Simon) Wang | 161974f | 2010-03-09 14:30:07 -0800 | [diff] [blame] | 760 | } |
| 761 | |
Nicolas Roard | 78a98e4 | 2009-05-11 13:34:17 +0100 | [diff] [blame] | 762 | /*package*/ void clearDatabases(Context context) { |
Andrei Popescu | 824faeb | 2009-07-21 18:24:06 +0100 | [diff] [blame] | 763 | WebStorage.getInstance().deleteAllData(); |
Steve Block | f344d03 | 2009-07-30 10:50:45 +0100 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | /*package*/ void clearLocationAccess(Context context) { |
| 767 | GeolocationPermissions.getInstance().clearAll(); |
Nicolas Roard | 78a98e4 | 2009-05-11 13:34:17 +0100 | [diff] [blame] | 768 | } |
| 769 | |
Leon Scroggins | 9ac587d | 2009-04-20 12:53:46 -0400 | [diff] [blame] | 770 | /*package*/ void resetDefaultPreferences(Context ctx) { |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 771 | reset(); |
Jeff Hamilton | 462b8e8 | 2010-09-23 14:33:43 -0500 | [diff] [blame] | 772 | SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(ctx); |
Brad Fitzpatrick | 1a6e0e8 | 2010-09-01 16:29:03 -0700 | [diff] [blame] | 773 | p.edit().clear().apply(); |
John Reck | 035a564 | 2010-12-21 18:51:27 -0800 | [diff] [blame] | 774 | PreferenceManager.setDefaultValues(ctx, R.xml.general_preferences, true); |
| 775 | PreferenceManager.setDefaultValues(ctx, R.xml.privacy_security_preferences, true); |
Jeff Hamilton | 462b8e8 | 2010-09-23 14:33:43 -0500 | [diff] [blame] | 776 | PreferenceManager.setDefaultValues(ctx, R.xml.advanced_preferences, true); |
Grace Kloba | f2c5c1b | 2009-05-26 10:48:31 -0700 | [diff] [blame] | 777 | // reset homeUrl |
Grace Kloba | a3f90f0 | 2009-05-26 11:32:53 -0700 | [diff] [blame] | 778 | setHomePage(ctx, getFactoryResetHomeUrl(ctx)); |
Andrei Popescu | 79e82b7 | 2009-07-27 12:01:59 +0100 | [diff] [blame] | 779 | // reset appcache max size |
| 780 | appCacheMaxSize = webStorageSizeManager.getAppCacheMaxSize(); |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 781 | setActiveAutoFillProfileId(ctx, NO_AUTOFILL_PROFILE_SET); |
Grace Kloba | f2c5c1b | 2009-05-26 10:48:31 -0700 | [diff] [blame] | 782 | } |
| 783 | |
John Reck | 33bbb80 | 2010-10-26 17:13:42 -0700 | [diff] [blame] | 784 | /*package*/ static String getFactoryResetHomeUrl(Context context) { |
Grace Kloba | f2c5c1b | 2009-05-26 10:48:31 -0700 | [diff] [blame] | 785 | String url = context.getResources().getString(R.string.homepage_base); |
| 786 | if (url.indexOf("{CID}") != -1) { |
Patrick Scott | 4391469 | 2010-02-19 10:10:10 -0500 | [diff] [blame] | 787 | url = url.replace("{CID}", |
| 788 | BrowserProvider.getClientId(context.getContentResolver())); |
Grace Kloba | f2c5c1b | 2009-05-26 10:48:31 -0700 | [diff] [blame] | 789 | } |
| 790 | return url; |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 791 | } |
| 792 | |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 793 | // Private constructor that does nothing. |
| 794 | private BrowserSettings() { |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 795 | reset(); |
| 796 | } |
| 797 | |
| 798 | private void reset() { |
| 799 | // Private variables for settings |
| 800 | // NOTE: these defaults need to be kept in sync with the XML |
| 801 | // until the performance of PreferenceManager.setDefaultValues() |
| 802 | // is improved. |
| 803 | loadsImagesAutomatically = true; |
| 804 | javaScriptEnabled = true; |
Patrick Scott | e536b33 | 2010-03-22 10:19:32 -0400 | [diff] [blame] | 805 | pluginState = WebSettings.PluginState.ON; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 806 | javaScriptCanOpenWindowsAutomatically = false; |
| 807 | showSecurityWarnings = true; |
| 808 | rememberPasswords = true; |
| 809 | saveFormData = true; |
Ben Murdoch | dc62cb9 | 2010-11-23 15:11:29 +0000 | [diff] [blame] | 810 | autoFillEnabled = true; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 811 | openInBackground = false; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 812 | autoFitPage = true; |
Shimeng (Simon) Wang | f739271 | 2010-03-10 16:44:31 -0800 | [diff] [blame] | 813 | loadsPageInOverviewMode = true; |
| 814 | showDebugSettings = false; |
| 815 | // HTML5 API flags |
| 816 | appCacheEnabled = true; |
| 817 | databaseEnabled = true; |
| 818 | domStorageEnabled = true; |
| 819 | geolocationEnabled = true; |
| 820 | workersEnabled = true; // only affects V8. JSC does not have a similar setting |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 821 | } |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 822 | |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 823 | private abstract class AutoFillProfileDbTask<T> extends AsyncTask<T, Void, Void> { |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 824 | Context mContext; |
Ben Murdoch | 36a23dd | 2010-10-13 13:20:06 +0100 | [diff] [blame] | 825 | AutoFillProfileDatabase mAutoFillProfileDb; |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 826 | Message mCompleteMessage; |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 827 | |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 828 | public AutoFillProfileDbTask(Context ctx, Message msg) { |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 829 | mContext = ctx; |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 830 | mCompleteMessage = msg; |
| 831 | } |
| 832 | |
| 833 | protected void onPostExecute(Void result) { |
| 834 | if (mCompleteMessage != null) { |
| 835 | mCompleteMessage.sendToTarget(); |
| 836 | } |
| 837 | mAutoFillProfileDb.close(); |
| 838 | } |
| 839 | |
| 840 | abstract protected Void doInBackground(T... values); |
| 841 | } |
| 842 | |
| 843 | |
| 844 | private class SaveProfileToDbTask extends AutoFillProfileDbTask<AutoFillProfile> { |
| 845 | public SaveProfileToDbTask(Context ctx, Message msg) { |
| 846 | super(ctx, msg); |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 847 | } |
| 848 | |
| 849 | protected Void doInBackground(AutoFillProfile... values) { |
Ben Murdoch | 36a23dd | 2010-10-13 13:20:06 +0100 | [diff] [blame] | 850 | mAutoFillProfileDb = AutoFillProfileDatabase.getInstance(mContext); |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 851 | assert autoFillActiveProfileId != NO_AUTOFILL_PROFILE_SET; |
| 852 | AutoFillProfile newProfile = values[0]; |
| 853 | mAutoFillProfileDb.addOrUpdateProfile(autoFillActiveProfileId, newProfile); |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 854 | return null; |
| 855 | } |
Ben Murdoch | 0cb8189 | 2010-10-08 12:41:33 +0100 | [diff] [blame] | 856 | } |
| 857 | |
Ben Murdoch | 23da30e | 2010-10-26 15:18:44 +0100 | [diff] [blame] | 858 | private class DeleteProfileFromDbTask extends AutoFillProfileDbTask<Integer> { |
| 859 | public DeleteProfileFromDbTask(Context ctx, Message msg) { |
| 860 | super(ctx, msg); |
| 861 | } |
| 862 | |
| 863 | protected Void doInBackground(Integer... values) { |
| 864 | mAutoFillProfileDb = AutoFillProfileDatabase.getInstance(mContext); |
| 865 | int id = values[0]; |
| 866 | assert id > 0; |
| 867 | mAutoFillProfileDb.dropProfile(id); |
| 868 | return null; |
| 869 | } |
| 870 | } |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 871 | |
| 872 | @Override |
| 873 | public void onSharedPreferenceChanged( |
| 874 | SharedPreferences p, String key) { |
| 875 | if (PREF_HARDWARE_ACCEL.equals(key)) { |
| 876 | hardwareAccelerated = p.getBoolean(PREF_HARDWARE_ACCEL, hardwareAccelerated); |
Teng-Hui Zhu | 930ea22 | 2011-02-16 11:22:21 -0800 | [diff] [blame] | 877 | } else if (PREF_VISUAL_INDICATOR.equals(key)) { |
| 878 | showVisualIndicator = p.getBoolean(PREF_VISUAL_INDICATOR, showVisualIndicator); |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 879 | } else if (PREF_USER_AGENT.equals(key)) { |
| 880 | userAgent = Integer.parseInt(p.getString(PREF_USER_AGENT, "0")); |
| 881 | update(); |
Michael Kolb | 376b541 | 2010-12-15 11:52:57 -0800 | [diff] [blame] | 882 | } else if (PREF_QUICK_CONTROLS.equals(key)) { |
| 883 | quickControls = p.getBoolean(PREF_QUICK_CONTROLS, quickControls); |
John Reck | bafe58a | 2011-01-11 10:26:02 -0800 | [diff] [blame] | 884 | } else if (PREF_MOST_VISITED_HOMEPAGE.equals(key)) { |
| 885 | useMostVisitedHomepage = p.getBoolean(PREF_MOST_VISITED_HOMEPAGE, useMostVisitedHomepage); |
Narayan Kamath | 5119edd | 2011-02-23 15:49:17 +0000 | [diff] [blame] | 886 | } else if (PREF_USE_INSTANT.equals(key)) { |
| 887 | useInstant = p.getBoolean(PREF_USE_INSTANT, useInstant); |
| 888 | updateSearchEngine(mController.getActivity(), SearchEngine.GOOGLE, true); |
| 889 | } else if (PREF_SEARCH_ENGINE.equals(key)) { |
| 890 | final String searchEngineName = p.getString(PREF_SEARCH_ENGINE, |
| 891 | SearchEngine.GOOGLE); |
| 892 | updateSearchEngine(mController.getActivity(), searchEngineName, false); |
John Reck | 63bb687 | 2010-12-01 19:29:32 -0800 | [diff] [blame] | 893 | } |
| 894 | } |
The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame] | 895 | } |