Search in sources :

Example 6 with ContentViewCore

use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.

the class LocationSettings method canSitesRequestLocationPermission.

@CalledByNative
private static boolean canSitesRequestLocationPermission(WebContents webContents) {
    ContentViewCore cvc = ContentViewCore.fromWebContents(webContents);
    if (cvc == null)
        return false;
    WindowAndroid windowAndroid = cvc.getWindowAndroid();
    if (windowAndroid == null)
        return false;
    LocationUtils locationUtils = LocationUtils.getInstance();
    if (!locationUtils.isSystemLocationSettingEnabled())
        return false;
    return locationUtils.hasAndroidLocationPermission() || windowAndroid.canRequestPermission(Manifest.permission.ACCESS_FINE_LOCATION);
}
Also used : LocationUtils(org.chromium.components.location.LocationUtils) ContentViewCore(org.chromium.content.browser.ContentViewCore) WindowAndroid(org.chromium.ui.base.WindowAndroid) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 7 with ContentViewCore

use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.

the class ChromeFullscreenManager method updateContentViewChildrenState.

@Override
public void updateContentViewChildrenState() {
    ContentViewCore contentViewCore = getActiveContentViewCore();
    if (contentViewCore == null)
        return;
    ViewGroup view = contentViewCore.getContainerView();
    float topViewsTranslation = (getControlOffset() + mControlContainerHeight);
    applyTranslationToTopChildViews(view, topViewsTranslation);
    applyMarginToFullChildViews(view, topViewsTranslation);
    updateContentViewViewportSize(contentViewCore);
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore) ViewGroup(android.view.ViewGroup)

Example 8 with ContentViewCore

use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.

the class Tab method swapWebContents.

/** This is currently called when committing a pre-rendered page. */
@VisibleForTesting
@CalledByNative
public void swapWebContents(WebContents webContents, boolean didStartLoad, boolean didFinishLoad) {
    ContentViewCore cvc = new ContentViewCore(mThemedApplicationContext, PRODUCT_VERSION);
    ContentView cv = ContentView.createContentView(mThemedApplicationContext, cvc);
    cv.setContentDescription(mThemedApplicationContext.getResources().getString(R.string.accessibility_content_view));
    cvc.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, webContents, getWindowAndroid());
    swapContentViewCore(cvc, false, didStartLoad, didFinishLoad);
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore) ContentView(org.chromium.content.browser.ContentView) VisibleForTesting(org.chromium.base.VisibleForTesting) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 9 with ContentViewCore

use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.

the class Tab method updateAccessibilityVisibility.

/**
     * Update whether or not the current native tab and/or web contents are
     * currently visible (from an accessibility perspective), or whether
     * they're obscured by another view.
     */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility() ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }
    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility() || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore) ContentView(org.chromium.content.browser.ContentView) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 10 with ContentViewCore

use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.

the class ShareServiceImpl method activityFromWebContents.

@Nullable
private static Activity activityFromWebContents(@Nullable WebContents webContents) {
    if (webContents == null)
        return null;
    ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents);
    if (contentViewCore == null)
        return null;
    WindowAndroid window = contentViewCore.getWindowAndroid();
    if (window == null)
        return null;
    return window.getActivity().get();
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore) WindowAndroid(org.chromium.ui.base.WindowAndroid) Nullable(android.support.annotation.Nullable)

Aggregations

ContentViewCore (org.chromium.content.browser.ContentViewCore)32 View (android.view.View)5 Tab (org.chromium.chrome.browser.tab.Tab)4 WindowAndroid (org.chromium.ui.base.WindowAndroid)4 ViewGroup (android.view.ViewGroup)3 ContentView (org.chromium.content.browser.ContentView)3 Paint (android.graphics.Paint)2 FrameLayout (android.widget.FrameLayout)2 CalledByNative (org.chromium.base.annotations.CalledByNative)2 LayoutTab (org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)2 StackLayout (org.chromium.chrome.browser.compositor.layouts.phone.StackLayout)2 WebContents (org.chromium.content_public.browser.WebContents)2 SuppressLint (android.annotation.SuppressLint)1 Activity (android.app.Activity)1 Nullable (android.support.annotation.Nullable)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 MotionEvent (android.view.MotionEvent)1 SurfaceView (android.view.SurfaceView)1 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)1 LayoutParams (android.view.ViewGroup.LayoutParams)1