| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.os.Handler; | 7 import android.os.Handler; |
| 8 import android.os.Looper; | 8 import android.os.Looper; |
| 9 import android.os.Message; | 9 import android.os.Message; |
| 10 import android.webkit.WebSettings.PluginState; | 10 import android.webkit.WebSettings.PluginState; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 private boolean mJavaScriptEnabled = false; | 85 private boolean mJavaScriptEnabled = false; |
| 86 private boolean mAllowUniversalAccessFromFileURLs = false; | 86 private boolean mAllowUniversalAccessFromFileURLs = false; |
| 87 private boolean mAllowFileAccessFromFileURLs = false; | 87 private boolean mAllowFileAccessFromFileURLs = false; |
| 88 private boolean mJavaScriptCanOpenWindowsAutomatically = false; | 88 private boolean mJavaScriptCanOpenWindowsAutomatically = false; |
| 89 private boolean mSupportMultipleWindows = false; | 89 private boolean mSupportMultipleWindows = false; |
| 90 private PluginState mPluginState = PluginState.OFF; | 90 private PluginState mPluginState = PluginState.OFF; |
| 91 private boolean mAppCacheEnabled = false; | 91 private boolean mAppCacheEnabled = false; |
| 92 private boolean mDomStorageEnabled = false; | 92 private boolean mDomStorageEnabled = false; |
| 93 private boolean mDatabaseEnabled = false; | 93 private boolean mDatabaseEnabled = false; |
| 94 private boolean mUseWideViewport = false; | 94 private boolean mUseWideViewport = false; |
| 95 private boolean mLoadWithOverviewMode = false; |
| 95 | 96 |
| 96 // Not accessed by the native side. | 97 // Not accessed by the native side. |
| 97 private boolean mSupportZoom = true; | 98 private boolean mSupportZoom = true; |
| 98 private boolean mBuiltInZoomControls = false; | 99 private boolean mBuiltInZoomControls = false; |
| 99 private boolean mDisplayZoomControls = true; | 100 private boolean mDisplayZoomControls = true; |
| 100 static class LazyDefaultUserAgent { | 101 static class LazyDefaultUserAgent { |
| 101 // Lazy Holder pattern | 102 // Lazy Holder pattern |
| 102 private static final String sInstance = nativeGetDefaultUserAgent(); | 103 private static final String sInstance = nativeGetDefaultUserAgent(); |
| 103 } | 104 } |
| 104 | 105 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 370 } |
| 370 | 371 |
| 371 boolean supportsMultiTouchZoom() { | 372 boolean supportsMultiTouchZoom() { |
| 372 return mSupportZoom && mBuiltInZoomControls; | 373 return mSupportZoom && mBuiltInZoomControls; |
| 373 } | 374 } |
| 374 | 375 |
| 375 boolean shouldDisplayZoomControls() { | 376 boolean shouldDisplayZoomControls() { |
| 376 return supportsMultiTouchZoom() && mDisplayZoomControls; | 377 return supportsMultiTouchZoom() && mDisplayZoomControls; |
| 377 } | 378 } |
| 378 | 379 |
| 380 public void setLoadWithOverviewMode(boolean overview) { |
| 381 assert mCanModifySettings; |
| 382 synchronized (mContentSettingsLock) { |
| 383 if (mLoadWithOverviewMode != overview) { |
| 384 mLoadWithOverviewMode = overview; |
| 385 mEventHandler.syncSettingsLocked(); |
| 386 } |
| 387 } |
| 388 } |
| 389 |
| 390 public boolean getLoadWithOverviewMode() { |
| 391 synchronized (mContentSettingsLock) { |
| 392 return mLoadWithOverviewMode; |
| 393 } |
| 394 } |
| 395 |
| 379 /** | 396 /** |
| 380 * Sets the text zoom of the page in percent. Default is 100. | 397 * Sets the text zoom of the page in percent. Default is 100. |
| 381 * | 398 * |
| 382 * @param textZoom the percent value for increasing or decreasing the text | 399 * @param textZoom the percent value for increasing or decreasing the text |
| 383 */ | 400 */ |
| 384 public void setTextZoom(int textZoom) { | 401 public void setTextZoom(int textZoom) { |
| 385 assert mCanModifySettings; | 402 assert mCanModifySettings; |
| 386 synchronized (mContentSettingsLock) { | 403 synchronized (mContentSettingsLock) { |
| 387 if (mTextSizePercent != textZoom) { | 404 if (mTextSizePercent != textZoom) { |
| 388 mTextSizePercent = textZoom; | 405 mTextSizePercent = textZoom; |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 | 1201 |
| 1185 /** | 1202 /** |
| 1186 * Sets the settings in this object to those from another | 1203 * Sets the settings in this object to those from another |
| 1187 * ContentSettings. | 1204 * ContentSettings. |
| 1188 * Required by WebView when we swap a in a new ContentViewCore | 1205 * Required by WebView when we swap a in a new ContentViewCore |
| 1189 * to an existing AwContents (i.e. to support displaying popup | 1206 * to an existing AwContents (i.e. to support displaying popup |
| 1190 * windows in an already created WebView) | 1207 * windows in an already created WebView) |
| 1191 */ | 1208 */ |
| 1192 public void initFrom(ContentSettings settings) { | 1209 public void initFrom(ContentSettings settings) { |
| 1193 setLayoutAlgorithm(settings.getLayoutAlgorithm()); | 1210 setLayoutAlgorithm(settings.getLayoutAlgorithm()); |
| 1211 setLoadWithOverviewMode(settings.getLoadWithOverviewMode()); |
| 1194 setTextZoom(settings.getTextZoom()); | 1212 setTextZoom(settings.getTextZoom()); |
| 1195 setStandardFontFamily(settings.getStandardFontFamily()); | 1213 setStandardFontFamily(settings.getStandardFontFamily()); |
| 1196 setFixedFontFamily(settings.getFixedFontFamily()); | 1214 setFixedFontFamily(settings.getFixedFontFamily()); |
| 1197 setSansSerifFontFamily(settings.getSansSerifFontFamily()); | 1215 setSansSerifFontFamily(settings.getSansSerifFontFamily()); |
| 1198 setSerifFontFamily(settings.getSerifFontFamily()); | 1216 setSerifFontFamily(settings.getSerifFontFamily()); |
| 1199 setCursiveFontFamily(settings.getCursiveFontFamily()); | 1217 setCursiveFontFamily(settings.getCursiveFontFamily()); |
| 1200 setFantasyFontFamily(settings.getFantasyFontFamily()); | 1218 setFantasyFontFamily(settings.getFantasyFontFamily()); |
| 1201 setDefaultTextEncodingName(settings.getDefaultTextEncodingName()); | 1219 setDefaultTextEncodingName(settings.getDefaultTextEncodingName()); |
| 1202 setUserAgentString(settings.getUserAgentString()); | 1220 setUserAgentString(settings.getUserAgentString()); |
| 1203 setMinimumFontSize(settings.getMinimumFontSize()); | 1221 setMinimumFontSize(settings.getMinimumFontSize()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 private native int nativeInit(int contentViewPtr, boolean isMasterMode); | 1264 private native int nativeInit(int contentViewPtr, boolean isMasterMode); |
| 1247 | 1265 |
| 1248 private static native String nativeGetDefaultUserAgent(); | 1266 private static native String nativeGetDefaultUserAgent(); |
| 1249 | 1267 |
| 1250 // Synchronize Java settings from native settings. | 1268 // Synchronize Java settings from native settings. |
| 1251 private native void nativeSyncFromNative(int nativeContentSettings); | 1269 private native void nativeSyncFromNative(int nativeContentSettings); |
| 1252 | 1270 |
| 1253 // Synchronize native settings from Java settings. | 1271 // Synchronize native settings from Java settings. |
| 1254 private native void nativeSyncToNative(int nativeContentSettings); | 1272 private native void nativeSyncToNative(int nativeContentSettings); |
| 1255 } | 1273 } |
| OLD | NEW |