OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
10 import android.os.Handler; | 10 import android.os.Handler; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 private boolean mSpatialNavigationEnabled; // Default depends on device fea
tures. | 85 private boolean mSpatialNavigationEnabled; // Default depends on device fea
tures. |
86 private boolean mEnableSupportedHardwareAcceleratedFeatures; | 86 private boolean mEnableSupportedHardwareAcceleratedFeatures; |
87 private int mMixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW; | 87 private int mMixedContentMode = WebSettings.MIXED_CONTENT_NEVER_ALLOW; |
88 | 88 |
89 private boolean mOffscreenPreRaster; | 89 private boolean mOffscreenPreRaster; |
90 private int mDisabledMenuItems = WebSettings.MENU_ITEM_NONE; | 90 private int mDisabledMenuItems = WebSettings.MENU_ITEM_NONE; |
91 | 91 |
92 // Although this bit is stored on AwSettings it is actually controlled via t
he CookieManager. | 92 // Although this bit is stored on AwSettings it is actually controlled via t
he CookieManager. |
93 private boolean mAcceptThirdPartyCookies; | 93 private boolean mAcceptThirdPartyCookies; |
94 | 94 |
| 95 // if null, default to AwContentsStatics.getSafeBrowsingEnabled() |
| 96 private Boolean mSafeBrowsingEnabled; |
| 97 |
95 private final boolean mSupportLegacyQuirks; | 98 private final boolean mSupportLegacyQuirks; |
96 private final boolean mAllowEmptyDocumentPersistence; | 99 private final boolean mAllowEmptyDocumentPersistence; |
97 private final boolean mAllowGeolocationOnInsecureOrigins; | 100 private final boolean mAllowGeolocationOnInsecureOrigins; |
98 private final boolean mDoNotUpdateSelectionOnMutatingSelectionRange; | 101 private final boolean mDoNotUpdateSelectionOnMutatingSelectionRange; |
99 | 102 |
100 private final boolean mPasswordEchoEnabled; | 103 private final boolean mPasswordEchoEnabled; |
101 | 104 |
102 // Not accessed by the native side. | 105 // Not accessed by the native side. |
103 private boolean mBlockNetworkLoads; // Default depends on permission of emb
edding APK. | 106 private boolean mBlockNetworkLoads; // Default depends on permission of emb
edding APK. |
104 private boolean mAllowContentUrlAccess = true; | 107 private boolean mAllowContentUrlAccess = true; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 public void setAcceptThirdPartyCookies(boolean accept) { | 327 public void setAcceptThirdPartyCookies(boolean accept) { |
325 if (TRACE) Log.d(LOGTAG, "setAcceptThirdPartyCookies=" + accept); | 328 if (TRACE) Log.d(LOGTAG, "setAcceptThirdPartyCookies=" + accept); |
326 synchronized (mAwSettingsLock) { | 329 synchronized (mAwSettingsLock) { |
327 if (mAcceptThirdPartyCookies != accept) { | 330 if (mAcceptThirdPartyCookies != accept) { |
328 mAcceptThirdPartyCookies = accept; | 331 mAcceptThirdPartyCookies = accept; |
329 } | 332 } |
330 } | 333 } |
331 } | 334 } |
332 | 335 |
333 /** | 336 /** |
| 337 * Enable/Disable SafeBrowsing per WebView |
| 338 * @param enabled true if this WebView should have SafeBrowsing |
| 339 */ |
| 340 public void setSafeBrowsingEnabled(boolean enabled) { |
| 341 synchronized (mAwSettingsLock) { |
| 342 mSafeBrowsingEnabled = enabled; |
| 343 } |
| 344 } |
| 345 |
| 346 /** |
334 * Return whether third party cookies are enabled for an AwContents | 347 * Return whether third party cookies are enabled for an AwContents |
335 * @return true if accept third party cookies | 348 * @return true if accept third party cookies |
336 */ | 349 */ |
337 public boolean getAcceptThirdPartyCookies() { | 350 public boolean getAcceptThirdPartyCookies() { |
338 synchronized (mAwSettingsLock) { | 351 synchronized (mAwSettingsLock) { |
339 return mAcceptThirdPartyCookies; | 352 return mAcceptThirdPartyCookies; |
340 } | 353 } |
341 } | 354 } |
342 | 355 |
343 /** | 356 /** |
| 357 * Return whether Safe Browsing has been enabled for the current WebView |
| 358 * @return true if SafeBrowsing is enabled |
| 359 */ |
| 360 public boolean getSafeBrowsingEnabled() { |
| 361 synchronized (mAwSettingsLock) { |
| 362 if (mSafeBrowsingEnabled == null) { |
| 363 return AwContentsStatics.getSafeBrowsingEnabled(); |
| 364 } |
| 365 return mSafeBrowsingEnabled; |
| 366 } |
| 367 } |
| 368 |
| 369 /** |
344 * See {@link android.webkit.WebSettings#setAllowFileAccess}. | 370 * See {@link android.webkit.WebSettings#setAllowFileAccess}. |
345 */ | 371 */ |
346 public void setAllowFileAccess(boolean allow) { | 372 public void setAllowFileAccess(boolean allow) { |
347 if (TRACE) Log.d(LOGTAG, "setAllowFileAccess=" + allow); | 373 if (TRACE) Log.d(LOGTAG, "setAllowFileAccess=" + allow); |
348 synchronized (mAwSettingsLock) { | 374 synchronized (mAwSettingsLock) { |
349 if (mAllowFileUrlAccess != allow) { | 375 if (mAllowFileUrlAccess != allow) { |
350 mAllowFileUrlAccess = allow; | 376 mAllowFileUrlAccess = allow; |
351 } | 377 } |
352 } | 378 } |
353 } | 379 } |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 private native void nativeUpdateWebkitPreferencesLocked(long nativeAwSetting
s); | 1818 private native void nativeUpdateWebkitPreferencesLocked(long nativeAwSetting
s); |
1793 | 1819 |
1794 private static native String nativeGetDefaultUserAgent(); | 1820 private static native String nativeGetDefaultUserAgent(); |
1795 | 1821 |
1796 private native void nativeUpdateFormDataPreferencesLocked(long nativeAwSetti
ngs); | 1822 private native void nativeUpdateFormDataPreferencesLocked(long nativeAwSetti
ngs); |
1797 | 1823 |
1798 private native void nativeUpdateRendererPreferencesLocked(long nativeAwSetti
ngs); | 1824 private native void nativeUpdateRendererPreferencesLocked(long nativeAwSetti
ngs); |
1799 | 1825 |
1800 private native void nativeUpdateOffscreenPreRasterLocked(long nativeAwSettin
gs); | 1826 private native void nativeUpdateOffscreenPreRasterLocked(long nativeAwSettin
gs); |
1801 } | 1827 } |
OLD | NEW |