QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 QBBussinessProxy.java 源代码,内容仅作参考


package com.tencent.mtt.businesscenter.page;

import MTT.SearchConfRule;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.webkit.ValueCallback;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.widget.FrameLayout;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.qq.e.comm.constants.Constants;
import com.qq.e.comm.constants.TangramHippyConstants;
import com.tencent.common.data.FileConsts;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.http.Apn;
import com.tencent.common.manifest.AppManifest;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.manifest.annotation.CreateMethod;
import com.tencent.common.manifest.annotation.EventReceiver;
import com.tencent.common.task.QBTask;
import com.tencent.common.task.RoutineDaemon;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.mm.ui.widget.dialog.MMTipsBar;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.R;
import com.tencent.mtt.account.base.UserLoginListener;
import com.tencent.mtt.apkplugin.ApkPlugin;
import com.tencent.mtt.apkplugin.impl.IAPInjectService;
import com.tencent.mtt.apkplugin.impl.client.APPrepCallbackAbs;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.functionwindow.IFunctionWndFactory;
import com.tencent.mtt.base.nativeframework.GroupList;
import com.tencent.mtt.base.nativeframework.NativePage;
import com.tencent.mtt.base.notification.facade.IMessageBubbleListener;
import com.tencent.mtt.base.notification.facade.IMessageBubbleService;
import com.tencent.mtt.base.notification.facade.INotify;
import com.tencent.mtt.base.notification.facade.NormalMessageBundle;
import com.tencent.mtt.base.notification.facade.WindowBlockTipInfo;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.stat.UnitTimeDefines;
import com.tencent.mtt.base.stat.WebSiteCacher;
import com.tencent.mtt.base.stat.interfaces.IUnitTimeHelper;
import com.tencent.mtt.base.stat.interfaces.UnitTimeHelperFactory;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.base.utils.VideoAutoPlayHelper;
import com.tencent.mtt.base.utils.WebViewDialogUtils;
import com.tencent.mtt.base.webview.IQBWebView;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.base.webview.common.GeolocationPermissionsCallback;
import com.tencent.mtt.base.webview.common.JsResult;
import com.tencent.mtt.base.webview.common.QBWebResourceRequest;
import com.tencent.mtt.base.webview.common.QBWebSettings;
import com.tencent.mtt.base.webview.extension.IUrlHistoryCheckExtension;
import com.tencent.mtt.base.wrapper.callback.CustomViewCallback;
import com.tencent.mtt.base.wrapper.datastruct.SecurityLevelBase;
import com.tencent.mtt.base.wrapper.extension.IQQBrowserSettings;
import com.tencent.mtt.base.wup.DomainListDataManager;
import com.tencent.mtt.boot.base.IBoot;
import com.tencent.mtt.boot.browser.splash.facade.ISplashManager;
import com.tencent.mtt.boot.facade.IBootService;
import com.tencent.mtt.browser.BrowserFragment;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.bookmark.engine.Bookmark;
import com.tencent.mtt.browser.bookmark.facade.IBookMarkService;
import com.tencent.mtt.browser.bra.addressbar.AddressBarController;
import com.tencent.mtt.browser.bra.addressbar.AddressBarDataSource;
import com.tencent.mtt.browser.bra.addressbar.view.AddressBarViewState;
import com.tencent.mtt.browser.bra.addressbar.view.newview.SecurityActionRecorder;
import com.tencent.mtt.browser.business.IBussinessProxyExtension;
import com.tencent.mtt.browser.download.core.impl.DownloadServiceManager;
import com.tencent.mtt.browser.download.engine.DownloadInfo;
import com.tencent.mtt.browser.engine.clipboard.ClipboardManager;
import com.tencent.mtt.browser.engine.recover.facade.AbnormalPageData;
import com.tencent.mtt.browser.engine.recover.facade.IRecover;
import com.tencent.mtt.browser.file.facade.IFileOpenManager;
import com.tencent.mtt.browser.homepage.facade.IHomePage;
import com.tencent.mtt.browser.jsextension.facade.IJsapiManager;
import com.tencent.mtt.browser.jsextension.facade.JsapiCallback;
import com.tencent.mtt.browser.lite.webview.SystemWebView;
import com.tencent.mtt.browser.memstat.facade.IMemoryUsageStatService;
import com.tencent.mtt.browser.menu.facade.IMenuService;
import com.tencent.mtt.browser.multiwindow.facade.IMultiWindowService;
import com.tencent.mtt.browser.push.facade.IServiceManager;
import com.tencent.mtt.browser.security.SecurityManager;
import com.tencent.mtt.browser.security.datastruct.SecurityLevel;
import com.tencent.mtt.browser.security.datastruct.SecurityResourceUrlInfo;
import com.tencent.mtt.browser.security.datastruct.WebBehivorInfo;
import com.tencent.mtt.browser.security.interfaces.SecurityCheckListener;
import com.tencent.mtt.browser.setting.manager.UserSettingManager;
import com.tencent.mtt.browser.share.facade.IShare;
import com.tencent.mtt.browser.share.facade.ShareBundle;
import com.tencent.mtt.browser.video.facade.ISystemWebViewIntercept;
import com.tencent.mtt.browser.webbussiness.facade.IWebPageService;
import com.tencent.mtt.browser.window.BackStragety;
import com.tencent.mtt.browser.window.BrowserWindow;
import com.tencent.mtt.browser.window.FastPageManager;
import com.tencent.mtt.browser.window.FullScreenManager;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.IWebViewClient;
import com.tencent.mtt.browser.window.NoStatementExternalCallBackStragety;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.StatementExternalCallBackStragety;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.browser.window.WindowPlaceHolder;
import com.tencent.mtt.browser.window.data.PageInfo;
import com.tencent.mtt.browser.window.home.FrameWorkLogUtil;
import com.tencent.mtt.browser.window.home.IHome;
import com.tencent.mtt.browser.window.home.ITabPage;
import com.tencent.mtt.browser.window.monitor.H5PerformanceTimingManager;
import com.tencent.mtt.browser.window.templayer.IPageBussinessProxy;
import com.tencent.mtt.browser.window.templayer.JsCallback;
import com.tencent.mtt.browser.window.templayer.NewPageFrame;
import com.tencent.mtt.browser.window.templayer.PageListInfo;
import com.tencent.mtt.browser.window.templayer.PagePlaceHolder;
import com.tencent.mtt.browser.window.templayer.QBWebviewWrapper;
import com.tencent.mtt.browser.x5.x5.X5WebEngine;
import com.tencent.mtt.browser.x5.x5feature.metricsstatistic.MetricsStatisticManager;
import com.tencent.mtt.browser.x5.x5webview.X5FileUploader;
import com.tencent.mtt.businesscenter.DownloadUAUtils;
import com.tencent.mtt.businesscenter.download.DownloadBlackListManager;
import com.tencent.mtt.businesscenter.facade.IExternalDispatchServer;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.businesscenter.facade.IHostService;
import com.tencent.mtt.businesscenter.facade.IWebPageStatService;
import com.tencent.mtt.businesscenter.facade.PageLoadInfo;
import com.tencent.mtt.businesscenter.facade.PageVideoExtension;
import com.tencent.mtt.businesscenter.intent.QBModuleDispather;
import com.tencent.mtt.businesscenter.stat.WebPageStatHelper;
import com.tencent.mtt.businesscenter.urldispatch.UrlDispatcher;
import com.tencent.mtt.businesscenter.utils.QBBusinessUrlUtils;
import com.tencent.mtt.businesscenter.utils.SearchUrlUtils;
import com.tencent.mtt.cmc.CMC;
import com.tencent.mtt.external.novel.facade.INovelPriateService;
import com.tencent.mtt.external.pagetoolbox.facade.IPageToolBoxGuideService;
import com.tencent.mtt.external.pagetoolbox.facade.IPageToolBoxService;
import com.tencent.mtt.external.setting.base.FontSizeChangeListener;
import com.tencent.mtt.external.setting.base.FontSizeManager;
import com.tencent.mtt.external.setting.base.ImageLoadManager;
import com.tencent.mtt.external.setting.base.RotateScreenManager;
import com.tencent.mtt.external.setting.inhost.SettingDefines;
import com.tencent.mtt.frequence.visit.IVisit;
import com.tencent.mtt.history.base.IHistory;
import com.tencent.mtt.log.access.LogSdkExt;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.operation.event.EventLog;
import com.tencent.mtt.push.InnerPushProxy;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.search.facade.ISearchEngineService;
import com.tencent.mtt.search.facade.ISearchService;
import com.tencent.mtt.search.searchEngine.SearchEngineItemInfo;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.support.utils.ReportRemoveView;
import com.tencent.mtt.support.utils.ViewCompat;
import com.tencent.mtt.utils.SafetyPerceptionConsts;
import com.tencent.mtt.video.export.VideoProxyDefault;
import com.tencent.mtt.video.internal.facade.IVideoService;
import com.tencent.mtt.video.internal.utils.SafeBundleUtil;
import com.tencent.mtt.view.addressbar.progress.ProgressCalculator;
import com.tencent.mtt.view.dialog.alert.NewQBAlertDialogBuilder;
import com.tencent.mtt.view.dialog.alert.QBAlertDialog;
import com.tencent.mtt.view.dialog.manager.GlobalDialogManager;
import com.tencent.mtt.view.edittext.ui.MttCtrlInputNew;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.mtt.view.toast.NotificationBar;
import com.tencent.mtt.weboffline.WebOfflineClient;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.tencent.rmpbusiness.report.TraceEvent;
import com.tencent.rmpbusiness.report.TraceEventCallback;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import qb.a.h;
import qb.framework.BuildConfig;
import tmsdk.common.gourd.vine.IActionReportService;

public class QBBussinessProxy implements SecurityCheckListener, IPageBussinessProxy, FontSizeChangeListener {
    static boolean h;
    private PageFrame O;
    private String T;
    private String U;
    private boolean V;

    int f47062a;
    private boolean ab;
    private AddressBarDataSource ac;
    private QBFrameLayout ad;
    private DataSourceProcessor ae;
    private final ISearchService af;
    private DownloadBlackListManager ag;
    private WebOfflineClient ah;
    private HashMap<String, String> ai;
    private UrlParams aj;
    private boolean ak;
    private String ao;
    private String ap;
    private View aq;

    private CustomViewCallback f47063ar;
    private int as;
    private String at;
    private int av;
    SearchZhidaReport l;
    protected FrameLayout q;
    protected boolean t;
    protected static final FrameLayout.LayoutParams r = new FrameLayout.LayoutParams(-1, -1);
    protected static final FrameLayout.LayoutParams s = new FrameLayout.LayoutParams(-1, -1, 17);
    static long N = 0;

    int f47064b = -1;
    private String P = "";
    private int Q = -1;
    private int R = -1;
    private int S = -1;
    private Runnable W = null;
    private INovelPriateService X = null;

    ArrayList<Runnable> f47065c = new ArrayList<>();
    private BackStragety Y = null;

    Handler f47066d = new Handler(Looper.getMainLooper());
    private Runnable Z = null;
    SecurityLevel e = null;
    private String aa = null;
    boolean f = false;
    Intent g = null;
    List<String> i = null;
    boolean j = true;
    int k = 0;
    int m = -1;
    long n = 0;
    boolean o = false;
    private boolean al = false;
    private long am = 0;
    private HashMap<String, IUnitTimeHelper> an = new HashMap<>();
    boolean p = false;
    private long au = 0;
    private String aw = MttResources.l(R.string.aze);
    private int ax = 0;
    String u = null;
    String v = null;
    String w = null;
    String x = null;
    String y = null;
    String z = null;
    String A = null;
    int B = -1;
    int C = 0;
    int D = 0;
    long E = 0;
    int F = 0;
    String G = null;
    String H = null;
    String I = null;
    byte[] J = null;
    String K = null;
    String L = null;
    final Runnable M = new Runnable() {
        @Override
        public void run() {
            FastPageManager a2 = FastPageManager.a();
            a2.b(false);
            a2.e();
        }
    };

    class AnonymousClass27 implements Runnable {

        final String f47112a;

