| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.content.Context; | 7 import android.content.Context; |
| 8 import android.content.pm.PackageManager; | 8 import android.content.pm.PackageManager; |
| 9 import android.os.Process; | 9 import android.os.Process; |
| 10 import android.webkit.WebSettings; | 10 import android.webkit.WebSettings; |
| 11 | 11 |
| 12 import org.chromium.base.Log; | 12 import org.chromium.base.Log; |
| 13 import org.chromium.base.annotations.JNINamespace; | 13 import org.chromium.base.annotations.JNINamespace; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Stores Android WebView Service Worker specific settings. | 16 * Stores Android WebView Service Worker specific settings. |
| 17 * | 17 * |
| 18 * Methods in this class can be called from any thread, including threads create
d by | 18 * Methods in this class can be called from any thread, including threads create
d by |
| 19 * the client of WebView. | 19 * the client of WebView. |
| 20 */ | 20 */ |
| 21 @JNINamespace("android_webview") | 21 @JNINamespace("android_webview") |
| 22 public class AwServiceWorkerSettings { | 22 public class AwServiceWorkerSettings { |
| 23 private static final String LOGTAG = AwServiceWorkerSettings.class.getSimple
Name(); | 23 private static final String LOGTAG = AwServiceWorkerSettings.class.getSimple
Name(); |
| 24 private static final boolean TRACE = false; | 24 private static final boolean TRACE = false; |
| 25 | 25 |
| 26 private int mCacheMode = WebSettings.LOAD_DEFAULT; | 26 private int mCacheMode = WebSettings.LOAD_DEFAULT; |
| 27 private boolean mAllowContentUrlAccess = true; | 27 private boolean mAllowContentUrlAccess = true; |
| 28 private boolean mAllowFileUrlAccess = true; | 28 private boolean mAllowFileUrlAccess = true; |
| 29 private boolean mBlockNetworkLoads; // Default depends on permission of the
embedding APK | 29 private boolean mBlockNetworkLoads; // Default depends on permission of the
embedding APK |
| 30 private boolean mAcceptThirdPartyCookies = false; | 30 private boolean mAcceptThirdPartyCookies; |
| 31 | 31 |
| 32 // Lock to protect all settings. | 32 // Lock to protect all settings. |
| 33 private final Object mAwServiceWorkerSettingsLock = new Object(); | 33 private final Object mAwServiceWorkerSettingsLock = new Object(); |
| 34 | 34 |
| 35 // Computed on construction. | 35 // Computed on construction. |
| 36 private final boolean mHasInternetPermission; | 36 private final boolean mHasInternetPermission; |
| 37 | 37 |
| 38 public AwServiceWorkerSettings(Context context) { | 38 public AwServiceWorkerSettings(Context context) { |
| 39 boolean hasInternetPermission = context.checkPermission( | 39 boolean hasInternetPermission = context.checkPermission( |
| 40 android.Manifest.permission.INTERNET, | 40 android.Manifest.permission.INTERNET, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * See {@link android.webkit.ServiceWorkerWebSettings#getBlockNetworkLoads}. | 127 * See {@link android.webkit.ServiceWorkerWebSettings#getBlockNetworkLoads}. |
| 128 */ | 128 */ |
| 129 public boolean getBlockNetworkLoads() { | 129 public boolean getBlockNetworkLoads() { |
| 130 synchronized (mAwServiceWorkerSettingsLock) { | 130 synchronized (mAwServiceWorkerSettingsLock) { |
| 131 return mBlockNetworkLoads; | 131 return mBlockNetworkLoads; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 } | 134 } |
| OLD | NEW |