package androidx.webkit.internal; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.webkit.Profile; import androidx.webkit.ProfileStore; import java.lang.reflect.InvocationHandler; import java.util.List; import org.chromium.support_lib_boundary.ProfileBoundaryInterface; import org.chromium.support_lib_boundary.ProfileStoreBoundaryInterface; import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil; /* loaded from: classes.dex */ public class ProfileStoreImpl implements ProfileStore { private static ProfileStore sInstance; private final ProfileStoreBoundaryInterface mProfileStoreImpl; private ProfileStoreImpl(ProfileStoreBoundaryInterface profileStoreBoundaryInterface) { this.mProfileStoreImpl = profileStoreBoundaryInterface; } private ProfileStoreImpl() { this.mProfileStoreImpl = null; } @NonNull public static ProfileStore getInstance() { if (sInstance == null) { sInstance = new ProfileStoreImpl(WebViewGlueCommunicator.getFactory().getProfileStore()); } return sInstance; } @Override // androidx.webkit.ProfileStore @NonNull public Profile getOrCreateProfile(@NonNull String str) { if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) { return new ProfileImpl((ProfileBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProfileBoundaryInterface.class, this.mProfileStoreImpl.getOrCreateProfile(str))); } throw WebViewFeatureInternal.getUnsupportedOperationException(); } @Override // androidx.webkit.ProfileStore @Nullable public Profile getProfile(@NonNull String str) { if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) { InvocationHandler profile = this.mProfileStoreImpl.getProfile(str); if (profile != null) { return new ProfileImpl((ProfileBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProfileBoundaryInterface.class, profile)); } return null; } throw WebViewFeatureInternal.getUnsupportedOperationException(); } @Override // androidx.webkit.ProfileStore @NonNull public List getAllProfileNames() { if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) { return this.mProfileStoreImpl.getAllProfileNames(); } throw WebViewFeatureInternal.getUnsupportedOperationException(); } @Override // androidx.webkit.ProfileStore public boolean deleteProfile(@NonNull String str) throws IllegalStateException { if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) { return this.mProfileStoreImpl.deleteProfile(str); } throw WebViewFeatureInternal.getUnsupportedOperationException(); } }