<commit_before>// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.core;

import android.graphics.Bitmap;
import android.graphics.Picture;
import android.net.http.SslCertificate;
import android.net.http.SslError;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.ValueCallback;
import android.webkit.WebResourceResponse;

import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.base.ThreadUtils;
import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
import org.chromium.components.navigation_interception.NavigationParams;
import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentViewDownloadDelegate;

// Help bridge callback in XWalkContentsClient to XWalkViewClient and
// WebChromeClient; Also handle the JNI conmmunication logic.
@JNINamespace("xwalk")
public class XWalkContentsClientBridge extends XWalkContentsClient
        implements ContentViewDownloadDelegate {

    private XWalkView mXWalkView;
    private XWalkClient mXWalkClient;
    private XWalkWebChromeClient mXWalkWebChromeClient;
    private Bitmap mFavicon;
    private DownloadListener mDownloadListener;
    private InterceptNavigationDelegate mInterceptNavigationDelegate;
    private XWalkNavigationHandler mNavigationHandler;

    // The native peer of the object
    private int mNativeContentsClientBridge;

    private class InterceptNavigationDelegateImpl implements InterceptNavigationDelegate {
        private XWalkContentsClient mContentsClient;

        public InterceptNavigationDelegateImpl(XWalkContentsClient client) {
            mContentsClient = client;
        }

        public boolean shouldIgnoreNavigation(NavigationParams navigationParams) {
            final String url = navigationParams.url;
            boolean ignoreNavigation = false;

            if (mNavigationHandler != null) {
                ignoreNavigation = mNavigationHandler.handleNavigation(navigationParams);
            }
            if (!ignoreNavigation) ignoreNavigation = shouldOverrideUrlLoading(url);

            if (!ignoreNavigation) {
                // Post a message to UI thread to notify the page is starting to load.<commit_msg>[Android] Check webview legacy api for external protocol handling first<commit_after>// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.core;

import android.graphics.Bitmap;
import android.graphics.Picture;
import android.net.http.SslCertificate;
import android.net.http.SslError;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.ValueCallback;
import android.webkit.WebResourceResponse;

import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.base.ThreadUtils;
import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
import org.chromium.components.navigation_interception.NavigationParams;
import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentViewDownloadDelegate;

// Help bridge callback in XWalkContentsClient to XWalkViewClient and
// WebChromeClient; Also handle the JNI conmmunication logic.
@JNINamespace("xwalk")
public class XWalkContentsClientBridge extends XWalkContentsClient
        implements ContentViewDownloadDelegate {

    private XWalkView mXWalkView;
    private XWalkClient mXWalkClient;
    private XWalkWebChromeClient mXWalkWebChromeClient;
    private Bitmap mFavicon;
    private DownloadListener mDownloadListener;
    private InterceptNavigationDelegate mInterceptNavigationDelegate;
    private XWalkNavigationHandler mNavigationHandler;

    // The native peer of the object
    private int mNativeContentsClientBridge;

    private class InterceptNavigationDelegateImpl implements InterceptNavigationDelegate {
        private XWalkContentsClient mContentsClient;

        public InterceptNavigationDelegateImpl(XWalkContentsClient client) {
            mContentsClient = client;
        }

        public boolean shouldIgnoreNavigation(NavigationParams navigationParams) {
            final String url = navigationParams.url;
            boolean ignoreNavigation = shouldOverrideUrlLoading(url) ||
                     (mNavigationHandler != null &&
                      mNavigationHandler.handleNavigation(navigationParams));

            if (!ignoreNavigation) {
                // Post a message to UI thread to notify the page is starting to load.
{'fraction_non_alphanumeric': 0.060063016935801496, 'fraction_numerical': 0.0031508467900748325, 'mean_word_length': 4.323899371069182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1794008', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1213, 'n_words': 356}