        @Override
        public void run() {
            ISearchService iSearchService;
            if (TextUtils.isEmpty(this.f47112a) || (iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class)) == null) {
                return;
            }
            iSearchService.addInputHistory(this.f47112a);
        }
    }

    class AnonymousClass29 implements UserLoginListener {

        final String f47116a;

        final String f47117b;

        final IQBWebView f47118c;

        @Override
        public void onLoginFailed(int i, String str) {
            MttToaster.show("网页添加失败,请登录后再试", 0);
            QBTask.b((Callable) new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    AnonymousClass29.this.f47118c.evaluateJavascript("javascript:(favCallback(false))", null);
                    return null;
                }
            });
        }

        @Override
        public void onLoginSuccess() {
            final boolean addBookmark = ((IBookMarkService) QBContext.getInstance().getService(IBookMarkService.class)).addBookmark(this.f47116a, this.f47117b, true);
            QBTask.b((Callable) new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    AnonymousClass29.this.f47118c.evaluateJavascript("javascript:(favCallback(" + addBookmark + "))", null);
                    return null;
                }
            });
        }
    }

    static class FullscreenHolder extends FrameLayout {
        public FullscreenHolder(Context context) {
            super(context);
            setBackgroundColor(-16777216);
        }

        @Override
        public boolean onTouchEvent(MotionEvent motionEvent) {
            return true;
        }
    }

    public QBBussinessProxy(PageFrame pageFrame, int i) {
        this.f47062a = -1;
        this.ad = null;
        this.ae = null;
        this.O = pageFrame;
        this.f47062a = i < 1001 ? WindowManager.a().k() : i;
        this.ad = new QBFrameLayout(pageFrame.getContext());
        this.ae = new DataSourceProcessor(AddressBarController.a().p());
        this.ad.setLayoutParams(new FrameLayout.LayoutParams(-1, AddressBarController.h() + BaseSettings.a().n()));
        this.af = (ISearchService) QBContext.getInstance().getService(ISearchService.class);
        this.ag = new DownloadBlackListManager();
        QuickAppUtil.c();
        this.ah = new WebOfflineClient();
    }

    private void N() {
        ISearchEngineService iSearchEngineService;
        DataSourceProcessor dataSourceProcessor = this.ae;
        if (dataSourceProcessor == null || dataSourceProcessor.f47013a == null || this.ae.f47013a.f == null) {
            return;
        }
        AddressBarViewState addressBarViewState = this.ae.f47013a.f;
        if (addressBarViewState.f35857a != 5 || (iSearchEngineService = (ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class)) == null) {
            return;
        }
        iSearchEngineService.onLoadBaiduOrSogouHomePage(addressBarViewState.j);
    }

    private void O() {
        PageFrame pageFrame = this.O;
        if (pageFrame != null && pageFrame.getHost() != null) {
            ((IRecover) QBContext.getInstance().getService(IRecover.class)).saveAbnormalData(this.O);
        }
        PageFrame pageFrame2 = this.O;
        if (pageFrame2 != null) {
            pageFrame2.setPageState((byte) 0);
        }
    }

    private void P() {
        PageFrame pageFrame;
        IWebView currentWebView;
        if (this.X != null || (pageFrame = this.O) == null || (currentWebView = pageFrame.getCurrentWebView()) == null || TextUtils.isEmpty(currentWebView.getUrl()) || currentWebView.getUrl().startsWith("qb://")) {
            return;
        }
        if ((currentWebView instanceof QBWebView) || (currentWebView instanceof QBWebviewWrapper)) {
            ApkPlugin.a((Class<?>) INovelPriateService.class).a(IAPInjectService.EP_NULL).a(new APPrepCallbackAbs() {
                @Override
                public void a(String str) {
                    QBBussinessProxy.this.X = (INovelPriateService) QBContext.getInstance().getService(INovelPriateService.class);
                    if (QBBussinessProxy.this.X == null || QBBussinessProxy.this.O == null) {
                        return;
                    }
                    QBBussinessProxy.this.X.build(QBBussinessProxy.this.O.getView());
                }
            });
        }
    }

    private void Q() {
        this.f47066d.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (QBBussinessProxy.this.f47065c == null || QBBussinessProxy.this.f47065c.size() <= 0) {
                    return;
                }
                Iterator<Runnable> it = QBBussinessProxy.this.f47065c.iterator();
                while (it.hasNext()) {
                    QBBussinessProxy.this.a(it.next(), 0);
                }
                QBBussinessProxy.this.f47065c.clear();
            }
        }, 800L);
    }

    private void R() {
        SearchZhidaReport searchZhidaReport = this.l;
        if (searchZhidaReport != null) {
            searchZhidaReport.a();
            this.l = null;
        }
    }

    private boolean S() {
        List<String> list = this.i;
        return list == null || list.size() == 0;
    }

    private int a(Context context, PageFrame pageFrame, GroupList groupList, int i, Object obj) {
        IWebView homePageInWindow;
        String str;
        ArrayList arrayList;
        if (obj instanceof Bundle) {
            homePageInWindow = new PagePlaceHolder(context, (NewPageFrame) this.O, (Bundle) obj);
            arrayList = new ArrayList();
        } else {
            if (!(obj instanceof String)) {
                return i;
            }
            homePageInWindow = pageFrame.getHomePageInWindow();
            String[] split = ((String) obj).split("\\|");
            try {
                str = URLDecoder.decode(split[0], "UTF-8");
            } catch (UnsupportedEncodingException unused) {
                str = "";
            }
            if (TextUtils.isEmpty(str)) {
                return i;
            }
            if (!a(str, groupList, homePageInWindow)) {
                String[] split2 = split.length > 1 ? split[1].split("_") : null;
                PagePlaceHolder pagePlaceHolder = new PagePlaceHolder(context, (NewPageFrame) this.O, str);
                if (split2 == null || split2.length < 3) {
                    ArrayList arrayList2 = new ArrayList();
                    arrayList2.add(pagePlaceHolder);
                    groupList.b((List) arrayList2);
                    return i;
                }
                if (split2.length <= 1) {
                    return i;
                }
                int parseInt = Integer.parseInt(split2[1]);
                if (i == parseInt) {
                    groupList.b(i).add(pagePlaceHolder);
                } else {
                    ArrayList arrayList3 = new ArrayList();
                    arrayList3.add(pagePlaceHolder);
                    groupList.b((List) arrayList3);
                }
                return parseInt;
            }
            arrayList = new ArrayList();
        }
        arrayList.add(homePageInWindow);
        groupList.b((List) arrayList);
        return i + 1;
    }

    private String a(IWebView iWebView, String str, String str2) {
        return (iWebView == null || !iWebView.isHomePage()) ? (iWebView == null || TextUtils.isEmpty(iWebView.getPageTitle())) ? (TextUtils.isEmpty(str2) || str2.startsWith("qb://home") || str2.equalsIgnoreCase(DataSourceProcessor.f47012b)) ? str : str2 : iWebView.getPageTitle() : str;
    }

    private void a(Bundle bundle, IWebView iWebView, String str) {
        String restoreUrl = iWebView.getRestoreUrl();
        if (!TextUtils.isEmpty(restoreUrl)) {
            try {
                restoreUrl = URLEncoder.encode(restoreUrl, "UTF-8");
            } catch (UnsupportedEncodingException unused) {
            }
            restoreUrl = restoreUrl + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + str;
        }
        bundle.putString(str, restoreUrl);
    }

    private void a(Bundle bundle, PagePlaceHolder pagePlaceHolder, String str) {
        Bundle bundle2 = pagePlaceHolder.getBundle();
        if (bundle2 != null) {
            bundle.putBundle(str, bundle2);
            return;
        }
        String url = pagePlaceHolder.getUrl();
        if (!TextUtils.isEmpty(url)) {
            try {
                url = URLEncoder.encode(url, "UTF-8") + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + str;
            } catch (UnsupportedEncodingException unused) {
            }
        }
        bundle.putString(str, url);
    }

    private void a(ViewGroup viewGroup) {
        if (this.ad.getParent() instanceof ViewGroup) {
            ((ViewGroup) this.ad.getParent()).removeView(this.ad);
        }
        ((FrameLayout.LayoutParams) this.ad.getLayoutParams()).height = DeviceUtils.ai() ? AddressBarController.h() : AddressBarController.h() + BaseSettings.a().n();
        this.ad.setBackgroundDrawable(new BitmapDrawable(AddressBarController.a().s()));
        viewGroup.addView(this.ad);
        AddressBarController.a().b(false, 2);
    }

    private void a(NativePage nativePage) {
        if (this.ad.getParent() instanceof ViewGroup) {
            ((ViewGroup) this.ad.getParent()).removeView(this.ad);
        }
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.ad.getLayoutParams();
        layoutParams.height = DeviceUtils.ai() ? AddressBarController.h() : AddressBarController.h() + BaseSettings.a().n();
        layoutParams.topMargin = -nativePage.getPaddingTop();
        this.ad.setBackgroundDrawable(new BitmapDrawable(AddressBarController.a().s()));
        nativePage.addView(this.ad);
        nativePage.setClipToPadding(false);
        AddressBarController.a().b(false, 2);
    }

    private void a(final IQBWebView iQBWebView, final String str, String str2) {
        if (TextUtils.isEmpty(str) || iQBWebView == null) {
            return;
        }
        if (!TextUtils.isEmpty(str2) && str2.startsWith("qb://qlight")) {
            FrameWorkLogUtil.a("QBBussinessProxy", "postCompatLoadUrl", "postCompatLoadUrl open new", str);
            ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(str));
            return;
        }
        if (!QBUrlUtils.w(str)) {
            H5PerformanceTimingManager.a().b(this.ap, str);
            this.ap = str;
        }
        FrameWorkLogUtil.a("QBBussinessProxy", "postCompatLoadUrl", "postCompatLoadUrl", str);
        this.f47066d.postAtFrontOfQueue(new Runnable() {
            @Override
            public void run() {
                iQBWebView.compatLoadUrl(str);
            }
        });
    }

    public void a(SecurityLevelBase securityLevelBase, SecurityLevel securityLevel) {
        if (SecurityManager.a().b(securityLevelBase.url)) {
            return;
        }
        if (securityLevel.flag != 1) {
            d(securityLevel);
        } else if (this.O != null) {
            c(securityLevel);
        }
    }

    public void a(AddressBarDataSource addressBarDataSource, SecurityLevel securityLevel) {
        if (addressBarDataSource.b()) {
            this.e = securityLevel;
            return;
        }
        a(securityLevel);
        this.ae.a(addressBarDataSource);
        AddressBarController.a().a(addressBarDataSource);
    }

    private void a(IWebView iWebView, AddressBarDataSource addressBarDataSource) {
        if (addressBarDataSource != null) {
            if (TextUtils.isEmpty(iWebView.getPageTitle())) {
                addressBarDataSource.f35820a = iWebView.getUrl() == null ? MttResources.l(h.f85888a) : iWebView.getUrl();
            }
            addressBarDataSource.f35821b = iWebView.getUrl();
            addressBarDataSource.e.a((byte) 1);
        }
    }

    private void a(IWebView iWebView, IWebView iWebView2, AddressBarDataSource addressBarDataSource) {
        if (addressBarDataSource != null) {
            if (iWebView != iWebView2) {
                addressBarDataSource.d();
                c(iWebView2);
            } else if ((iWebView instanceof QBWebviewWrapper) && iWebView2 == iWebView) {
                addressBarDataSource.a(false);
            }
        }
    }

    private void a(IWebView iWebView, IWebView iWebView2, String str) {
        boolean z = iWebView2 != null && iWebView2.isPage(IWebView.TYPE.HTML);
        boolean a2 = AddressBarController.a().a(iWebView, iWebView == 0 ? null : iWebView.getUrl(), z);
        boolean a3 = AddressBarController.a().a(iWebView2, str, z);
        boolean z2 = AddressBarController.a().l() > 0;
        if (a2 && z2 && !a3) {
            if (iWebView instanceof QBWebviewWrapper) {
                a((QBWebviewWrapper) iWebView);
                return;
            } else if (iWebView.isPage(IWebView.TYPE.HOME)) {
                a((ViewGroup) iWebView);
                return;
            } else {
                if (iWebView instanceof NativePage) {
                    a((NativePage) iWebView);
                    return;
                }
                return;
            }
        }
        if (!a2 && a3) {
            b(iWebView, iWebView2, str);
            return;
        }
        if (!a2 && !a3) {
            AddressBarController.a().b(false, 2);
        } else if (a2 && a3) {
            AddressBarController.a().a(false, 2);
        }
    }

    private void a(IWebView iWebView, TraceEvent.TraceAction traceAction, String str) {
        if (!(iWebView instanceof QBWebviewWrapper) || traceAction == null) {
            return;
        }
        TraceEventCallback.a().onHippyCustomTraceEvent(str, traceAction.name(), new Bundle());
    }

    private void a(IWebView iWebView, String str, String str2, long j, String str3, DownloadInfo downloadInfo) {
        downloadInfo.f37604a = str;
        downloadInfo.f37606c = str3;
        downloadInfo.f37607d = j;
        downloadInfo.e = this.K;
        downloadInfo.s = str2;
        downloadInfo.z = 4;
        downloadInfo.L = iWebView == null ? "" : iWebView.getPageTitle();
        downloadInfo.K = iWebView == null ? "" : iWebView.getUrl();
        downloadInfo.I |= 512;
        downloadInfo.q = FileConsts.Uitls.h(str3, str2) ? "46" : "45";
        downloadInfo.n = TextUtils.isEmpty(downloadInfo.K) ? "" : downloadInfo.K;
        if (!StringUtils.b(this.I) && this.I.equalsIgnoreCase("post")) {
            downloadInfo.H |= 131072;
            downloadInfo.t = true;
            byte[] bArr = this.J;
            if (bArr != null && bArr.length > 0) {
                downloadInfo.u = new String(bArr);
            }
        }
        DownloadUAUtils.a(iWebView, downloadInfo);
    }

    private void a(IWebView iWebView, String str, boolean z, String str2, AddressBarDataSource addressBarDataSource) {
        if (addressBarDataSource != null) {
            addressBarDataSource.f35821b = str;
            SecurityLevel a2 = SecurityManager.a().a(iWebView.getUrl(), SafetyPerceptionConsts.e);
            if (a2 == null || !a2.a()) {
                addressBarDataSource.f35820a = str2;
            } else {
                addressBarDataSource.f35820a = str;
            }
            addressBarDataSource.f35820a = str2;
            addressBarDataSource.a(SecurityLevel.class, a2);
            i(z);
            this.ac = null;
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource);
        }
    }

    private void a(IWebView iWebView, boolean z) {
        if (!this.t || z) {
            return;
        }
        v(iWebView);
        a(iWebView, 100, true);
    }

    private void a(UrlParams urlParams) {
        if (this.Y == null) {
            this.Y = urlParams.g;
            if (this.Y != null) {
                if (urlParams.h != null) {
                    this.Y.a(urlParams.h.getString("KEY_PID"));
                }
                if (TextUtils.isEmpty(urlParams.f46351a) || QBUrlUtils.w(urlParams.f46351a) || QBUrlUtils.a(urlParams.f46351a)) {
                    return;
                }
                L();
            }
        }
    }

    private void a(QBWebviewWrapper qBWebviewWrapper) {
        if (this.ad.getParent() instanceof ViewGroup) {
            ((ViewGroup) this.ad.getParent()).removeView(this.ad);
        }
        Activity a2 = ActivityHandler.b().a();
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.ad.getLayoutParams();
        layoutParams.height = (DeviceUtils.ai() || (DeviceUtils.b(a2.getWindow()) && FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_868483289))) ? AddressBarController.h() : AddressBarController.h() + BaseSettings.a().n();
        BitmapDrawable bitmapDrawable = new BitmapDrawable(AddressBarController.a().a((IWebView) null));
        bitmapDrawable.setBounds(0, 0, DeviceUtils.af(), layoutParams.height);
        qBWebviewWrapper.a(bitmapDrawable);
        AddressBarController.a().b(false, 2);
    }

    private void a(String str, long j) {
        if (H5PerformanceTimingManager.a().b(str)) {
            str = H5PerformanceTimingManager.a().a(str);
        }
        H5PerformanceTimingManager.a().c(str, j);
    }

    private void a(String str, String str2, byte b2) {
        if (q(str)) {
            this.ac = new AddressBarDataSource();
            AddressBarDataSource addressBarDataSource = this.ac;
            addressBarDataSource.f35821b = str;
            if (!TextUtils.isEmpty(str2)) {
                str = str2;
            }
            addressBarDataSource.f35820a = str;
            this.ac.e.a(b2);
            PageFrame pageFrame = this.O;
            if (pageFrame != null) {
                pageFrame.setPageState(b2 == 0 ? (byte) 1 : (byte) 0);
                Object homePageInWindow = this.O.getHomePageInWindow();
                if (homePageInWindow instanceof View) {
                    ((View) homePageInWindow).setVisibility(4);
                }
            }
            this.ae.a(this.ac);
            AddressBarController.a().a(this.ac);
        }
    }

    private void a(String str, boolean z) {
        IUnitTimeHelper iUnitTimeHelper;
        if (TextUtils.isEmpty(this.ao) || TextUtils.isEmpty(str) || TextUtils.equals(this.ao, str) || !l(z) || (iUnitTimeHelper = this.an.get(this.ao)) == null) {
            return;
        }
        this.an.remove(this.ao);
        this.an.put(str, iUnitTimeHelper);
        iUnitTimeHelper.g(str);
        iUnitTimeHelper.b(QBUrlUtils.q(str));
        this.ao = str;
    }

    private void a(String str, boolean z, boolean z2) {
        if (H5PerformanceTimingManager.a().b(str)) {
            str = H5PerformanceTimingManager.a().a(str);
        }
        if (TextUtils.isEmpty(this.ap) || TextUtils.isEmpty(str) || TextUtils.equals(this.ap, str) || QBUrlUtils.w(this.ap)) {
            return;
        }
        H5PerformanceTimingManager.a().a(this.ap, str, z, z2);
        this.ap = str;
    }

    private void a(boolean z, IQBWebView iQBWebView, String str, String str2) {
        UnkownSchemeUtil.a(iQBWebView, str, str2, (z || (this.al && System.currentTimeMillis() - this.am < MMTipsBar.DURATION_SHORT)) ? 1 : 0);
    }

    private boolean a(Bundle bundle) {
        if (bundle != null) {
            return bundle.getBoolean("qb_no_stat_entry", false);
        }
        return false;
    }

    private boolean a(IQBWebView iQBWebView, String str, String str2, boolean z) {
        return a(iQBWebView, str, str2, z, (QBWebResourceRequest) null);
    }

    private boolean a(IQBWebView iQBWebView, String str, String str2, boolean z, QBWebResourceRequest qBWebResourceRequest) {
        IBussinessProxyExtension iBussinessProxyExtension;
        int i;
        int i2;
        boolean doShouldOverrideUrlLoading;
        String stringExtra;
        a(iQBWebView, str2);
        if (str2 == null || TextUtils.isEmpty(UrlDispatcher.a(str2))) {
            FrameWorkLogUtil.a("QBBussinessProxy", "doShouldOverrideUrlLoading", "被UrlDispatcher.process拦截", str2);
            return true;
        }
        if (((IExternalDispatchServer) QBContext.getInstance().getService(IExternalDispatchServer.class)).doPtLogin(str2)) {
            c(Uri.parse(str2).getQueryParameter(Constants.PORTRAIT));
            return true;
        }
        Intent a2 = QBBusinessUrlUtils.a(str2);
        if (a2 != null && (stringExtra = a2.getStringExtra("browser_fallback_url")) != null) {
            b(iQBWebView, stringExtra);
        }
        String a3 = SearchUrlUtils.a(str2);
        if (!str2.equals(a3)) {
            a(iQBWebView, a3, str);
            return true;
        }
        IBussinessProxyExtension[] iBussinessProxyExtensionArr = (IBussinessProxyExtension[]) AppManifest.getInstance().queryExtensions(IBussinessProxyExtension.class);
        if (iBussinessProxyExtensionArr != null) {
            int length = iBussinessProxyExtensionArr.length;
            int i3 = 0;
            while (i3 < length) {
                IBussinessProxyExtension iBussinessProxyExtension2 = iBussinessProxyExtensionArr[i3];
                long currentTimeMillis = System.currentTimeMillis();
                if (qBWebResourceRequest != null) {
                    iBussinessProxyExtension = iBussinessProxyExtension2;
                    i = i3;
                    i2 = length;
                    doShouldOverrideUrlLoading = iBussinessProxyExtension2.doShouldOverrideUrlLoading(iQBWebView, str, str2, z, qBWebResourceRequest);
                } else {
                    iBussinessProxyExtension = iBussinessProxyExtension2;
                    i = i3;
                    i2 = length;
                    doShouldOverrideUrlLoading = iBussinessProxyExtension.doShouldOverrideUrlLoading(iQBWebView, str, str2, z);
                }
                long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
                if (currentTimeMillis2 > 16) {
                    EventLog.a("Url重定向", "处理超时 : " + currentTimeMillis2 + ", 业务地址:" + iBussinessProxyExtension.getClass().getSimpleName());
                }
                if (doShouldOverrideUrlLoading) {
                    EventLog.a("Url重定向", "处理的业务地址:" + iBussinessProxyExtension.getClass().getSimpleName());
                    FrameWorkLogUtil.a("QBBussinessProxy", "doShouldOverrideUrlLoading", "IBussinessProxyExtension new拦截," + iBussinessProxyExtension.getClass().getSimpleName(), str2);
                    return true;
                }
                i3 = i + 1;
                length = i2;
            }
        }
        Boolean b2 = b(iQBWebView, str, str2, z);
        if (b2 != null) {
            return b2.booleanValue();
        }
        this.al = z;
        this.am = System.currentTimeMillis();
        try {
            String r2 = r(str2.toLowerCase().trim());
            if (!TextUtils.isEmpty(r2)) {
                FrameWorkLogUtil.a("QBBussinessProxy", "doShouldOverrideUrlLoading", "添加搜索渠道号", str2);
                a(iQBWebView, r2, str);
                return true;
            }
        } catch (Exception unused) {
        }
        if (iQBWebView == null) {
            return false;
        }
        b((QBWebView) iQBWebView, str2);
        return false;
    }

    private boolean a(IWebView iWebView, int i, ProgressCalculator progressCalculator) {
        return QBUrlUtils.X(iWebView.getUrl()) != 2 && progressCalculator != null && -1 == i && progressCalculator.e() == 0;
    }

    private boolean a(String str, GroupList groupList, IWebView iWebView) {
        return (!str.startsWith("qb://home") || iWebView == null || groupList.a(iWebView)) ? false : true;
    }

    public static boolean a(String str, SecurityLevel securityLevel) {
        if (securityLevel != null && !TextUtils.isEmpty(str)) {
            if (QBUrlUtils.w(str) && str.equalsIgnoreCase(securityLevel.url)) {
                return true;
            }
            String u = QBUrlUtils.u(str);
            String u2 = QBUrlUtils.u(securityLevel.f44592a);
            if (!TextUtils.isEmpty(u) && !TextUtils.isEmpty(u2)) {
                int indexOf = u.indexOf(58);
                if (indexOf != -1) {
                    u = u.substring(0, indexOf);
                }
                if (TextUtils.isEmpty(u)) {
                    return false;
                }
                if (u2.startsWith(".")) {
                    if (!u.endsWith(u2)) {
                        return false;
                    }
                } else if (!u.equalsIgnoreCase(u2)) {
                    if (!u.endsWith("." + u2)) {
                        return false;
                    }
                }
                return true;
            }
        }
        return false;
    }

    private boolean a(boolean z, IWebView iWebView) {
        if (!(iWebView instanceof QBWebviewWrapper)) {
            return false;
        }
        ((INotify) QBContext.getInstance().getService(INotify.class)).closeBubble(IMessageBubbleService.MESSAGE_MODE_SHOW_TRANSLATE);
        if (!z) {
            return false;
        }
        ((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat("web_0081");
        return false;
    }

    private int[] a(IHomePage iHomePage, int i) {
        int[] fastlinkItemSize;
        int[] appFastlinkPos = iHomePage.getAppFastlinkPos(i);
        if (appFastlinkPos != null && appFastlinkPos.length > 1 && (fastlinkItemSize = iHomePage.getFastlinkItemSize()) != null && fastlinkItemSize.length > 1) {
            appFastlinkPos[0] = appFastlinkPos[0] + (fastlinkItemSize[0] / 2);
            appFastlinkPos[1] = appFastlinkPos[1] + (fastlinkItemSize[1] / 2);
        }
        return appFastlinkPos;
    }

    private Boolean b(IQBWebView iQBWebView, String str, String str2, boolean z) {
        if (str2.toLowerCase().startsWith("faketel:")) {
            return true;
        }
        if (QBUrlUtils.z(str2)) {
            return null;
        }
        a(z, iQBWebView, str, str2);
        return true;
    }

    private String b(Bundle bundle) {
        String str;
        if (bundle != null) {
            String string = bundle.getString("qrpt");
            str = StringUtils.b(string) ? bundle.getString("appid") : string;
        } else {
            str = "";
        }
        return str == null ? "" : str;
    }

    private static String b(String str, String str2) {
        String str3 = str2 + ContainerUtils.KEY_VALUE_DELIMITER;
        int indexOf = str.indexOf(str3);
        if (indexOf < 0) {
            return null;
        }
        int length = indexOf + str3.length();
        int indexOf2 = str.indexOf(IActionReportService.COMMON_SEPARATOR, length);
        if (indexOf2 < length) {
            indexOf2 = str.length();
        }
        return str.substring(length, indexOf2);
    }

    private void b(final IQBWebView iQBWebView, final String str) {
        if (TextUtils.isEmpty(str) || iQBWebView == null) {
            return;
        }
        if (!QBUrlUtils.w(str)) {
            H5PerformanceTimingManager.a().b(this.ap, str);
            this.ap = str;
        }
        FrameWorkLogUtil.a("QBBussinessProxy", "postLoadUrl", "postLoadUrl", str);
        this.f47066d.postAtFrontOfQueue(new Runnable() {
            @Override
            public void run() {
                iQBWebView.loadUrl(str);
            }
        });
    }

    public static void b(QBWebView qBWebView, String str) {
        SecurityLevel a2;
        if (qBWebView != null) {
            String url = qBWebView.getUrl();
            if (TextUtils.isEmpty(url) || !"c.pc.qq.com".equalsIgnoreCase(UrlUtils.getHost(url)) || (a2 = SecurityManager.a().a(str, SafetyPerceptionConsts.f72315d)) == null) {
                return;
            }
            a2.i = 3;
        }
    }

    private void b(SecurityLevelBase securityLevelBase, SecurityLevel securityLevel) {
        Field[] declaredFields;
        String str;
        QBWebView qBWebView = this.O.getCurrentWebView().getQBWebView();
        if (qBWebView == null || TextUtils.isEmpty(securityLevel.f44592a)) {
            return;
        }
        String host = UrlUtils.getHost(securityLevel.f44592a);
        String str2 = "";
        if (securityLevelBase != null && (declaredFields = SecurityLevelBase.class.getDeclaredFields()) != null && declaredFields.length > 0) {
            StringBuilder sb = new StringBuilder();
            for (Field field : declaredFields) {
                if (field != null) {
                    String name = field.getName();
                    try {
                        str = String.valueOf(field.get(securityLevelBase));
                    } catch (IllegalAccessException unused) {
                        str = "";
                    }
                    if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(str)) {
                        sb.append(name);
                        sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
                        sb.append(str);
                        sb.append(IActionReportService.COMMON_SEPARATOR);
                    }
                }
            }
            if (securityLevelBase instanceof SecurityLevel) {
                sb.append("isAdult");
                sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
                sb.append(((SecurityLevel) securityLevelBase).A);
                sb.append(IActionReportService.COMMON_SEPARATOR);
            }
            str2 = sb.toString();
        }
        if (TextUtils.isEmpty(host) || TextUtils.isEmpty(str2)) {
            return;
        }
        qBWebView.setSiteSecurityInfo(host, str2);
    }

    private void b(IWebView iWebView, IWebView iWebView2, String str) {
        boolean z;
        if (!(iWebView2 instanceof QBWebviewWrapper) || ((iWebView instanceof QBWebviewWrapper) && iWebView2 == iWebView)) {
            if (!(iWebView2 instanceof NativePage)) {
                z = true;
                if (z) {
                    AddressBarController.a().b(false, 2);
                    return;
                } else {
                    AddressBarController.a().a(false, 2);
                    return;
                }
            }
            if (this.ad.getParent() instanceof ViewGroup) {
                ((ViewGroup) this.ad.getParent()).removeView(this.ad);
            }
            this.ad.setBackgroundDrawable(new BitmapDrawable(AddressBarController.a().s()));
            NativePage nativePage = (NativePage) iWebView2;
            ((FrameLayout.LayoutParams) this.ad.getLayoutParams()).topMargin = -nativePage.getPaddingTop();
            nativePage.addView(this.ad);
            nativePage.setClipToPadding(false);
        } else if (i(str)) {
            o(iWebView2);
        }
        z = false;
        if (z) {
        }
    }

    private void b(IWebView iWebView, String str, String str2) {
        if (iWebView == null || !(iWebView instanceof QBWebviewWrapper) || TextUtils.isEmpty(str2)) {
            return;
        }
        WebBehivorInfo webBehivorInfo = new WebBehivorInfo();
        webBehivorInfo.f44602a = str2;
        webBehivorInfo.f44603b = 1;
        webBehivorInfo.f44604c = str;
        SecurityManager.a().a(webBehivorInfo);
    }

    private void b(IWebView iWebView, boolean z) {
        if (this.t) {
            AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
            addressBarDataSource.f35823d = z;
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource);
        }
    }

    private void b(Runnable runnable) {
        this.f47065c.add(runnable);
    }

    private boolean b(UrlParams urlParams) {
        return (urlParams == null || urlParams.f46351a == null || !urlParams.f46351a.startsWith("qb://home")) ? false : true;
    }

    private String c(int i, String str) {
        if (i == 6 || i == 55 || i == 56 || i == 57) {
            return str;
        }
        return null;
    }

    private void c(QBWebView qBWebView, String str) {
        if (!WebStatUnitHelper.a() || qBWebView == null || TextUtils.isEmpty(str)) {
            return;
        }
        int currentHistoryItemIndex = qBWebView.getCurrentHistoryItemIndex();
        long currentTimeMillis = System.currentTimeMillis();
        if (this.m != currentHistoryItemIndex || currentTimeMillis - this.n >= 1000) {
            j(str);
        } else {
            a(str, false);
        }
        this.ao = str;
        this.n = currentTimeMillis;
        this.m = currentHistoryItemIndex;
    }

    private void c(SecurityLevel securityLevel) {
        IWebView currentWebView;
        if (TextUtils.isEmpty(securityLevel.infoUrl) || (currentWebView = this.O.getCurrentWebView()) == null || !(currentWebView instanceof QBWebviewWrapper)) {
            return;
        }
        StatManager.b().c("AWNA13");
        QBWebView qBWebView = currentWebView.getQBWebView();
        if (qBWebView != null) {
            qBWebView.loadUrl(securityLevel.infoUrl, null, true);
            String currentUrl = this.O.getCurrentUrl();
            HashMap hashMap = new HashMap();
            hashMap.put("action_id", "1");
            hashMap.put("risk_type", String.valueOf(securityLevel.evilclass));
            hashMap.put("url", currentUrl);
            hashMap.put("domain", UrlUtils.getHost(currentUrl));
            if (!TextUtils.isEmpty(securityLevel.infoUrl)) {
                if (securityLevel.infoUrl.startsWith("https://res.imtt.qq.com/qbsecurity/qbsecurity_danger.html")) {
                    hashMap.put("webview_type", "1");
                } else if (securityLevel.infoUrl.startsWith("https://res.imtt.qq.com/qbsecurity/qbsecurity_forbidden.html")) {
                    hashMap.put("webview_type", "3");
                }
            }
            hashMap.put("operation_system", "0");
            StatManager.b().b("MTT_DANGER_WEB_INTERCEPT_REPORT", hashMap);
        }
    }

    private void c(UrlParams urlParams) {
        Bundle bundle;
        SearchZhidaReport searchZhidaReport = this.l;
        if (searchZhidaReport != null) {
            searchZhidaReport.a();
            this.l = null;
        }
        if (urlParams == null || (bundle = urlParams.h) == null || !bundle.containsKey("key_search_direct_report")) {
            return;
        }
        this.l = new SearchZhidaReport(System.currentTimeMillis(), urlParams.f46351a);
    }

    private void c(String str, String str2) {
        if (PublicSettingManager.a().e()) {
            return;
        }
        ((IVisit) QBContext.getInstance().getService(IVisit.class)).visitWeb(str, str2);
    }

    private int d(UrlParams urlParams) {
        String string;
        Bundle bundle = urlParams.h;
        int i = urlParams.f;
        boolean z = true;
        if (bundle != null && ((string = bundle.getString("appid")) == null || !"10318".equals(string))) {
            z = false;
        }
        this.ab = z;
        return i;
    }

    private void d(SecurityLevel securityLevel) {
        if (securityLevel.level == 0 || TextUtils.equals(securityLevel.url, "https://static.res.qq.com/nav/filetest/safety_page_test.html")) {
            return;
        }
        WebBehivorInfo webBehivorInfo = new WebBehivorInfo();
        webBehivorInfo.f44602a = securityLevel.url;
        webBehivorInfo.f44603b = -1;
        SecurityManager.a().a(webBehivorInfo);
    }

    private void d(IWebView iWebView, int i) {
        if (iWebView == null || iWebView.getUrl() == null || iWebView.getUrl().contains("qb://ext/read") || i != 100 || this.O == null || QBUrlUtils.X(iWebView.getUrl()) == 2) {
            return;
        }
        WindowPlaceHolder.c();
    }

    private void d(IWebView iWebView, String str) {
        String url = iWebView == null ? "" : iWebView.getUrl();
        if (TextUtils.isEmpty(url) || !url.startsWith("qb://home") || TextUtils.isEmpty(str) || !str.startsWith("qb://search")) {
            P();
            INovelPriateService iNovelPriateService = this.X;
            if (iNovelPriateService != null) {
                iNovelPriateService.onBackOrForwardChanged(str);
            }
            IPageToolBoxGuideService iPageToolBoxGuideService = (IPageToolBoxGuideService) QBContext.getInstance().getService(IPageToolBoxGuideService.class);
            if (iPageToolBoxGuideService != null) {
                iPageToolBoxGuideService.onBackOrForwardChanged(str);
            }
        }
    }

    private void d(IWebView iWebView, String str, boolean z) {
        ISearchService iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class);
        if (iSearchService != null) {
            iSearchService.onPageFinish(iWebView, str, this.ae.f47013a.f);
        }
        IPageToolBoxGuideService iPageToolBoxGuideService = (IPageToolBoxGuideService) QBContext.getInstance().getService(IPageToolBoxGuideService.class);
        if (iPageToolBoxGuideService != null) {
            iPageToolBoxGuideService.onPageFinished(iWebView, str, z);
        }
        ISystemWebViewIntercept iSystemWebViewIntercept = (ISystemWebViewIntercept) QBContext.getInstance().getService(ISystemWebViewIntercept.class);
        if (iSystemWebViewIntercept != null && (iWebView instanceof QBWebviewWrapper)) {
            iSystemWebViewIntercept.onPageFinished((QBWebviewWrapper) iWebView, str);
        }
        if ((iWebView instanceof QBWebviewWrapper) && UrlUtils.isWebUrl(str)) {
            WebPageStatHelper.getInstance().updatePageRefer(iWebView.getQBWebView(), str);
            WebPageStatHelper.getInstance().stat("web_0001", iWebView);
        }
    }

    private static boolean d(String str, String str2) {
        return (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2) || !str.startsWith(str2)) ? false : true;
    }

    private void e(IWebView iWebView, IWebView iWebView2) {
        if ((iWebView instanceof QBWebviewWrapper) && (iWebView2 instanceof QBWebviewWrapper)) {
            QBWebviewWrapper qBWebviewWrapper = (QBWebviewWrapper) iWebView2;
            if (this.O == null || TextUtils.equals(iWebView2.getUrl(), qBWebviewWrapper.v())) {
                return;
            }
            PageFrame pageFrame = this.O;
            pageFrame.onAllMetaDataFinished(pageFrame.getCurrentWebView(), null);
        }
    }

    private void e(IWebView iWebView, String str) {
        if (iWebView == null || iWebView.getQBWebView() == null || QBUrlUtils.D(str) || QBUrlUtils.w(str)) {
            return;
        }
        QBWebView qBWebView = iWebView.getQBWebView();
        Bundle a2 = SafeBundleUtil.a();
        IVideoService iVideoService = (IVideoService) QBContext.getInstance().getService(IVideoService.class);
        a2.putBoolean("forceCloseMSTypeSupported", iVideoService == null ? true : iVideoService.shouldDisableMSE(str));
        qBWebView.invokeMiscMethod("setVideoParams", a2);
    }

    private void e(IWebView iWebView, String str, boolean z) {
        boolean a2 = AddressBarController.a().a(iWebView, str, iWebView != null && iWebView.isPage(IWebView.TYPE.HTML));
        if (!z && !a2) {
            AddressBarController.a().b(false, 2);
        } else if (z && a2) {
            AddressBarController.a().a(false, 2);
        }
    }

    private void f(IWebView iWebView, String str) {
        if (iWebView == null || !(iWebView instanceof QBWebviewWrapper) || QBUrlUtils.D(str) || QBUrlUtils.w(str)) {
            return;
        }
        a(str);
    }

    private boolean f(int i) {
        return i == 6 || i == 55 || i == 56 || i == 57;
    }

    private int g(int i) {
        float f = i;
        if (f >= 1024.0f) {
            if (1024.0f > f || f >= 1048576.0f) {
                if (1048576.0f > f || f >= 1.07374182E9f) {
                    if (0.0f != f % 1.07374182E9f) {
                        return 1;
                    }
                } else if (0.0f != f % 1048576.0f) {
                    return 1;
                }
            } else if (0.0f != f % 1024.0f) {
                return 1;
            }
        }
        return 0;
    }

    private void h(int i) {
        if (FeatureToggle.a(com.tencent.library.BuildConfig.FEATURE_TOGGLE_866766095)) {
            if (UserSettingManager.b().l()) {
                EventEmiter.getDefault().emit(new EventMessage("key_event_msg_showadblock_notify", i, 0));
                return;
            } else {
                QBTask.b((Callable) new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                        int i2 = PublicSettingManager.a().getInt("KEY_NOT_ENABLE_BLOCK_SETTING_NOTE", 0);
                        if (i2 >= 3) {
                            return null;
                        }
                        ((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat("web_0131");
                        NotificationBar notificationBar = new NotificationBar("安全防护未开启,浏览网页有风险", "开启防护", 1);
                        notificationBar.a(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                EventCollector.getInstance().onViewClickedBefore(view);
                                NotificationBar.e();
                                Bundle bundle = new Bundle();
                                bundle.putInt("ViewID", 83);
                                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(IFunctionWndFactory.WND_SETTING).d(2).a(bundle).d(true));
                                ((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat("web_0132");
                                EventCollector.getInstance().onViewClicked(view);
                            }
                        });
                        notificationBar.c();
                        PublicSettingManager.a().setInt("KEY_NOT_ENABLE_BLOCK_SETTING_NOTE", i2 + 1);
                        return null;
                    }
                });
                return;
            }
        }
        if (ActivityHandler.b().a() != null) {
            final NotificationBar notificationBar = new NotificationBar(MttResources.l(R.string.boj) + i + MttResources.l(R.string.bok), MttResources.l(R.string.ahu), 3000);
            notificationBar.a(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    EventCollector.getInstance().onViewClickedBefore(view);
                    new UrlParams("qb://setting/ads").b(1).d(true).e();
                    StatManager.b().c("DIADS5");
                    EventCollector.getInstance().onViewClicked(view);
                }
            });
            this.f47066d.post(new Runnable() {
                @Override
                public void run() {
                    if (SettingDefines.f59709b) {
                        return;
                    }
                    notificationBar.c();
                    SettingDefines.f59709b = true;
                    StatManager.b().c("DIADS4");
                }
            });
            this.f47066d.postDelayed(new Runnable() {
                @Override
                public void run() {
                    SettingDefines.f59709b = false;
                }
            }, 4000L);
        }
    }

    private boolean j(boolean z) {
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return false;
        }
        if (this.Y == null || !pageFrame.preIsHideHomePage()) {
            return this.O.canInternalBack(z);
        }
        if (z && this.Y.a()) {
            return false;
        }
        if (z || !this.Y.b()) {
            return this.O.preIsHideHomePage();
        }
        return false;
    }

    private void k(boolean z) {
        if (!(z && this.Y.a()) && (z || !this.Y.b())) {
            return;
        }
        i();
    }

    public static boolean k(String str) {
        String str2;
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        ISearchEngineService iSearchEngineService = (ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class);
        if (!TextUtils.isEmpty(iSearchEngineService != null ? iSearchEngineService.getSearchWord(str) : null)) {
            return true;
        }
        String urlParamValue = UrlUtils.getUrlParamValue(str, "t");
        if (!s(urlParamValue)) {
            return false;
        }
        try {
            str2 = ((ISearchService) QBContext.getInstance().getService(ISearchService.class)).getUrlFromWhiteList((int) Long.parseLong(urlParamValue), str);
        } catch (Exception unused) {
            str2 = "";
        }
        if (d(str, str2)) {
            return true;
        }
        return TextUtils.equals(urlParamValue, "0") && str.startsWith(((ISearchService) QBContext.getInstance().getService(ISearchService.class)).getVerticalSearchPreFix());
    }

    private void l(IWebView iWebView) {
        boolean z = false;
        boolean d2 = this.O != null ? FullScreenManager.a().d(((Activity) this.O.getContext()).getWindow()) : false;
        if ((!(iWebView instanceof NativePage) || !((NativePage) iWebView).coverToolbar()) && !(iWebView instanceof IHome)) {
            PageFrame pageFrame = this.O;
            if (pageFrame != null && !pageFrame.isActive()) {
                return;
            } else {
                z = d2;
            }
        }
        WindowManager a2 = WindowManager.a();
        if (z) {
            a2.I();
        } else {
            a2.J();
        }
    }

    private void l(String str) {
        if (QBUrlUtils.D(str) || QBUrlUtils.w(str)) {
            return;
        }
        WebBehivorInfo webBehivorInfo = new WebBehivorInfo();
        webBehivorInfo.f44602a = str;
        webBehivorInfo.f44603b = 0;
        SecurityManager.a().a(webBehivorInfo);
        SecurityManager.a().a(str, (String) null, (SecurityResourceUrlInfo) null);
    }

    private boolean l(boolean z) {
        return (!TextUtils.isEmpty(this.ao) && !QBUrlUtils.w(this.ao)) && !z;
    }

    private String m(IWebView iWebView) {
        if (iWebView == null || iWebView.getQBWebView() == null) {
            return null;
        }
        return iWebView.getQBWebView().toString();
    }

    private void m(String str) {
        try {
            String queryParameter = Uri.parse(str).getQueryParameter("reportkv");
            if (TextUtils.isEmpty(queryParameter)) {
                return;
            }
            this.ai = new HashMap<>();
            this.ai.put("kv", queryParameter);
            String b2 = b(queryParameter, "scene");
            if (TextUtils.isEmpty(b2)) {
                return;
            }
            this.ai.put("scene", b2);
        } catch (Exception unused) {
        }
    }

    private void n(IWebView iWebView) {
        ITabPage currentPage;
        IWebView webPage;
        if (!(iWebView instanceof IHome) || (currentPage = ((IHome) iWebView).getCurrentPage()) == null || (webPage = currentPage.getWebPage()) == null || !webPage.isPage(IWebView.TYPE.HOME)) {
            return;
        }
        ((IHomePage) webPage).resetHeaderIfNeeded();
    }

    private boolean n(String str) {
        IUrlHistoryCheckExtension[] iUrlHistoryCheckExtensionArr;
        if (!TextUtils.isEmpty(str) && (iUrlHistoryCheckExtensionArr = (IUrlHistoryCheckExtension[]) AppManifest.getInstance().queryExtensions(IUrlHistoryCheckExtension.class)) != null && iUrlHistoryCheckExtensionArr.length > 0) {
            for (IUrlHistoryCheckExtension iUrlHistoryCheckExtension : iUrlHistoryCheckExtensionArr) {
                if (!iUrlHistoryCheckExtension.isUrlCanAddHistory(str)) {
                    return false;
                }
            }
        }
        return true;
    }

    private void o(IWebView iWebView) {
        if (this.ad.getParent() instanceof ViewGroup) {
            ((ViewGroup) this.ad.getParent()).removeView(this.ad);
        }
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.ad.getLayoutParams();
        layoutParams.height = DeviceUtils.ai() ? AddressBarController.h() : AddressBarController.h() + BaseSettings.a().n();
        BitmapDrawable bitmapDrawable = new BitmapDrawable(AddressBarController.a().a(iWebView));
        bitmapDrawable.setBounds(0, 0, DeviceUtils.af(), layoutParams.height);
        ((QBWebviewWrapper) iWebView).a(bitmapDrawable);
        AddressBarController.a().b(iWebView.getAddressBarDataSource());
    }

    private boolean o(final String str) {
        if (WebEngine.e().o()) {
            this.f47066d.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (QBBussinessProxy.this.O != null) {
                        QBBussinessProxy.this.O.loadData("<html><head><meta name='author' content='QB_SAFETY'><title>风险网址提醒</title></head><body><p style='display:none'>" + str + "</p></body></html>", "text/html;charset=UTF-8", null);
                    }
                }
            }, 100L);
            return false;
        }
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        if (currentBarDataSource != null && currentBarDataSource.b()) {
            this.O.stop();
            if (str.equalsIgnoreCase(currentBarDataSource.f35821b)) {
                c(true);
            }
        }
        this.f47066d.post(new Runnable() {
            @Override
            public void run() {
                if (QBBussinessProxy.this.O != null) {
                    QBBussinessProxy.this.O.loadData("<html><head><meta name='author' content='QB_SAFETY'><title>风险网址提醒</title></head><body><p style='display:none'>" + str + "</p></body></html>", "text/html;charset=UTF-8", null);
                }
            }
        });
        return true;
    }

    private void p(String str) {
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            IWebView currentWebView = pageFrame.getCurrentWebView();
            if (FeatureToggle.a(qb.business.BuildConfig.BUG_TOGGLE_94421827)) {
                WebSiteCacher.a().a(currentWebView, str);
            } else {
                WebSiteCacher.a().a(currentWebView);
            }
        }
    }

    private boolean p(IWebView iWebView) {
        return (this.j || iWebView == null || !iWebView.isHomePage()) ? false : true;
    }

    private int q(IWebView iWebView) {
        Bundle extra = ((iWebView instanceof NativePage) || (iWebView instanceof QBWebviewWrapper)) ? iWebView.getExtra() : null;
        if (extra == null) {
            return -1;
        }
        int i = extra.getInt(TangramHippyConstants.APPID);
        extra.remove(TangramHippyConstants.APPID);
        return i;
    }

    private boolean q(String str) {
        return (this.ac != null || TextUtils.isEmpty(str) || (str.startsWith("qb://") && !str.startsWith("qb://app/id/11028")) || str.startsWith("tencent://") || str.startsWith("file://")) ? false : true;
    }

    private String r(String str) {
        String trim = str.toLowerCase().trim();
        ISearchEngineService iSearchEngineService = (ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class);
        ArrayList<SearchConfRule> searchRules = iSearchEngineService.getSearchRules();
        if (searchRules == null || searchRules.size() <= 0) {
            return null;
        }
        Iterator<SearchConfRule> it = searchRules.iterator();
        while (it.hasNext()) {
            SearchConfRule next = it.next();
            if (Pattern.matches(next.sDefaultPageRule, trim)) {
                Iterator<SearchEngineItemInfo> it2 = iSearchEngineService.getSearchItems().iterator();
                while (it2.hasNext()) {
                    SearchEngineItemInfo next2 = it2.next();
                    if (TextUtils.equals(next2.f70408b, next.sFullName)) {
                        return next2.j;
                    }
                }
            }
        }
        return null;
    }

    private void r(IWebView iWebView) {
        Runnable runnable = this.W;
        if (runnable != null) {
            this.f47065c.remove(runnable);
        }
        final String pageTitle = iWebView.getPageTitle();
        final String str = this.U;
        b(new Runnable() {
            @Override
            public void run() {
                ISearchService iSearchService;
                if (TextUtils.isEmpty(pageTitle) || TextUtils.isEmpty(str) || (iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class)) == null) {
                    return;
                }
                iSearchService.addInputHistory(pageTitle, str);
            }
        });
    }

    private void s(IWebView iWebView) {
        if (iWebView instanceof QBWebviewWrapper) {
            Bundle bundle = new Bundle();
            bundle.putString("cancelFrom", "BACK");
            TraceEventCallback.a().c(iWebView.getUrl(), bundle);
        }
    }

    private static boolean s(String str) {
        return !TextUtils.isEmpty(str) && (str.length() == 1 || str.length() == 2) && str.matches("[0-9]+");
    }

    private void t(IWebView iWebView) {
        if (this.O == null || iWebView == null) {
            return;
        }
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        if (addressBarDataSource != null) {
            ProgressCalculator progressCalculator = addressBarDataSource.e;
            if (progressCalculator != null) {
                progressCalculator.a((byte) 1);
            }
            this.O.setPageState((byte) 0);
        }
        c(iWebView);
    }

    private boolean t(String str) {
        if (((IMultiWindowService) QBContext.getInstance().getService(IMultiWindowService.class)).isShowing()) {
            return true;
        }
        if (!QBUrlUtils.G(str)) {
            return false;
        }
        IFileOpenManager iFileOpenManager = (IFileOpenManager) QBContext.getInstance().getService(IFileOpenManager.class);
        if (iFileOpenManager != null) {
            iFileOpenManager.openFile(str, 3);
        }
        return true;
    }

    private void u(IWebView iWebView) {
        WindowManager a2 = WindowManager.a();
        PageFrame f = a2.f(d());
        if (f != null && f.getBussinessProxy().e() != -1 && a2.f(f.getBussinessProxy().e()) != null) {
            a2.b(f.getBussinessProxy().e());
        }
        if (f == null || f.canGoBack(false) || a2.y() <= 1) {
            return;
        }
        a2.c(d());
    }

    private boolean u(String str) {
        if ("hide".equalsIgnoreCase(str)) {
            return true;
        }
        return "normalhide".equalsIgnoreCase(str);
    }

    private void v(IWebView iWebView) {
        this.au = 0L;
        this.t = false;
        this.ax = this.av;
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        addressBarDataSource.f35823d = false;
        this.ae.a(addressBarDataSource);
        AddressBarController.a().a(addressBarDataSource);
    }

    private boolean v(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        BackStragety backStragety = this.Y;
        return ((backStragety instanceof NoStatementExternalCallBackStragety) || (backStragety instanceof StatementExternalCallBackStragety)) ? false : true;
    }

    private void w(IWebView iWebView) {
        if (iWebView == null || (iWebView instanceof QBWebviewWrapper)) {
            ((INotify) QBContext.getInstance().getService(INotify.class)).closeBubble(IMessageBubbleService.MESSAGE_MODE_SHOW_TRANSLATE);
        }
        if (N > 0) {
            ((IMessageBubbleService) QBContext.getInstance().getService(IMessageBubbleService.class)).closeMyBubble(N);
            N = 0L;
        }
    }

    @Override
    public void A() {
        FullScreenManager.a().a((Window) null, 1);
        RotateScreenManager.a().a((Activity) null, 4, 2);
    }

    @Override
    public void B() {
        FullScreenManager.a().b(null, 1);
        RotateScreenManager.a().b(null, 4, 2);
    }

    @Override
    public void C() {
        FullScreenManager.a().a((Window) null, 1);
    }

    @Override
    public void D() {
        FullScreenManager.a().b(null, 1);
    }

    @Override
    public int E() {
        return AddressBarController.a().l();
    }

    @Override
    public int F() {
        return DeviceUtils.ai() ? AddressBarController.k() : AddressBarController.h();
    }

    @Override
    public void G() {
        if (this.aq == null || ActivityHandler.b().n() == null) {
            return;
        }
        FullScreenManager.a().b(null, 1);
        ((FrameLayout) ActivityHandler.b().n().getWindow().getDecorView()).removeView(this.q);
        ReportRemoveView.a();
        this.q = null;
        this.aq = null;
        CustomViewCallback customViewCallback = this.f47063ar;
        if (customViewCallback != null) {
            customViewCallback.a();
        }
        this.f47063ar = null;
        ActivityHandler.b().n().setRequestedOrientation(this.as);
    }

    @Override
    public int H() {
        return RotateScreenManager.a().c();
    }

    @Override
    public int I() {
        return RotateScreenManager.a().d();
    }

    @Override
    public String J() {
        IVideoService iVideoService = (IVideoService) QBContext.getInstance().getService(IVideoService.class);
        if (iVideoService != null) {
            return iVideoService.getCurrentVideoUrl();
        }
        return null;
    }

    protected void K() {
        this.f47066d.post(new Runnable() {
            @Override
            public void run() {
                WindowManager a2 = WindowManager.a();
                if (QBBussinessProxy.this.e() != -1) {
                    a2.b(QBBussinessProxy.this.e());
                }
                a2.c(QBBussinessProxy.this.d());
            }
        });
    }

    public void L() {
        int i;
        if (TextUtils.equals(PublicSettingManager.a().getString("ANDROID_PUBLIC_PREFS_DEFAULT_BROWSER_SET_TIPS", "1"), "0") || "com.tencent.mtt".equals(WebEngine.e().G()) || (i = PublicSettingManager.a().getInt("set_default_browser_tips_show_times", 0)) >= 3) {
            return;
        }
        if (System.currentTimeMillis() - PublicSettingManager.a().getLong("set_default_browser_tips_last_show_time", 0L) < 86400000) {
            return;
        }
        NormalMessageBundle normalMessageBundle = new NormalMessageBundle();
        normalMessageBundle.f32713d = "设置QQ浏览器为默认浏览器,打开网页更便捷";
        normalMessageBundle.m = "";
        normalMessageBundle.e = "去设置";
        normalMessageBundle.f = true;
        ((IMessageBubbleService) QBContext.getInstance().getService(IMessageBubbleService.class)).showNormalBubble(normalMessageBundle, new IMessageBubbleListener() {
            @Override
            public void a() {
                Bundle bundle = new Bundle();
                bundle.putInt("ViewID", 13);
                bundle.putInt("set_default_browser_from_where", 1);
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(IFunctionWndFactory.WND_SETTING).d(2).a(bundle).d(true));
                StatManager.b().c("BHS0003");
            }

            @Override
            public void b() {
                Bundle bundle = new Bundle();
                bundle.putInt("ViewID", 13);
                bundle.putInt("set_default_browser_from_where", 1);
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(IFunctionWndFactory.WND_SETTING).d(2).a(bundle).d(true));
                StatManager.b().c("BHS0003");
            }

            @Override
            public void c() {
            }
        });
        StatManager.b().c("BHS0002");
        PublicSettingManager.a().setLong("set_default_browser_tips_last_show_time", System.currentTimeMillis());
        PublicSettingManager.a().setInt("set_default_browser_tips_show_times", i + 1);
    }

    @Override
    public QBBussinessProxy getBussinessProxy() {
        return this;
    }

    @Override
    public WebResourceResponse a(QBWebView qBWebView, WebResourceRequest webResourceRequest) {
        ((IWebPageService) QBContext.getInstance().getService(IWebPageService.class)).shouldInterceptRequest(this.O, qBWebView, webResourceRequest.getUrl().toString());
        return this.ah.a(qBWebView, webResourceRequest);
    }

    @Override
    public WebResourceResponse a(QBWebView qBWebView, String str) {
        ((IWebPageService) QBContext.getInstance().getService(IWebPageService.class)).shouldInterceptRequest(this.O, qBWebView, str);
        return this.ah.b(qBWebView, str);
    }

    @Override
    public JsCallback a(IWebView iWebView, QBWebView qBWebView, IWebViewClient iWebViewClient) {
        Object createJsApi;
        JsapiCallback jsapiCallback = ((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getJsapiCallback(qBWebView, iWebViewClient);
        qBWebView.addJavascriptInterface(((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getX5JsExtensions(jsapiCallback), "x5mtt");
        qBWebView.addJavascriptInterface(((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getWebAppJsExtensions(jsapiCallback), IHostService.PKG_SHORT);
        qBWebView.addJavascriptInterface(((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getPushJsExtensions(jsapiCallback), "push");
        qBWebView.addJavascriptInterface(((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getJsBaiduyunExtensions(jsapiCallback), "baiduyun");
        Object openJsApiBridge = ((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getOpenJsApiBridge(jsapiCallback, -1L);
        boolean z = iWebView instanceof QBWebviewWrapper;
        if (z) {
            ((QBWebviewWrapper) iWebView).f46540b = openJsApiBridge;
        }
        qBWebView.addJavascriptInterface(openJsApiBridge, "qb_bridge");
        Object novelJsExtensionInhost = ((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getNovelJsExtensionInhost(jsapiCallback, qBWebView, 0, null);
        ((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).addNoveJsImplJsapi(qBWebView.getJsApiBridge(), novelJsExtensionInhost);
        qBWebView.addJavascriptInterface(novelJsExtensionInhost, "qbbookshelf");
        if (!X5WebEngine.e().i() && z && (createJsApi = ((ISystemWebViewIntercept) QBContext.getInstance().getService(ISystemWebViewIntercept.class)).createJsApi((QBWebviewWrapper) iWebView, qBWebView)) != null) {
            qBWebView.addJavascriptInterface(createJsApi, ISystemWebViewIntercept.QB_INTERCEPT_API_NAME);
        }
        return jsapiCallback;
    }

    @Override
    public PageListInfo a(Context context, PageFrame pageFrame, String str, Bundle bundle, List list) {
        GroupList groupList = new GroupList();
        ArrayList<String> arrayList = new ArrayList(bundle.keySet());
        AbnormalPageData.sortKeys(arrayList);
        int i = 0;
        for (String str2 : arrayList) {
            if (str2 != null && str2.startsWith(AbnormalPageData.STACK_NAME_PRE)) {
                i = a(context, pageFrame, groupList, i, bundle.get(str2));
            }
        }
        PageListInfo pageListInfo = new PageListInfo();
        pageListInfo.f46528a = groupList;
        groupList.a("QBBussinessProxyrestoreState");
        pageListInfo.f46529b = bundle.getInt(AbnormalPageData.CUR_INDEX);
        if (UrlUtils.isWebUrl(str)) {
            WebPageStatHelper.getInstance().a(String.valueOf(19));
        }
        return pageListInfo;
    }

    @Override
    public String a(UrlParams urlParams, IWebView iWebView) {
        a(urlParams);
        b(urlParams.f);
        c(urlParams.r);
        this.aj = urlParams;
        IPageToolBoxService iPageToolBoxService = (IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class);
        if (iPageToolBoxService != null) {
            iPageToolBoxService.showSaveToastDelay(urlParams);
        }
        String str = urlParams.f46351a;
        Bundle bundle = urlParams.h;
        String c2 = UrlDispatcher.c(str);
        if (StringUtils.b(c2)) {
            return null;
        }
        String a2 = UrlDispatcher.a(c2, false, bundle);
        if (StringUtils.b(a2) && iWebView != null && !TextUtils.isEmpty(iWebView.getUrl())) {
            return null;
        }
        if (WebPageStatHelper.getInstance().b(a2)) {
            WebPageStatHelper.getInstance().a(urlParams);
        }
        d(urlParams);
        this.T = c(q(), a2);
        h();
        return a2;
    }

    @Override
    public void a(byte b2) {
        int q = q();
        if (q == 6 || q == 55 || q == 56 || q == 57) {
            this.T = null;
        }
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        if (currentBarDataSource == this.ac) {
            this.ac = null;
        }
        if (currentBarDataSource != null) {
            this.ae.a(currentBarDataSource);
            AddressBarController.a().a(currentBarDataSource);
        }
    }

    @Override
    public void a(int i) {
        this.f47064b = i;
    }

    @Override
    public void a(int i, int i2) {
        PageFrame s2 = WindowManager.a().s();
        if (s2 == null || this.O != s2) {
            return;
        }
        s2.onSlidingTitleOffScreen(i, i2);
    }

    @Override
    public void a(int i, int i2, String str, boolean z) {
        UserSettingManager b2 = UserSettingManager.b();
        if (b2.m()) {
            b2.setLong("key_last_block_adv_toaster_time", System.currentTimeMillis());
            h(i + i2);
        }
        MetricsStatisticManager.b().a(Apn.getApnName(Apn.sApnType), i, i2);
    }

    @Override
    public void a(int i, String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("nativeAddData", "Type = " + String.valueOf(i) + " ; " + str);
        StatManager.b().b("native_crash", hashMap);
    }

    @Override
    public void a(int i, final String str, QBWebView qBWebView) {
        if (PublicSettingManager.a().e() || i != 1 || qBWebView == null || qBWebView.getUrl() == null) {
            return;
        }
        final String title = qBWebView.getTitle();
        RoutineDaemon.a().a(new Runnable() {
            @Override
            public void run() {
                ((IHistory) SDKContext.getInstance().getService(IHistory.class)).addHistory(title, str);
            }
        });
    }

    @Override
    public void a(Bundle bundle, GroupList groupList, int i) {
        int i2;
        GroupList groupList2 = new GroupList();
        groupList2.a(groupList);
        for (int i3 = 0; i3 < groupList2.b(); i3++) {
            List c2 = groupList2.c(i3);
            while (i2 < c2.size()) {
                Object obj = c2.get(i2);
                String str = AbnormalPageData.STACK_NAME_PRE + i3 + "_" + i2;
                if (obj instanceof QBWebviewWrapper) {
                    Bundle bundle2 = new Bundle(9);
                    QBWebView qBWebView = ((QBWebviewWrapper) obj).getQBWebView();
                    if (qBWebView != null) {
                        qBWebView.saveQBState(bundle2);
                        bundle.putBundle(str, bundle2);
                    }
                    i2 = bundle2.size() != 0 ? i2 + 1 : 0;
                    a(bundle, (IWebView) obj, str);
                } else if (obj instanceof PagePlaceHolder) {
                    a(bundle, (PagePlaceHolder) obj, str);
                } else {
                    if (!(obj instanceof IWebView)) {
                    }
                    a(bundle, (IWebView) obj, str);
                }
            }
        }
        bundle.putInt(AbnormalPageData.CUR_INDEX, i);
    }

    @Override
    public void a(Message message, Message message2) {
        WebViewDialogUtils.a(message, message2);
    }

    @Override
    public void a(View view, float f, float f2) {
        QBWebView qBWebView;
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            IWebView currentWebView = pageFrame.getCurrentWebView();
            if (!(currentWebView instanceof QBWebviewWrapper) || view != ((QBWebviewWrapper) currentWebView).a()) {
                currentWebView = null;
            }
            if (currentWebView == null) {
                IWebView nextWebView = ((NewPageFrame) this.O).getNextWebView();
                if ((nextWebView instanceof QBWebviewWrapper) && view == ((QBWebviewWrapper) nextWebView).a()) {
                    currentWebView = nextWebView;
                }
            }
            if (currentWebView == null || (qBWebView = currentWebView.getQBWebView()) == null) {
                return;
            }
            Bundle bundle = new Bundle(9);
            bundle.putFloat("scaleX", f);
            bundle.putFloat("scaleY", f2);
            qBWebView.invokeMiscMethod("setAddressbarScale", bundle);
        }
    }

    @Override
    public void a(View view, int i, CustomViewCallback customViewCallback) {
        if (this.aq != null) {
            customViewCallback.a();
            return;
        }
        this.as = ActivityHandler.b().n().getRequestedOrientation();
        FrameLayout frameLayout = (FrameLayout) ActivityHandler.b().n().getWindow().getDecorView();
        this.q = new FullscreenHolder(ContextHolder.getAppContext());
        this.q.addView(view, r);
        frameLayout.addView(this.q, r);
        this.aq = view;
        FullScreenManager.a().a((Window) null, 1);
        this.f47063ar = customViewCallback;
        ActivityHandler.b().n().setRequestedOrientation(i);
    }

    @Override
    public void a(View view, ViewGroup.LayoutParams layoutParams) {
        WindowManager.a().a(view, layoutParams);
    }

    @Override
    public void a(View view, CustomViewCallback customViewCallback) {
        if (this.aq != null) {
            customViewCallback.a();
            return;
        }
        this.as = ActivityHandler.b().n().getRequestedOrientation();
        FrameLayout frameLayout = (FrameLayout) ActivityHandler.b().n().getWindow().getDecorView();
        this.q = new FullscreenHolder(ContextHolder.getAppContext());
        this.q.addView(view, r);
        frameLayout.addView(this.q, r);
        this.aq = view;
        this.f47063ar = customViewCallback;
        FullScreenManager.a().a((Window) null, 1);
    }

    public void a(IQBWebView iQBWebView, String str) {
        if (iQBWebView == null) {
            return;
        }
        boolean z = !VideoAutoPlayHelper.a().a(str);
        Bundle bundle = new Bundle(9);
        bundle.putBoolean("require", z);
        iQBWebView.invokeMiscMethod("setVideoPlaybackRequiresUserGesture", bundle);
        QBWebSettings qBSettings = iQBWebView.getQBSettings();
        if (qBSettings != null) {
            qBSettings.b(z);
        }
    }

    @Override
    public void a(QBWebView qBWebView) {
    }

    @Override
    public void a(QBWebView qBWebView, int i, String str, String str2) {
        p(str2);
        c(qBWebView, str2);
    }

    @Override
    public void a(QBWebView qBWebView, String str, GeolocationPermissionsCallback geolocationPermissionsCallback) {
        if (ViewCompat.d(qBWebView)) {
            WebViewDialogUtils.a(qBWebView, ActivityHandler.b().n(), str, new WebViewDialogUtils.GeolocationPermissionsCallback(geolocationPermissionsCallback));
        } else {
            geolocationPermissionsCallback.a(str, false, false);
        }
    }

    @Override
    public void a(QBWebView qBWebView, String str, String str2, int i) {
        if (UrlUtils.isWebUrl(str) || UrlUtils.isWsUrl(str) || UrlUtils.isWssUrl(str)) {
            if (i == 1) {
                SecurityManager.a().a(str, (String) null, (SecurityResourceUrlInfo) null);
                return;
            }
            String url = qBWebView.getUrl();
            SecurityResourceUrlInfo securityResourceUrlInfo = new SecurityResourceUrlInfo();
            securityResourceUrlInfo.f44596a = str;
            securityResourceUrlInfo.f44597b = i;
            SecurityManager.a().a(url, str2, securityResourceUrlInfo);
        }
    }

    @Override
    public void a(QBWebView qBWebView, boolean z) {
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        this.ae.a(currentBarDataSource);
        AddressBarController.a().a(currentBarDataSource);
    }

    @Override
    public void a(QBWebSettings qBWebSettings) {
        qBWebSettings.m(ImageLoadManager.getInstance().getImageLoadsAutomatcily());
        qBWebSettings.n(ImageLoadManager.getInstance().a());
    }

    @Override
    public void a(final SecurityLevelBase securityLevelBase, boolean z) {
        SecurityLevel a2 = SecurityManager.a().a(securityLevelBase.url, SafetyPerceptionConsts.f72315d);
        final SecurityLevel securityLevel = a2 != null ? a2 : new SecurityLevel(securityLevelBase);
        securityLevel.a(securityLevelBase);
        Logs.c("MttSecurityManager_core", "isDirectx: " + z);
        Logs.c("MttSecurityManager_core", "onSecurityCheckCompleted: " + securityLevel.toString());
        SecurityManager.a().a(securityLevel);
        Runnable runnable = this.Z;
        if (runnable != null) {
            this.f47066d.removeCallbacks(runnable);
        }
        if (z) {
            AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
            if (this.O != null && currentBarDataSource != null && a(currentBarDataSource.f35821b, securityLevel)) {
                b(a2, securityLevel);
            }
        }
        b(securityLevel);
        this.Z = new Runnable() {
            @Override
            public void run() {
                AddressBarDataSource currentBarDataSource2 = QBBussinessProxy.this.getCurrentBarDataSource();
                if (currentBarDataSource2 == null || !QBBussinessProxy.a(currentBarDataSource2.f35821b, securityLevel)) {
                    return;
                }
                QBBussinessProxy.this.a(securityLevelBase, securityLevel);
                QBBussinessProxy.this.a(currentBarDataSource2, securityLevel);
            }
        };
        this.f47066d.post(this.Z);
    }

    public void a(SecurityLevel securityLevel) {
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return;
        }
        IWebView currentWebView = pageFrame.getCurrentWebView();
        if (securityLevel == null || currentWebView == null) {
            return;
        }
        String url = currentWebView.getUrl();
        if (!StringUtils.b(url) && a(url, securityLevel)) {
            AddressBarDataSource addressBarDataSource = this.O.getCurrentWebView().getAddressBarDataSource();
            if (addressBarDataSource != null) {
                addressBarDataSource.a(SecurityLevel.class, securityLevel);
            }
            this.e = null;
        }
    }

    @Override
    public void a(IWebView iWebView) {
        ClipboardManager.getInstance().clearDraftCache(m(iWebView));
        this.f47066d.post(this.M);
        PageFrame pageFrame = this.O;
        if (pageFrame == null || iWebView == null || iWebView != pageFrame.getCurrentWebView()) {
            return;
        }
        P();
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.onTransitionToCommitted(iWebView.getUrl());
        }
    }

    @Override
    public void a(IWebView iWebView, int i) {
        ISearchService iSearchService = this.af;
        if (iSearchService != null) {
            iSearchService.onProgressChanged(iWebView, i);
        }
        if (this.t || iWebView == null) {
            return;
        }
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        ProgressCalculator progressCalculator = addressBarDataSource != null ? addressBarDataSource.e : null;
        d(iWebView, i);
        if (a(iWebView, i, progressCalculator)) {
            progressCalculator.a((byte) 2);
        }
        if (progressCalculator != null) {
            progressCalculator.a(i, false);
        }
        if (i == 100) {
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource);
        }
    }

    @Override
    public void a(IWebView iWebView, int i, int i2, String str) {
        if (i2 <= 0 || !this.t) {
            return;
        }
        int i3 = this.av;
        int i4 = (((100 - i3) * i) / i2) + i3;
        if (i >= i2) {
            b(iWebView, false);
            a(iWebView, false);
            a(iWebView, 100, true);
        } else {
            a(iWebView, i4, true);
            if (System.currentTimeMillis() - this.au > 100) {
                this.au = System.currentTimeMillis();
                b(iWebView, true);
            }
        }
    }

    @Override
    public void a(IWebView iWebView, int i, String str, String str2) {
        a(iWebView, TraceEvent.TraceAction.WEB_ON_RECEIVE_ERROR, str2);
        a(iWebView, TraceEvent.TraceAction.LAUNCH_FINISH, str2);
        if (this.t) {
            a(iWebView, false);
            AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
            addressBarDataSource.f35823d = false;
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource);
        }
        if (i == -50) {
            BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                @Override
                public void run() {
                    IPageToolBoxService iPageToolBoxService = (IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class);
                    if (iPageToolBoxService != null) {
                        iPageToolBoxService.closeErrorMHTWindow();
                    }
                }
            });
        }
        if (!StringUtils.b(this.T)) {
            this.T = null;
        }
        h();
        AddressBarDataSource addressBarDataSource2 = iWebView.getAddressBarDataSource();
        if (addressBarDataSource2 != null && !TextUtils.isEmpty(str2) && str2.equalsIgnoreCase(addressBarDataSource2.f35821b)) {
            addressBarDataSource2.f35820a = str2;
            addressBarDataSource2.a(SecurityLevel.class, (Object) null);
            this.ae.a(addressBarDataSource2);
            AddressBarController.a().a(addressBarDataSource2);
        }
        d(iWebView, 100);
        if ((iWebView instanceof QBWebviewWrapper) && UrlUtils.isWebUrl(str2)) {
            WebPageStatHelper.getInstance().stat("web_0082", iWebView);
        }
    }

    public void a(IWebView iWebView, int i, boolean z) {
        this.ax = i;
        if (i >= 100) {
            this.ax = 0;
            if (z) {
                c(iWebView, iWebView.getUrl());
                PageFrame pageFrame = this.O;
                if (pageFrame != null) {
                    pageFrame.setPageState((byte) 0);
                }
            } else if (iWebView.isActive()) {
                d(iWebView);
            }
        }
        iWebView.getAddressBarDataSource().e.a(i, z);
    }

    @Override
    public void a(IWebView iWebView, View view, int i, boolean z, int i2, boolean z2) {
        if (iWebView != null && i != 0 && iWebView.getQBWebView() != null) {
            if (!WebEngine.e().g() || !this.o) {
                if (i == 1 || i == 2) {
                    iWebView.getAddressBarDataSource().h();
                } else if (i == 3 || i == 4) {
                    iWebView.getAddressBarDataSource().a(0);
                }
            }
            if (WebEngine.e().g()) {
                iWebView.getQBWebView().setAddressbarDisplayMode(i, z, z2);
                return;
            }
            return;
        }
        if (!(view instanceof SystemWebView) || iWebView == null) {
            if (iWebView != null) {
                if (i != 1 && i != 2) {
                    if (i != 3 && i != 4) {
                        return;
                    }
                    iWebView.getAddressBarDataSource().a(0);
                }
                iWebView.getAddressBarDataSource().a(AddressBarController.h());
                return;
            }
            return;
        }
        if (i == 1 || i == 2) {
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
            if (layoutParams != null) {
                layoutParams.setMargins(0, AddressBarController.h(), 0, 0);
            }
            iWebView.getAddressBarDataSource().a(AddressBarController.h());
            return;
        }
        if (i == 3 || i == 4) {
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) view.getLayoutParams();
            if (layoutParams2 != null) {
                layoutParams2.setMargins(0, 0, 0, 0);
            }
            iWebView.getAddressBarDataSource().a(0);
        }
    }

    @Override
    public void a(IWebView iWebView, IWebView iWebView2) {
        e(iWebView, iWebView2);
        String url = iWebView2 == null ? "" : iWebView2.getUrl();
        this.ac = null;
        a(iWebView, iWebView2, getCurrentBarDataSource());
        AddressBarController.a().m();
        PageFrame pageFrame = this.O;
        if (pageFrame != null && iWebView2 != null && iWebView2 == pageFrame.getCurrentWebView()) {
            d(iWebView, url);
        }
        PageFrame pageFrame2 = this.O;
        if (pageFrame2 != null && pageFrame2.getHost() != null) {
            ((IRecover) QBContext.getInstance().getService(IRecover.class)).saveAbnormalData(this.O);
        }
        IPageToolBoxService iPageToolBoxService = (IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class);
        if (iPageToolBoxService != null) {
            iPageToolBoxService.dismissPageFindDialog();
            iPageToolBoxService.dismissTranslateDialog();
        }
        if (((IServiceManager) QBContext.getInstance().getService(IServiceManager.class)).isWebTIpsShowing()) {
            ((IServiceManager) QBContext.getInstance().getService(IServiceManager.class)).hideWebTipsIfNeeded(url);
        }
        final IWebView t = WindowManager.t();
        l(t);
        if (!this.f) {
            this.f = false;
            BrowserExecutorSupplier.postForBackgroundTasks(new BrowserExecutorSupplier.BackgroundRunable() {
                @Override
                public void doRun() {
                    EventEmiter eventEmiter = EventEmiter.getDefault();
                    Object[] objArr = new Object[4];
                    objArr[0] = ContextHolder.getAppContext();
                    objArr[1] = QBBussinessProxy.this.g;
                    objArr[2] = t;
                    objArr[3] = Boolean.valueOf(QBBussinessProxy.this.l() != null);
                    eventEmiter.emit(new EventMessage("event_bussiness_proxy_trigger_wifi_notify", objArr));
                    QBBussinessProxy.this.g = null;
                }
            });
        }
        if (iWebView2 != null && iWebView != null && iWebView2 != iWebView && (iWebView2.isPage(IWebView.TYPE.HTML) || iWebView.isPage(IWebView.TYPE.HTML))) {
            c(iWebView2.getQBWebView(), iWebView2.getUrl());
        }
        EventEmiter.getDefault().emit(new EventMessage("browser.business.sniffer.on_back_or_forward_changed", iWebView, iWebView2));
        w(iWebView);
        this.ah.b(url);
        InnerPushProxy.a(iWebView, iWebView2);
    }

    @Override
    public void a(IWebView iWebView, IWebView iWebView2, String str, boolean z, boolean z2, boolean z3) {
        this.j = z;
        if ((z && z3) || (!z && z2)) {
            a(iWebView, iWebView2, str);
        } else if (DeviceUtils.ai()) {
            e(iWebView2, str, z);
        }
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        if (currentBarDataSource != null && currentBarDataSource.b()) {
            currentBarDataSource.e.a((byte) 1);
            currentBarDataSource.e.i();
        }
        n(iWebView2);
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            pageFrame.setPageState((byte) 0);
        }
        AddressBarController.a().q();
        AddressBarController.a().b(4);
        P();
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.onBackForwardAnimationStarted();
        }
        ((IWebPageService) QBContext.getInstance().getService(IWebPageService.class)).onBackChanged(str);
    }

    @Override
    public void a(IWebView iWebView, String str) {
        if (iWebView != null) {
            ((IVisit) QBContext.getInstance().getService(IVisit.class)).onReceivedTitle(iWebView.getUrl(), str);
        }
        b(iWebView);
        a(this.e);
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        if (addressBarDataSource != null) {
            SecurityLevel a2 = SecurityManager.a().a(iWebView.getUrl(), SafetyPerceptionConsts.e);
            if (a2 == null || !a2.a()) {
                addressBarDataSource.f35820a = str;
            } else {
                addressBarDataSource.f35820a = iWebView.getUrl();
            }
            addressBarDataSource.f35821b = iWebView.getUrl();
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource);
        }
        PageFrame pageFrame = this.O;
        if (pageFrame != null && pageFrame.getHost() != null) {
            ((IRecover) QBContext.getInstance().getService(IRecover.class)).saveAbnormalData(this.O);
        }
        ISearchService iSearchService = this.af;
        if (iSearchService != null) {
            iSearchService.onReceiveTitle(iWebView.getUrl(), str);
        }
    }

    public void a(IWebView iWebView, String str, int i) {
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        if (addressBarDataSource == null || addressBarDataSource.e == null || addressBarDataSource.e.e() == 0) {
            return;
        }
        addressBarDataSource.e.a((byte) 0);
    }

    @Override
    public void a(IWebView iWebView, String str, long j, int i) {
        PageVideoExtension pageVideoExtension = (PageVideoExtension) AppManifest.getInstance().queryExtension(PageVideoExtension.class, null);
        if (pageVideoExtension != null) {
            pageVideoExtension.onDownloadVideo(iWebView, str, j, i, this.F, d());
        }
    }

    @Override
    public void a(IWebView iWebView, String str, String str2, String str3, String str4, long j) {
        if (t(str)) {
            return;
        }
        String b2 = FileUtils.b(UrlUtils.guessFileName(str, str3, str4));
        if (iWebView != null && iWebView.getQBWebView() != null) {
            if (this.ag.a(iWebView, iWebView.getUrl(), b2)) {
                return;
            }
        }
        final DownloadInfo downloadInfo = new DownloadInfo();
        String url = iWebView == null ? "" : iWebView.getUrl();
        a(iWebView, str, str4, j, b2, downloadInfo);
        if (str != null && (url == null || str.equals(url))) {
            u(iWebView);
        }
        t(iWebView);
        if (SecurityManager.a().e(url)) {
            return;
        }
        b(iWebView, str, url);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                DownloadServiceManager.a().updateDownloadInfo(downloadInfo);
                DownloadServiceManager.a().startBusinessDownload(downloadInfo);
            }
        }, 200L);
    }

    @Override
    public void a(IWebView iWebView, String str, boolean z) {
        m(str);
        a(iWebView, false);
        boolean z2 = iWebView instanceof QBWebviewWrapper;
        if (z2) {
            ((INotify) QBContext.getInstance().getService(INotify.class)).closeBubble(IMessageBubbleService.MESSAGE_MODE_SHOW_TRANSLATE);
        }
        ((INotify) QBContext.getInstance().getService(INotify.class)).closeBubble(8);
        IPageToolBoxService iPageToolBoxService = (IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class);
        if (iPageToolBoxService != null) {
            iPageToolBoxService.dismissPageFindDialog();
            iPageToolBoxService.dismissTranslateDialog();
        }
        if (iWebView != null && z2) {
            l(str);
        }
        String url = iWebView.getUrl();
        LogSdkExt.a(2024, "-1", url, (View) null);
        AddressBarController.a().f();
        a(iWebView, url, z, a(iWebView, url, AddressBarController.a().e()), iWebView == null ? null : iWebView.getAddressBarDataSource());
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            pageFrame.setPageState((byte) 1);
            if (iWebView != null && iWebView == this.O.getCurrentWebView()) {
                P();
                INovelPriateService iNovelPriateService = this.X;
                if (iNovelPriateService != null) {
                    iNovelPriateService.onPageStart(url);
                }
            }
        }
        QBWebviewJSInjector.a().a(url);
        SecurityActionRecorder.a().h();
        ((IWebPageService) QBContext.getInstance().getService(IWebPageService.class)).onPageStarted(iWebView, url);
        ISearchService iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class);
        if (iSearchService != null) {
            iSearchService.onPageStart(url);
        }
        IPageToolBoxGuideService iPageToolBoxGuideService = (IPageToolBoxGuideService) QBContext.getInstance().getService(IPageToolBoxGuideService.class);
        if (iPageToolBoxGuideService != null) {
            iPageToolBoxGuideService.onPageStarted(iWebView, url, z);
        }
        e(iWebView, url);
        a(iWebView, TraceEvent.TraceAction.WEB_ON_PAGE_START, url);
    }

    @Override
    public void a(UrlParams urlParams, String str, boolean z, PageFrame pageFrame) {
        Bundle bundle;
        int i;
        if (urlParams != null) {
            bundle = urlParams.h;
            i = urlParams.f;
        } else {
            bundle = null;
            i = 0;
        }
        this.ai = null;
        m(str);
        PageLoadInfo pageLoadInfo = new PageLoadInfo();
        pageLoadInfo.f46841a = pageFrame;
        pageLoadInfo.f46843c = this.Y;
        pageLoadInfo.f46842b = urlParams;
        pageLoadInfo.f46844d = str;
        pageLoadInfo.e = z;
        pageLoadInfo.f = i;
        EventEmiter.getDefault().emit(new EventMessage("event_bussiness_proxy_open_url", pageLoadInfo));
        if (z) {
            if (i != -1) {
                String b2 = b(bundle);
                if (!a(bundle)) {
                    if (urlParams == null) {
                        return;
                    }
                    HashMap hashMap = new HashMap();
                    hashMap.put("url", str);
                    hashMap.put("entry", String.valueOf(urlParams.r));
                    hashMap.put("id", b2);
                    CMC.a("cmc://statistics/m?cmd=onStatEntryType", hashMap);
                }
            }
        } else if (!b(urlParams)) {
            a(str, str, (byte) 0);
        }
        PageFrame pageFrame2 = this.O;
        if (pageFrame2 != null) {
            w(pageFrame2.getCurrentWebView());
        }
        c(urlParams);
    }

    @Override
    public void a(PageInfo pageInfo) {
        new ShareBundle(pageInfo).a((IShare) QBContext.getInstance().getService(IShare.class));
    }

    @Override
    public void a(Object obj, final ValueCallback<Uri[]> valueCallback, String str, String str2, boolean z) {
        if (obj == null || !((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).hasRecordVoice(obj)) {
            X5FileUploader.a((Context) null, new ValueCallback<Uri[]>() {
                @Override
                public void onReceiveValue(Uri[] uriArr) {
                    ValueCallback valueCallback2 = valueCallback;
                    if (valueCallback2 != null) {
                        valueCallback2.onReceiveValue(uriArr);
                    }
                }
            }, str, str2, z);
        } else {
            final String currentRecordFileName = ((IJsapiManager) QBContext.getInstance().getService(IJsapiManager.class)).getCurrentRecordFileName(obj);
            BrowserExecutorSupplier.postForBackgroundTasks(new BrowserExecutorSupplier.BackgroundRunable() {
                @Override
                public void doRun() {
                    if (TextUtils.isEmpty(currentRecordFileName)) {
                        return;
                    }
                    valueCallback.onReceiveValue(new Uri[]{Uri.fromFile(new File(FileUtils.e().getAbsolutePath() + File.separator + currentRecordFileName))});
                }
            });
        }
    }

    @Override
    public void a(OutOfMemoryError outOfMemoryError) {
        ((IMemoryUsageStatService) QBContext.getInstance().getService(IMemoryUsageStatService.class)).handleOOMError(0);
    }

    void a(Runnable runnable, int i) {
        if (runnable == null) {
            return;
        }
        RoutineDaemon a2 = RoutineDaemon.a();
        if (a2 != null) {
            a2.a(runnable, i);
        } else {
            BrowserExecutorSupplier.getInstance().getCoreTaskExecutor().execute(runnable);
        }
    }

    @Override
    public void a(String str) {
        PageFrame pageFrame;
        if (TextUtils.isEmpty(str) || (pageFrame = this.O) == null) {
            return;
        }
        IWebView currentWebView = pageFrame.getCurrentWebView();
        String currentUrl = this.O.getCurrentUrl();
        if ((TextUtils.isEmpty(currentUrl) || TextUtils.isEmpty(str) || currentUrl.equalsIgnoreCase(str)) && currentWebView != null && (currentWebView instanceof QBWebviewWrapper)) {
            AddressBarDataSource addressBarDataSource = currentWebView.getAddressBarDataSource();
            SecurityManager.a().a(str, addressBarDataSource != null ? (SecurityLevel) addressBarDataSource.a(SecurityLevel.class) : null);
        }
    }

    @Override
    public void a(String str, int i) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        String currentUrl = this.O.getCurrentUrl();
        if (TextUtils.isEmpty(currentUrl) || TextUtils.isEmpty(str) || currentUrl.equalsIgnoreCase(str)) {
            WebBehivorInfo webBehivorInfo = new WebBehivorInfo();
            webBehivorInfo.f44602a = str;
            webBehivorInfo.f44603b = i;
            SecurityManager.a().a(webBehivorInfo);
        }
    }

    @Override
    public void a(String str, int i, String str2, String str3, String str4, String str5, String str6, String str7, int i2, int i3, String str8, String str9, long j) {
        this.u = str;
        this.F = i;
        this.v = str2;
        this.w = str3;
        this.x = str4;
        this.y = str5;
        this.z = str6;
        this.A = str7;
        this.B = i2;
        this.D = i3;
        this.G = str8;
        this.H = str9;
        this.E = j;
    }

    @Override
    public void a(String str, IWebView iWebView) {
        ClipboardManager.getInstance().saveDraftCache(str, m(iWebView));
    }

    @Override
    public void a(String str, String str2) {
        ((IExternalDispatchServer) QBContext.getInstance().getService(IExternalDispatchServer.class)).doUnknownScheme(str, str2, 0);
    }

    @Override
    public void a(String str, String str2, String str3, int i) {
    }

    @Override
    public void a(String str, boolean z, final long j, final String str2, int i) {
        if (z) {
            BrowserExecutorSupplier.forBackgroundTasks().execute(new Runnable() {
                @Override
                public void run() {
                    MetricsStatisticManager.b().a(Apn.getApnName(Apn.sApnType), j, str2, 0);
                }
            });
        }
    }

    @Override
    public void a(String str, byte[] bArr, String str2, String str3) {
        this.I = str;
        this.J = bArr;
        this.K = str2;
        this.L = str3;
    }

    protected void a(HashMap<String, String> hashMap, String str) {
        if (hashMap != null && FeatureToggle.a(com.tencent.library.BuildConfig.FEATURE_TOGGLE_UNITTIMESTART_WITH_KV_865376759)) {
            String a2 = WebSiteCacher.a().a(str);
            StringBuilder sb = new StringBuilder();
            sb.append("callfrom=");
            UrlParams urlParams = this.aj;
            sb.append(urlParams != null ? urlParams.f : 0);
            sb.append(";site_type=");
            sb.append(a2);
            hashMap.put("kv", sb.toString());
        }
    }

    @Override
    public void a(boolean z, boolean z2) {
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return;
        }
        IWebView currentWebView = pageFrame.getCurrentWebView();
        if (a(z, currentWebView)) {
            return;
        }
        if (j(z)) {
            if (f(q())) {
                this.T = null;
            }
            if (QBModuleDispather.b()) {
                StatManager.b().c("AATQB300");
                QBModuleDispather.a(false);
            }
            if (!this.O.internalBack(z, z2)) {
                return;
            }
        } else if (e() != -1) {
            if (WindowManager.a().f(e()) != null) {
                K();
                return;
            } else {
                a(-1);
                c(this.O.getCurrentWebView());
            }
        } else if (q() == 18) {
            WindowManager.a().c(d());
        } else if (this.Y != null) {
            k(z);
        }
        h();
        s(currentWebView);
        R();
        EventEmiter.getDefault().emit(new EventMessage("event_bussiness_proxy_back", currentWebView));
    }

    @Override
    public boolean a() {
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return false;
        }
        return pageFrame.canPrefetchForward();
    }

    @Override
    public boolean a(View view) {
        return (view instanceof IWebView) && ((IWebView) view).isPage(IWebView.TYPE.HOME);
    }

    @Override
    public boolean a(IWebView iWebView, String str, boolean z, boolean z2) {
        return a(iWebView, str, z, z2, (QBWebResourceRequest) null);
    }

    @Override
    public boolean a(IWebView iWebView, String str, boolean z, boolean z2, QBWebResourceRequest qBWebResourceRequest) {
        if (QBModuleDispather.b()) {
            StatManager.b().c("AATQB301");
            QBModuleDispather.a(false);
        }
        a(str, z);
        a(str, z, qBWebResourceRequest != null ? qBWebResourceRequest.c() : false);
        if (UrlUtils.isWebUrl(str) && (iWebView instanceof QBWebviewWrapper)) {
            WebPageStatHelper.getInstance().setCurPageUrl(iWebView.getQBWebView(), iWebView.getUrl());
            if (z) {
                WebPageStatHelper.getInstance().stat("web_0002", iWebView);
            }
        }
        boolean a2 = qBWebResourceRequest != null ? a(iWebView.getQBWebView(), iWebView.getUrl(), str, z, qBWebResourceRequest) : a(iWebView.getQBWebView(), iWebView.getUrl(), str, z);
        if (!a2) {
            i(z2);
        }
        this.ah.a(iWebView.getQBWebView(), str);
        return a2;
    }

    @Override
    public boolean a(final Runnable runnable) {
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).getAppEngineHandler().post(new Runnable() {
            @Override
            public void run() {
                if (QBBussinessProxy.this.p) {
                    return;
                }
                NewQBAlertDialogBuilder newQBAlertDialogBuilder = new NewQBAlertDialogBuilder();
                newQBAlertDialogBuilder.a(MttResources.l(R.string.ayp), 2);
                newQBAlertDialogBuilder.b(MttResources.l(R.string.ayq), 3);
                final QBAlertDialog a2 = newQBAlertDialogBuilder.a();
                a2.d(MttResources.l(R.string.ayr));
                a2.a(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        EventCollector.getInstance().onViewClickedBefore(view);
                        int id = view.getId();
                        if (id != 100) {
                            if (id == 101) {
                                runnable.run();
                            }
                            EventCollector.getInstance().onViewClicked(view);
                        }
                        ((IBootService) QBContext.getInstance().getService(IBootService.class)).setIsPnrRestart(true);
                        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doRestartApp();
                        a2.dismiss();
                        QBBussinessProxy.this.p = false;
                        EventCollector.getInstance().onViewClicked(view);
                    }
                });
                a2.show();
                QBBussinessProxy.this.p = true;
            }
        });
        return true;
    }

    @Override
    public boolean a(final String str, String str2, final JsResult jsResult) {
        NewQBAlertDialogBuilder newQBAlertDialogBuilder = new NewQBAlertDialogBuilder();
        newQBAlertDialogBuilder.a(MttResources.l(R.string.c11));
        newQBAlertDialogBuilder.a(MttResources.l(h.aH), 1);
        newQBAlertDialogBuilder.b(MttResources.l(R.string.ud), 3);
        final QBAlertDialog a2 = newQBAlertDialogBuilder.a();
        final MttCtrlInputNew b2 = a2.b(str2);
        a2.a(str, false);
        a2.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                jsResult.a();
            }
        });
        a2.a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                int id = view.getId();
                if (id != 100) {
                    if (id == 101) {
                        jsResult.a();
                    }
                    EventCollector.getInstance().onViewClicked(view);
                }
                jsResult.b();
                ((IBookMarkService) QBContext.getInstance().getService(IBookMarkService.class)).addBookmark2Folder(b2.getText(), str, Bookmark.ROOT_UUID, true);
                a2.dismiss();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        a2.setCancelable(false);
        a2.show();
        return true;
    }

    @Override
    public boolean a(String str, String[] strArr, ValueCallback<Boolean> valueCallback, boolean z) {
        ((INotify) QBContext.getInstance().getService(INotify.class)).postShowWebWindowBlockInfo(new WindowBlockTipInfo(strArr == null ? 1 : strArr.length, z, valueCallback));
        return true;
    }

    @Override
    public boolean a(boolean z) {
        return j(z);
    }

    @Override
    public int[] a(Object obj) {
        IHomePage iHomePage;
        int i;
        Object obj2;
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            IWebView feedsHomePage = pageFrame.getFeedsHomePage();
            if (feedsHomePage != null && feedsHomePage.isPage(IWebView.TYPE.HOME)) {
                boolean z = feedsHomePage instanceof IHomePage;
                obj2 = feedsHomePage;
            }
            KeyEvent.Callback webviewOffset = this.O.getWebviewOffset(-1);
            if ((webviewOffset instanceof IWebView) && ((IWebView) webviewOffset).isPage(IWebView.TYPE.HOME) && (webviewOffset instanceof IHome)) {
                IHome iHome = (IHome) webviewOffset;
                if (iHome.getCurrentPage() instanceof IHomePage) {
                    obj2 = iHome.getCurrentPage();
                    iHomePage = (IHomePage) obj2;
                    Bundle extra = ((obj instanceof NativePage) || (obj instanceof QBWebviewWrapper)) ? ((IWebView) obj).getExtra() : null;
                    i = extra != null ? extra.getInt(TangramHippyConstants.APPID) : -1;
                    if (iHomePage != null && i > 0) {
                        return a(iHomePage, i);
                    }
                }
            }
            iHomePage = null;
            if (obj instanceof NativePage) {
                if (extra != null) {
                }
                if (iHomePage != null) {
                    return a(iHomePage, i);
                }
            }
            if (extra != null) {
            }
            if (iHomePage != null) {
            }
        }
        return null;
    }

    @Override
    public void b(byte b2) {
        if (b2 == 3) {
            b(124);
        }
        SecurityManager.a().a(this);
        FontSizeManager.a().a(this);
    }

    @Override
    public void b(int i) {
        if (i < 0 || this.Q != -1) {
            return;
        }
        this.Q = i;
    }

    @Override
    public void b(QBWebView qBWebView) {
        if (((IMenuService) QBContext.getInstance().getService(IMenuService.class)).hasInstance() && ((IMenuService) QBContext.getInstance().getService(IMenuService.class)).hasChangedNightMode()) {
            qBWebView.invalidateContent();
        }
    }

    @Override
    public void b(QBWebView qBWebView, int i, String str, String str2) {
        p(str2);
        c(qBWebView, str2);
    }

    void b(final SecurityLevel securityLevel) {
        if (this.O != null && StringUtils.a(securityLevel.url, this.O.getCurrentUrl())) {
            IWebView currentWebView = this.O.getCurrentWebView();
            if (currentWebView == null) {
                Logs.e("QBBussinessProxy", "informSecurityLevel: can't find current webview");
                return;
            }
            final QBWebView qBWebView = currentWebView.getQBWebView();
            if (qBWebView != null) {
                BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                    @Override
                    public void run() {
                        IQQBrowserSettings qQBrowserSettings = qBWebView.getQQBrowserSettings();
                        if (qQBrowserSettings == null) {
                            Logs.e("QBBussinessProxy", "informSecurityLevel: can't get IX5QQBrowserSettings");
                            return;
                        }
                        Logs.d("QBBussinessProxy", "informSecurityLevel: setSecurityLevel: " + securityLevel.level + com.xiaomi.mipush.sdk.Constants.ACCEPT_TIME_SEPARATOR_SP + securityLevel.eviltype);
                        qQBrowserSettings.a(securityLevel.level, securityLevel.eviltype);
                    }
                });
            } else {
                Logs.e("QBBussinessProxy", "informSecurityLevel: can't get QBWebView");
            }
        }
    }

    @Override
    public void b(IWebView iWebView) {
        if (TextUtils.isEmpty(this.U) || iWebView == null) {
            return;
        }
        String pageTitle = iWebView.getPageTitle();
        if (TextUtils.isEmpty(pageTitle)) {
            pageTitle = BrowserWindow.f46261a;
        }
        if (!this.V) {
            ISearchService iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class);
            String generalHistoryTitle = iSearchService != null ? iSearchService.getGeneralHistoryTitle() : "";
            if (!StringUtils.b(pageTitle) && !pageTitle.equals(generalHistoryTitle)) {
                r(iWebView);
            }
        }
        h();
    }

    @Override
    public void b(IWebView iWebView, int i) {
        iWebView.getAddressBarDataSource().a(i);
    }

    @Override
    public void b(IWebView iWebView, IWebView iWebView2) {
        int q;
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return;
        }
        IWebView currentWebView = pageFrame.getCurrentWebView();
        P();
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.onBackForwardAnimationFinished(currentWebView != null ? currentWebView.getUrl() : "");
        }
        AddressBarController.a().c(4);
        if (this.ad.getParent() instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) this.ad.getParent();
            viewGroup.removeView(this.ad);
            viewGroup.setClipToPadding(true);
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.ad.getLayoutParams();
            layoutParams.topMargin = 0;
            this.ad.setLayoutParams(layoutParams);
            this.ad.setTranslationY(0.0f);
        }
        if (iWebView instanceof QBWebviewWrapper) {
            ((QBWebviewWrapper) iWebView).a((BitmapDrawable) null);
        }
        if (iWebView2 instanceof QBWebviewWrapper) {
            ((QBWebviewWrapper) iWebView2).a((BitmapDrawable) null);
        }
        if (p(iWebView2) && (q = q(iWebView)) > 0) {
            iWebView2.loadUrl("qb://homepage/quickguide?openapp=0&appid=" + q);
        }
        if (iWebView2 != null) {
            ((IWebPageService) QBContext.getInstance().getService(IWebPageService.class)).onForwardChanged(iWebView2.getUrl());
        }
    }

    @Override
    public void b(IWebView iWebView, String str) {
        a(iWebView, TraceEvent.TraceAction.WEB_ON_PAGE_COMMIT_VISIBLE, str);
    }

    @Override
    public void b(IWebView iWebView, final String str, boolean z) {
        a(iWebView, TraceEvent.TraceAction.WEB_ON_PAGE_FINISH, str);
        a(iWebView, TraceEvent.TraceAction.LAUNCH_FINISH, str);
        c(str, iWebView != null ? iWebView.getPageTitle() : "");
        if (z && !PublicSettingManager.a().e() && n(str)) {
            final String pageTitle = iWebView.getPageTitle();
            RoutineDaemon.a().a(new Runnable() {
                @Override
                public void run() {
                    ((IHistory) SDKContext.getInstance().getService(IHistory.class)).addHistory(pageTitle, str);
                }
            });
        }
        l(str);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).handleMttMessage(233, 0, 0, null, 0L);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).handleMttMessage(251, 0, 0, null, DateUtils.TEN_SECOND);
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        a(iWebView, addressBarDataSource);
        O();
        a(this.e);
        N();
        Q();
        f(iWebView, str);
        if (addressBarDataSource != null) {
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource, true);
        }
        if (((IMenuService) QBContext.getInstance().getService(IMenuService.class)).isShowing()) {
            ((IMenuService) QBContext.getInstance().getService(IMenuService.class)).updateStatus(iWebView);
        }
        IPageToolBoxService iPageToolBoxService = (IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class);
        if (iPageToolBoxService != null) {
            iPageToolBoxService.notifyOfflinePageSaved(this.aj);
        }
        QBWebviewJSInjector.a().a(iWebView, str);
        ((IWebPageService) QBContext.getInstance().getService(IWebPageService.class)).onPageFinished(iWebView, str);
        if (iWebView instanceof QBWebviewWrapper) {
            P();
            INovelPriateService iNovelPriateService = this.X;
            if (iNovelPriateService != null) {
                iNovelPriateService.onPageFinished(iWebView, str);
            }
        }
        d(iWebView, str, z);
    }

    @Override
    public void b(String str) {
        if (((IBoot) SDKContext.getInstance().getService(IBoot.class)).getShutSource() != 2 && str != null) {
            ClipboardManager.getInstance().clearDraftCache(str);
        }
        Handler handler = this.f47066d;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
        SecurityManager.a().b(this);
        FontSizeManager.a().b(this);
        e(true);
        this.X = null;
        this.O = null;
        w(null);
        SearchZhidaReport searchZhidaReport = this.l;
        if (searchZhidaReport != null) {
            searchZhidaReport.a();
            this.l = null;
        }
    }

    @Override
    public boolean b() {
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return false;
        }
        return pageFrame.canGoForward();
    }

    @Override
    public boolean b(int i, String str) {
        switch (i) {
            case 1:
                return !TextUtils.isEmpty(str) && ((IHistory) SDKContext.getInstance().getService(IHistory.class)).isValidAddHistory(str);
            case 2:
            case 3:
            case 5:
            case 7:
            case 8:
            case 9:
            case 11:
                return true;
            case 4:
                int e = FullScreenManager.a().e(null);
                return (e & 2) == 0 && (e & 8) == 0;
            case 6:
                IVideoService iVideoService = (IVideoService) QBContext.getInstance().getService(IVideoService.class);
                return iVideoService == null || !iVideoService.isVideoInFullScreen();
            case 10:
            default:
                return true;
            case 12:
                return true;
            case 13:
                return false;
        }
    }

    @Override
    public boolean b(boolean z) {
        if (j(z) || e() != -1) {
            return true;
        }
        BackStragety backStragety = this.Y;
        if (backStragety == null) {
            return false;
        }
        if (z && backStragety.a()) {
            return true;
        }
        return !z && this.Y.b();
    }

    @Override
    public void c() {
    }

    @Override
    public void c(int i) {
        this.R = i;
        if (i < 0 || this.R != -1) {
            return;
        }
        this.R = i;
        this.S = this.R;
    }

    @Override
    public void c(IWebView iWebView) {
        AddressBarDataSource addressBarDataSource;
        PageFrame pageFrame;
        if (iWebView == null && (pageFrame = this.O) != null) {
            iWebView = pageFrame.getCurrentWebView();
        }
        if (iWebView == null || (addressBarDataSource = iWebView.getAddressBarDataSource()) == null) {
            return;
        }
        String url = iWebView.getUrl();
        SecurityLevel a2 = SecurityManager.a().a(url, SafetyPerceptionConsts.e);
        String pageTitle = iWebView.getPageTitle();
        if (TextUtils.isEmpty(pageTitle)) {
            pageTitle = TextUtils.isEmpty(addressBarDataSource.f35820a) ? url : addressBarDataSource.f35820a;
        }
        if (a2 != null && a2.a()) {
            pageTitle = url;
        }
        addressBarDataSource.f35820a = pageTitle;
        addressBarDataSource.f35821b = url;
        addressBarDataSource.a(SecurityLevel.class, a2);
        this.ae.a(addressBarDataSource);
        AddressBarController.a().a(addressBarDataSource);
    }

    @Override
    public void c(IWebView iWebView, int i) {
        this.at = this.aw + StringUtils.b(i, g(i));
        this.au = System.currentTimeMillis();
        this.t = true;
        this.av = this.ax;
        a(iWebView, true);
        b(iWebView, true);
        a(iWebView, 0, true);
        a(iWebView, iWebView.getUrl(), i);
    }

    @Override
    public void c(IWebView iWebView, IWebView iWebView2) {
        if (AddressBarController.a().a(iWebView2, iWebView2 == null ? null : iWebView2.getUrl(), iWebView2 == null ? false : iWebView2.isPage(IWebView.TYPE.HTML))) {
            AddressBarController.a().a(false, 2);
        }
    }

    public void c(IWebView iWebView, String str) {
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        if (addressBarDataSource == null || addressBarDataSource.e == null || addressBarDataSource.e.e() != 0) {
            return;
        }
        addressBarDataSource.e.a((byte) 1);
    }

    @Override
    public void c(IWebView iWebView, String str, boolean z) {
        UnkownSchemeUtil.a(iWebView, str, z);
    }

    @Override
    public void c(String str) {
        this.aa = str;
    }

    @Override
    public void c(boolean z) {
        a(z, true);
    }

    @Override
    public int d() {
        return this.f47062a;
    }

    @Override
    public void d(int i) {
        boolean z;
        ISplashManager iSplashManager = (ISplashManager) QBContext.getInstance().getService(ISplashManager.class);
        if (iSplashManager != null) {
            boolean checkSplashViewStatus = iSplashManager.checkSplashViewStatus(4);
            boolean checkSplashViewStatus2 = iSplashManager.checkSplashViewStatus(2);
            boolean checkSplashViewStatus3 = iSplashManager.checkSplashViewStatus(1);
            EventLog.a("框架转屏", "setLockScreen splashShowing:" + checkSplashViewStatus + " ,splashDialogShowing:" + checkSplashViewStatus2 + " ,splashAttatched:" + checkSplashViewStatus3);
            z = checkSplashViewStatus3 | checkSplashViewStatus | checkSplashViewStatus2;
        } else {
            z = false;
        }
        if (!z || i == 3) {
            RotateScreenManager.a().a(ActivityHandler.b().n(), i, 2);
        } else {
            EventLog.a("框架转屏", "setLockScreen return cause splash is showing!");
        }
    }

    @Override
    public void d(IWebView iWebView) {
        AddressBarDataSource addressBarDataSource = iWebView.getAddressBarDataSource();
        if (addressBarDataSource != null && addressBarDataSource.b()) {
            addressBarDataSource.e.a((byte) 1);
            this.ae.a(addressBarDataSource);
            AddressBarController.a().a(addressBarDataSource);
        }
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            pageFrame.setPageState((byte) 0);
        }
    }

    @Override
    public void d(IWebView iWebView, IWebView iWebView2) {
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        if (currentBarDataSource != null) {
            if (iWebView != iWebView2) {
                currentBarDataSource.d();
            } else if ((iWebView instanceof QBWebviewWrapper) && iWebView2 == iWebView) {
                currentBarDataSource.a(false);
            }
            c(iWebView2);
        }
    }

    @Override
    public void d(String str) {
        this.P = str;
    }

    @Override
    public void d(boolean z) {
        h();
        PageFrame pageFrame = this.O;
        if (pageFrame == null || !(pageFrame.getCurrentWebView() instanceof QBWebviewWrapper)) {
            return;
        }
        ((INotify) QBContext.getInstance().getService(INotify.class)).closeBubble(IMessageBubbleService.MESSAGE_MODE_SHOW_TRANSLATE);
    }

    @Override
    public int e() {
        return this.f47064b;
    }

    @Override
    public void e(int i) {
        boolean z;
        ISplashManager iSplashManager = (ISplashManager) QBContext.getInstance().getService(ISplashManager.class);
        if (iSplashManager != null) {
            boolean checkSplashViewStatus = iSplashManager.checkSplashViewStatus(4);
            boolean checkSplashViewStatus2 = iSplashManager.checkSplashViewStatus(2);
            boolean checkSplashViewStatus3 = iSplashManager.checkSplashViewStatus(1);
            EventLog.a("框架转屏", "cancelLockScreen splashShowing:" + checkSplashViewStatus + " ,splashDialogShowing:" + checkSplashViewStatus2 + " ,splashAttatched:" + checkSplashViewStatus3);
            z = checkSplashViewStatus3 | checkSplashViewStatus | checkSplashViewStatus2;
        } else {
            z = false;
        }
        if (z) {
            EventLog.a("框架转屏", "setLockScreen return cause splash is showing!");
        } else {
            RotateScreenManager.a().b(ActivityHandler.b().n(), i, 2);
        }
    }

    @Override
    public void e(IWebView iWebView) {
        String url;
        if (iWebView == null || (url = iWebView.getUrl()) == null) {
            return;
        }
        if (!url.startsWith("qb://")) {
            v();
            return;
        }
        w();
        if (url.startsWith("qb://home")) {
            p();
        }
    }

    @Override
    public void e(boolean z) {
        BackStragety backStragety = this.Y;
        if (backStragety != null && this.O != null && backStragety.a(d(), z, this.O)) {
            this.Y = null;
        }
        QbActivityBase n = ActivityHandler.b().n();
        if (n == null || (n.getCurFragment() instanceof BrowserFragment)) {
            return;
        }
        h = true;
    }

    @Override
    public boolean e(String str) {
        SecurityLevel a2;
        IWebView feedsHomePage;
        if (TextUtils.isEmpty(str) || (a2 = SecurityManager.a().a(str, SafetyPerceptionConsts.f72315d)) == null || a2.level != 1 || !SecurityManager.a().a(UrlUtils.getHost(str)) || this.O == null) {
            return false;
        }
        if (!WebEngine.e().o() && (feedsHomePage = this.O.getFeedsHomePage()) != null && feedsHomePage.isPage(IWebView.TYPE.HOME)) {
            return false;
        }
        o(str);
        return true;
    }

    @Override
    public int f(boolean z) {
        if (!z) {
            return this.R;
        }
        int i = this.R;
        return i == -1 ? this.S : i;
    }

    @Override
    public void f() {
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.dismissExploreInfo();
        }
    }

    @Override
    public void f(IWebView iWebView) {
        if (iWebView == null) {
            return;
        }
        String url = iWebView.getUrl();
        if (TextUtils.isEmpty(url) || QBUrlUtils.w(url) || !TextUtils.isEmpty(this.ao) || this.an.size() != 0) {
            a(url, true);
            return;
        }
        j(url);
        this.ao = url;
        a(url, false, false);
    }

    @Override
    public void f(String str) {
        SecurityManager.a().a(str, (String) null, (SecurityResourceUrlInfo) null);
    }

    @Override
    public void g() {
        P();
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.switchSkin();
        }
    }

    @Override
    public void g(IWebView iWebView) {
        if (iWebView.getQBWebView() != null) {
            iWebView.getAddressBarDataSource().f35822c = iWebView.getQBWebView().getScrollY();
        }
    }

    @Override
    public void g(String str) {
        PublicSettingManager a2 = PublicSettingManager.a();
        if (a2 == null || !a2.getBoolean("key_is_direct_url_report_enabled", true)) {
            return;
        }
        ((IServiceManager) QBContext.getInstance().getService(IServiceManager.class)).reportDirectUrl(str);
    }

    @Override
    public void g(boolean z) {
        IWebView currentWebView;
        QBWebView qBWebView;
        PageFrame pageFrame = this.O;
        if (pageFrame == null || (currentWebView = pageFrame.getCurrentWebView()) == null || (qBWebView = currentWebView.getQBWebView()) == null) {
            return;
        }
        AddressBarDataSource addressBarDataSource = currentWebView.getAddressBarDataSource();
        int i = addressBarDataSource == null ? 0 : addressBarDataSource.i();
        qBWebView.getScrollY();
        if (i > 0 && z) {
            this.ak = true;
        }
        if (!z && this.ak) {
            this.ak = false;
        }
        this.O.onSetWebViewStateByMultiWindow(z);
    }

    @Override
    public AddressBarDataSource getCurrentBarDataSource() {
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            IWebView currentWebView = pageFrame.getCurrentWebView();
            if (currentWebView != null && !currentWebView.isHomePage() && (currentWebView instanceof NativePage)) {
                this.ac = null;
            }
            AddressBarDataSource addressBarDataSource = this.ac;
            if (addressBarDataSource != null) {
                return addressBarDataSource;
            }
            if (currentWebView != null) {
                return currentWebView.getAddressBarDataSource();
            }
        }
        return null;
    }

    @Override
    public String h(String str) {
        return UrlDispatcher.b(str);
    }

    @Override
    public void h() {
        this.U = null;
    }

    @Override
    public void h(IWebView iWebView) {
        if (iWebView == null) {
            return;
        }
        f(true);
    }

    @Override
    public boolean h(boolean z) {
        return !((IBootService) QBContext.getInstance().getService(IBootService.class)).isHighEnd() || (z && !WebEngine.e().g());
    }

    @Override
    public void i() {
        PageFrame pageFrame = this.O;
        Activity activity = (pageFrame == null || !(pageFrame.getContext() instanceof Activity)) ? null : (Activity) this.O.getContext();
        if (activity != null) {
            ActivityHandler.h(activity);
        }
        e(true);
    }

    @Override
    public void i(IWebView iWebView) {
        if (iWebView == null || iWebView.isHomePage()) {
            return;
        }
        String a2 = UnitTimeDefines.a(iWebView.getUrl());
        IUnitTimeHelper unitTimeHelper = iWebView instanceof NativePage ? ((NativePage) iWebView).getUnitTimeHelper() : UnitTimeHelperFactory.a();
        unitTimeHelper.g(iWebView.getUrl());
        unitTimeHelper.a(a2);
        unitTimeHelper.h(iWebView.getPageTitle());
        int r2 = r();
        String url = iWebView.getUrl();
        if (!TextUtils.isEmpty(url)) {
            m(url);
            if (url.length() > 300) {
                url = url.substring(0, 300);
            }
        }
        Logs.a("QBBusinessProxy_URL=", (Object) url);
        HashMap<String, String> hashMap = this.ai;
        if (hashMap != null) {
            unitTimeHelper.a(hashMap);
        }
        StatManager.b().a(unitTimeHelper, r2);
        this.ai = null;
    }

    void i(boolean z) {
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        if (currentBarDataSource == null || currentBarDataSource.e == null || !z) {
            return;
        }
        AddressBarDataSource addressBarDataSource = this.ac;
        if (addressBarDataSource != null) {
            currentBarDataSource.e = addressBarDataSource.e;
        }
        if (currentBarDataSource.e.e() != -1) {
            currentBarDataSource.e.a((byte) 0);
        }
    }

    @Override
    public boolean i(String str) {
        if (v(str)) {
            String host = UrlUtils.getHost(str);
            if (!TextUtils.isEmpty(host) && u(UrlUtils.getUrlParamValue(str, "addressbar"))) {
                if (S()) {
                    this.i = DomainListDataManager.a().a(244);
                }
                if (!S()) {
                    int indexOf = str.indexOf("://");
                    if (indexOf >= 0) {
                        str = str.substring(indexOf + 3, str.length());
                    }
                    if (!TextUtils.isEmpty(str)) {
                        for (String str2 : this.i) {
                            if (!TextUtils.isEmpty(str2)) {
                                if (str2.startsWith("*.")) {
                                    String substring = str2.substring(1);
                                    if (!TextUtils.isEmpty(substring) && host.endsWith(substring)) {
                                        return false;
                                    }
                                }
                                if (str.startsWith(str2)) {
                                    return false;
                                }
                            }
                        }
                    }
                }
            }
        }
        return true;
    }

    @Override
    public void j() {
        d(true);
    }

    public void j(String str) {
        if (TextUtils.isEmpty(str) || QBUrlUtils.w(str)) {
            return;
        }
        int r2 = r();
        String q = QBUrlUtils.q(str);
        IUnitTimeHelper iUnitTimeHelper = this.an.get(str);
        if (iUnitTimeHelper == null) {
            iUnitTimeHelper = this.an.get(UrlUtils.decode(str));
        }
        if (iUnitTimeHelper == null) {
            iUnitTimeHelper = UnitTimeHelperFactory.a();
            this.an.put(str, iUnitTimeHelper);
            iUnitTimeHelper.a("browser");
            iUnitTimeHelper.a(k(str));
            iUnitTimeHelper.g(str);
        }
        long currentTimeMillis = System.currentTimeMillis();
        a(str, currentTimeMillis);
        m(str);
        HashMap<String, String> hashMap = this.ai;
        if (hashMap != null) {
            hashMap.put("scene", q);
            a(this.ai, str);
            iUnitTimeHelper.a(this.ai);
        } else {
            iUnitTimeHelper.b(q);
            HashMap<String, String> hashMap2 = new HashMap<>();
            a(hashMap2, str);
            iUnitTimeHelper.a(hashMap2);
        }
        StatManager.b().a(iUnitTimeHelper, r2);
        Map<String, String> i = iUnitTimeHelper.i();
        if (i != null) {
            i.put("kv", StringUtils.i(i.get("kv")) + ";performance_key=" + currentTimeMillis);
        }
        this.ai = null;
    }

    @Override
    public boolean j(IWebView iWebView) {
        return iWebView.isPage(IWebView.TYPE.NATIVE) || iWebView.isPage(IWebView.TYPE.HOME);
    }

    @Override
    public void k() {
        h();
        AddressBarDataSource addressBarDataSource = this.ac;
        if (addressBarDataSource != null) {
            addressBarDataSource.e.a((byte) 1);
            this.ac = null;
        }
        AddressBarDataSource currentBarDataSource = getCurrentBarDataSource();
        if (currentBarDataSource != null) {
            this.ae.a(currentBarDataSource);
            AddressBarController.a().a(currentBarDataSource);
        }
        QbActivityBase n = ActivityHandler.b().n();
        if (n == null || (n.getCurFragment() instanceof BrowserFragment)) {
            return;
        }
        h = true;
    }

    @Override
    public void k(IWebView iWebView) {
        SecurityManager.a().e();
    }

    @Override
    public BackStragety l() {
        return this.Y;
    }

    @Override
    public void m() {
        this.Y = null;
    }

    @Override
    public String n() {
        return this.aa;
    }

    @Override
    public String o() {
        return this.P;
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "com.tencent.mtt.browser.security.facade.ISecurityManager.onSafetyDownloadSheetShow")
    public void onDownloadSheetShow(EventMessage eventMessage) {
        PageFrame pageFrame = this.O;
        IWebView currentWebView = pageFrame == null ? null : pageFrame.getCurrentWebView();
        String url = currentWebView == null ? "" : currentWebView.getUrl();
        if (currentWebView == null || !(currentWebView instanceof QBWebviewWrapper) || TextUtils.isEmpty(url) || !url.startsWith("https://res.imtt.qq.com/qbsecurity/qbsecurity_")) {
            return;
        }
        GlobalDialogManager.a().b();
    }

    @Override
    public void onFontSizeChanged(boolean z, int i, int i2) {
        PageFrame pageFrame = this.O;
        if (pageFrame != null) {
            pageFrame.onFontSizeChanged(z, i, i2);
        }
    }

    @Override
    public void p() {
        this.S = this.R;
        this.R = -1;
    }

    @Override
    public int q() {
        return this.Q;
    }

    @Override
    public int r() {
        return f(false);
    }

    @Override
    public void s() {
        PageFrame pageFrame;
        if (WebStatUnitHelper.a() && (pageFrame = this.O) != null) {
            IWebView currentWebView = pageFrame.getCurrentWebView();
            j(currentWebView == null ? "" : currentWebView.getUrl());
        }
        this.f = false;
        EventEmiter.getDefault().emit(new EventMessage("event_bussiness_proxy_on_start", Boolean.valueOf(h)));
        h = false;
    }

    @Override
    public boolean t() {
        VideoProxyDefault curVideoProxy;
        PageFrame pageFrame = this.O;
        if (pageFrame == null || (curVideoProxy = pageFrame.getCurVideoProxy()) == null) {
            return false;
        }
        return curVideoProxy.getScreenMode() == 102 || curVideoProxy.isVideoPlaying();
    }

    @Override
    public void u() {
        PageFrame pageFrame = this.O;
        IWebView currentWebView = pageFrame == null ? null : pageFrame.getCurrentWebView();
        w(currentWebView);
        P();
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.onPageDeactive(currentWebView != null ? currentWebView.getUrl() : null);
        }
        String url = currentWebView == null ? "" : currentWebView.getUrl();
        if (currentWebView == null || !(currentWebView instanceof QBWebviewWrapper) || QBUrlUtils.D(url) || QBUrlUtils.w(url)) {
            return;
        }
        EventEmiter.getDefault().unregister("com.tencent.mtt.browser.security.facade.ISecurityManager.onSafetyDownloadSheetShow", this);
    }

    @Override
    public void v() {
        INovelPriateService iNovelPriateService;
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return;
        }
        IWebView currentWebView = pageFrame.getCurrentWebView();
        l(currentWebView);
        String url = currentWebView == null ? "" : currentWebView.getUrl();
        this.ao = url;
        this.ap = url;
        if (!WebStatUnitHelper.a() || WebStatUnitHelper.a(this.O)) {
            j(url);
        }
        P();
        if (pageFrame.isActive() && (iNovelPriateService = this.X) != null) {
            iNovelPriateService.onPageActive(url);
        }
        if (currentWebView == null || !(currentWebView instanceof QBWebviewWrapper)) {
            return;
        }
        EventEmiter.getDefault().register("com.tencent.mtt.browser.security.facade.ISecurityManager.onSafetyDownloadSheetShow", this);
    }

    @Override
    public void w() {
        PageFrame pageFrame = this.O;
        if (pageFrame == null) {
            return;
        }
        r();
        IWebView currentWebView = pageFrame.getCurrentWebView();
        String url = currentWebView == null ? null : currentWebView.getUrl();
        P();
        INovelPriateService iNovelPriateService = this.X;
        if (iNovelPriateService != null) {
            iNovelPriateService.onPageDeactive(url);
        }
    }

    @Override
    public void x() {
        IWebView currentWebView;
        IPageToolBoxService iPageToolBoxService;
        PageFrame pageFrame = this.O;
        if (pageFrame == null || (currentWebView = pageFrame.getCurrentWebView()) == null || (iPageToolBoxService = (IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class)) == null) {
            return;
        }
        iPageToolBoxService.saveOffLineWebPage(currentWebView.getPageTitle(), currentWebView.getQBWebView());
    }

    @Override
    public void y() {
        MttToaster.show("当前页面不支持缩放", 1);
    }

    @Override
    public void z() {
        MttToaster.show("已记住当页比例,双击屏幕可复原", 1);
    }
}