1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.webkit.internal; 18 19 import org.chromium.support_lib_boundary.WebSettingsBoundaryInterface; 20 21 /** 22 * Adapter between WebSettingsCompat and 23 * {@link org.chromium.support_lib_boundary.WebSettingsBoundaryInterface} (the 24 * corresponding interface shared with the support library glue in the WebView APK). 25 */ 26 public class WebSettingsAdapter { 27 private WebSettingsBoundaryInterface mBoundaryInterface; 28 29 public WebSettingsAdapter(WebSettingsBoundaryInterface boundaryInterface) { 30 mBoundaryInterface = boundaryInterface; 31 } 32 33 /** 34 * Adapter method for {@link androidx.webkit.WebSettingsCompat#setOffscreenPreRaster}. 35 */ 36 public void setOffscreenPreRaster(boolean enabled) { 37 mBoundaryInterface.setOffscreenPreRaster(enabled); 38 } 39 40 /** 41 * Adapter method for {@link androidx.webkit.WebSettingsCompat#getOffscreenPreRaster}. 42 */ 43 public boolean getOffscreenPreRaster() { 44 return mBoundaryInterface.getOffscreenPreRaster(); 45 } 46 47 /** 48 * Adapter method for {@link androidx.webkit.WebSettingsCompat#setSafeBrowsingEnabled}. 49 */ 50 public void setSafeBrowsingEnabled(boolean enabled) { 51 mBoundaryInterface.setSafeBrowsingEnabled(enabled); 52 } 53 54 /** 55 * Adapter method for {@link androidx.webkit.WebSettingsCompat#getSafeBrowsingEnabled}. 56 */ 57 public boolean getSafeBrowsingEnabled() { 58 return mBoundaryInterface.getSafeBrowsingEnabled(); 59 } 60 61 /** 62 * Adapter method for {@link androidx.webkit.WebSettingsCompat#setDisabledActionModeMenuItems}. 63 */ 64 public void setDisabledActionModeMenuItems(int menuItems) { 65 mBoundaryInterface.setDisabledActionModeMenuItems(menuItems); 66 } 67 68 /** 69 * Adapter method for {@link androidx.webkit.WebSettingsCompat#getDisabledActionModeMenuItems}. 70 */ 71 public int getDisabledActionModeMenuItems() { 72 return mBoundaryInterface.getDisabledActionModeMenuItems(); 73 } 74 75 } 76