org.chromium.content.browser.ContentViewCore Java Examples

The following examples show how to use org.chromium.content.browser.ContentViewCore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReaderModeSceneLayer.java    From delion with Apache License 2.0 6 votes vote down vote up
private native void nativeUpdate(
long nativeReaderModeSceneLayer,
float dpToPx,
float basePageBrightness,
float basePageYOffset,
ContentViewCore contentViewCore,
float panelX,
float panelY,
float panelWidth,
float panelHeight,
float barMarginSide,
float barHeight,
float textOpacity,
boolean barBorderVisible,
float barBorderHeight,
boolean barShadowVisible,
float barShadowOpacity);
 
Example #2
Source File: AwContents.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView,
        InternalAccessDelegate internalDispatcher, int nativeWebContents,
        ContentViewCore.GestureStateListener pinchGestureStateListener,
        ContentViewClient contentViewClient,
        ContentViewCore.ZoomControlsDelegate zoomControlsDelegate) {
  Context context = containerView.getContext();
  ContentViewCore contentViewCore = new ContentViewCore(context);
  // Note INPUT_EVENTS_DELIVERED_IMMEDIATELY is passed to avoid triggering vsync in the
  // compositor, not because input events are delivered immediately.
  contentViewCore.initialize(containerView, internalDispatcher, nativeWebContents,
          context instanceof Activity ?
                  new ActivityWindowAndroid((Activity) context) : new WindowAndroid(context),
            ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY);
  contentViewCore.setGestureStateListener(pinchGestureStateListener);
  contentViewCore.setContentViewClient(contentViewClient);
  contentViewCore.setZoomControlsDelegate(zoomControlsDelegate);
  return contentViewCore;
}
 
Example #3
Source File: DateTimeChooserAndroid.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@CalledByNative
private static DateTimeChooserAndroid createDateTimeChooser(
        ContentViewCore contentViewCore,
        int nativeDateTimeChooserAndroid, int dialogType,
        int year, int month, int day,
        int hour, int minute, int second, int milli, int week,
        double min, double max, double step) {
    DateTimeChooserAndroid chooser =
            new DateTimeChooserAndroid(
                    contentViewCore.getContext(),
                    nativeDateTimeChooserAndroid);
    chooser.showDialog(
        dialogType, year, month, day, hour, minute, second, milli,
        week, min, max, step);
    return chooser;
}
 
Example #4
Source File: Tab.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #5
Source File: Tab.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #6
Source File: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Adjusts the physical backing size of a given ContentViewCore. This method will first check
 * if the ContentViewCore's client wants to override the size and, if so, it will use the
 * values provided by the {@link ContentViewClient#getDesiredWidthMeasureSpec()} and
 * {@link ContentViewClient#getDesiredHeightMeasureSpec()} methods. If no value is provided
 * in one of these methods, the values from the |width| and |height| arguments will be
 * used instead.
 *
 * @param contentViewCore The {@link ContentViewCore} to resize.
 * @param width The default width.
 * @param height The default height.
 */
private void adjustPhysicalBackingSize(ContentViewCore contentViewCore, int width, int height) {
    ContentViewClient client = contentViewCore.getContentViewClient();

    int desiredWidthMeasureSpec = client.getDesiredWidthMeasureSpec();
    if (MeasureSpec.getMode(desiredWidthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
        width = MeasureSpec.getSize(desiredWidthMeasureSpec);
    }

    int desiredHeightMeasureSpec = client.getDesiredHeightMeasureSpec();
    if (MeasureSpec.getMode(desiredHeightMeasureSpec) != MeasureSpec.UNSPECIFIED) {
        height = MeasureSpec.getSize(desiredHeightMeasureSpec);
    }

    contentViewCore.onPhysicalBackingSizeChanged(width, height);
}
 
Example #7
Source File: WebsiteSettingsPopup.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private WebsiteSettingsPopup(Context context, ContentViewCore contentViewCore,
        final int nativeWebsiteSettingsPopup) {
    mContext = context;
    mDialog = new Dialog(mContext);
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            assert nativeWebsiteSettingsPopup != 0;
            nativeDestroy(nativeWebsiteSettingsPopup);
        }
    });
    mContainer = new LinearLayout(mContext);
    mContainer.setOrientation(LinearLayout.VERTICAL);
    mContentViewCore = contentViewCore;
    mPadding = (int) context.getResources().getDimension(R.dimen.certificate_viewer_padding);
    mContainer.setPadding(mPadding, 0, mPadding, 0);
}
 
Example #8
Source File: TabBase.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void showRepostFormWarningDialog(final ContentViewCore contentViewCore) {
    RepostFormWarningDialog warningDialog = new RepostFormWarningDialog(
            new Runnable() {
                @Override
                public void run() {
                    contentViewCore.cancelPendingReload();
                }
            }, new Runnable() {
                @Override
                public void run() {
                    contentViewCore.continuePendingReload();
                }
            });
    Activity activity = (Activity)mContext;
    warningDialog.show(activity.getFragmentManager(), null);
}
 
Example #9
Source File: CompositorViewHolder.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Adjusts the physical backing size of a given ContentViewCore. This method will first check
 * if the ContentViewCore's client wants to override the size and, if so, it will use the
 * values provided by the {@link ContentViewClient#getDesiredWidthMeasureSpec()} and
 * {@link ContentViewClient#getDesiredHeightMeasureSpec()} methods. If no value is provided
 * in one of these methods, the values from the |width| and |height| arguments will be
 * used instead.
 *
 * @param contentViewCore The {@link ContentViewCore} to resize.
 * @param width The default width.
 * @param height The default height.
 */
private void adjustPhysicalBackingSize(ContentViewCore contentViewCore, int width, int height) {
    ContentViewClient client = contentViewCore.getContentViewClient();

    int desiredWidthMeasureSpec = client.getDesiredWidthMeasureSpec();
    if (MeasureSpec.getMode(desiredWidthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
        width = MeasureSpec.getSize(desiredWidthMeasureSpec);
    }

    int desiredHeightMeasureSpec = client.getDesiredHeightMeasureSpec();
    if (MeasureSpec.getMode(desiredHeightMeasureSpec) != MeasureSpec.UNSPECIFIED) {
        height = MeasureSpec.getSize(desiredHeightMeasureSpec);
    }

    contentViewCore.onPhysicalBackingSizeChanged(width, height);
}
 
Example #10
Source File: AwContents.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * @see ContentViewCore.evaluateJavaScript(String, ContentViewCore.JavaScriptCallback)
 */
public void evaluateJavaScript(String script, final ValueCallback<String> callback) {
    ContentViewCore.JavaScriptCallback jsCallback = null;
    if (callback != null) {
        jsCallback = new ContentViewCore.JavaScriptCallback() {
            @Override
            public void handleJavaScriptResult(String jsonResult) {
                callback.onReceiveValue(jsonResult);
            }
        };
    }

    mContentViewCore.evaluateJavaScript(script, jsCallback);
}
 
Example #11
Source File: PaymentRequestImpl.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Builds the PaymentRequest service implementation.
 *
 * @param webContents The web contents that have invoked the PaymentRequest API.
 */
public PaymentRequestImpl(WebContents webContents) {
    if (webContents == null) return;

    ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents);
    if (contentViewCore == null) return;

    WindowAndroid window = contentViewCore.getWindowAndroid();
    if (window == null) return;

    mContext = window.getActivity().get();
    if (mContext == null) return;

    mMerchantName = webContents.getTitle();
    // The feature is available only in secure context, so it's OK to not show HTTPS.
    mOrigin = UrlUtilities.formatUrlForSecurityDisplay(webContents.getVisibleUrl(), false);

    final FaviconHelper faviconHelper = new FaviconHelper();
    float scale = mContext.getResources().getDisplayMetrics().density;
    faviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(),
            webContents.getVisibleUrl(), (int) (FAVICON_SIZE_DP * scale + 0.5f),
            new FaviconHelper.FaviconImageCallback() {
                @Override
                public void onFaviconAvailable(Bitmap bitmap, String iconUrl) {
                    faviconHelper.destroy();
                    if (bitmap == null) return;
                    if (mUI == null) {
                        mFavicon = bitmap;
                        return;
                    }
                    mUI.setTitleBitmap(bitmap);
                }
            });

    mApps = PaymentAppFactory.create(webContents);
}
 
Example #12
Source File: DomDistillerUIUtils.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @param webContents The WebContents to get the Activity from.
 * @return The Activity associated with the WebContents.
 */
private static Activity getActivityFromWebContents(WebContents webContents) {
    if (webContents == null) return null;

    ContentViewCore contentView = ContentViewCore.fromWebContents(webContents);
    if (contentView == null) return null;

    WindowAndroid window = contentView.getWindowAndroid();
    if (window == null) return null;

    return window.getActivity().get();
}
 
Example #13
Source File: Tab.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a {@link ContentViewCore} to this {@link Tab} as an overlay object.
 * If attachLayer is set, the {@link ContentViewCore} will be attached to CC layer hierarchy.
 * This {@link ContentViewCore} will have all layout events propagated to it.
 * This {@link ContentViewCore} can be removed via
 * {@link #detachOverlayContentViewCore(ContentViewCore)}.
 * @param content The {@link ContentViewCore} to attach.
 * @param visible Whether or not to make the content visible.
 * @param attachLayer Whether or not to attach the content view to the CC layer hierarchy.
 */
public void attachOverlayContentViewCore(
        ContentViewCore content, boolean visible, boolean attachLayer) {
    if (content == null) return;

    assert !mOverlayContentViewCores.contains(content);
    mOverlayContentViewCores.add(content);
    if (attachLayer) nativeAttachOverlayContentViewCore(mNativeTabAndroid, content, visible);
    for (TabObserver observer : mObservers) {
        observer.onOverlayContentViewCoreAdded(this, content);
    }
}
 
Example #14
Source File: ContextualSearchSelectionController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Clears the selection.
 */
void clearSelection() {
    ContentViewCore baseContentView = getBaseContentView();
    if (baseContentView != null) {
        baseContentView.clearSelection();
    }
    resetAllStates();
}
 
Example #15
Source File: LayoutManagerDocumentTabSwitcher.java    From delion with Apache License 2.0 5 votes vote down vote up
public void toggleOverview() {
    Tab tab = getTabModelSelector().getCurrentTab();
    ContentViewCore contentViewCore = tab != null ? tab.getContentViewCore() : null;

    if (!overviewVisible()) {
        mHost.hideKeyboard(new Runnable() {
            @Override
            public void run() {
                showOverview(true);
            }
        });
        if (contentViewCore != null) {
            contentViewCore.setAccessibilityState(false);
        }
    } else {
        Layout activeLayout = getActiveLayout();
        if (activeLayout instanceof StackLayout) {
            ((StackLayout) activeLayout).commitOutstandingModelState(LayoutManager.time());
        }
        if (getTabModelSelector().getCurrentModel().getCount() != 0) {
            // Don't hide overview if current tab stack is empty()
            hideOverview(true);

            // hideOverview could change the current tab.  Update the local variables.
            tab = getTabModelSelector().getCurrentTab();
            contentViewCore = tab != null ? tab.getContentViewCore() : null;

            if (contentViewCore != null) {
                contentViewCore.setAccessibilityState(true);
            }
        }
    }
}
 
Example #16
Source File: BrowserAccessibilityManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Create a BrowserAccessibilityManager object, which is owned by the C++
 * BrowserAccessibilityManagerAndroid instance, and connects to the content view.
 * @param nativeBrowserAccessibilityManagerAndroid A pointer to the counterpart native
 *     C++ object that owns this object.
 * @param contentViewCore The content view that this object provides accessibility for.
 */
@CalledByNative
private static BrowserAccessibilityManager create(long nativeBrowserAccessibilityManagerAndroid,
        ContentViewCore contentViewCore) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return new LollipopBrowserAccessibilityManager(
                nativeBrowserAccessibilityManagerAndroid, contentViewCore);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        return new KitKatBrowserAccessibilityManager(
                nativeBrowserAccessibilityManagerAndroid, contentViewCore);
    } else {
        return new BrowserAccessibilityManager(
                nativeBrowserAccessibilityManagerAndroid, contentViewCore);
    }
}
 
Example #17
Source File: ChromeFullscreenManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the content view's viewport size to have it render the content correctly.
 *
 * @param viewCore The ContentViewCore to update.
 */
public void updateContentViewViewportSize(ContentViewCore viewCore) {
    if (viewCore == null) return;
    if (mInGesture || mContentViewScrolling) return;

    // Update content viewport size only when the top controls are not animating.
    int contentOffset = (int) rendererContentOffset();
    if (contentOffset != 0 && contentOffset != mControlContainerHeight) return;
    viewCore.setTopControlsHeight(mControlContainerHeight, contentOffset > 0);
}
 
Example #18
Source File: ContextualSearchSelectionController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Clears the selection.
 */
void clearSelection() {
    ContentViewCore baseContentView = getBaseContentView();
    if (baseContentView != null) {
        baseContentView.clearSelection();
    }
    resetAllStates();
}
 
Example #19
Source File: ValidationMessageBubble.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private ValidationMessageBubble(
        ContentViewCore contentViewCore, RectF anchor, String mainText, String subText) {
    final ViewGroup root = (ViewGroup) View.inflate(contentViewCore.getContext(),
            R.layout.validation_message_bubble, null);
    mPopup = new PopupWindow(root);
    updateTextViews(root, mainText, subText);
    measure(contentViewCore.getRenderCoordinates());
    Point origin = adjustWindowPosition(
            contentViewCore, (int) (anchor.centerX() - getAnchorOffset()), (int) anchor.bottom);
    mPopup.showAtLocation(
            contentViewCore.getContainerView(), Gravity.NO_GRAVITY, origin.x, origin.y);
}
 
Example #20
Source File: ChromeFullscreenManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void updateContentViewChildrenState() {
    ContentViewCore contentViewCore = getActiveContentViewCore();
    if (contentViewCore == null) return;
    ViewGroup view = contentViewCore.getContainerView();

    float topViewsTranslation = getTopVisibleContentOffset();
    applyTranslationToTopChildViews(view, topViewsTranslation);
    applyMarginToFullChildViews(view, topViewsTranslation);
    updateContentViewViewportSize(contentViewCore);
}
 
Example #21
Source File: SwipableOverlayView.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Watches the given ContentViewCore for scrolling changes.
 */
public void setContentViewCore(ContentViewCore contentViewCore) {
    if (mContentViewCore != null) {
        mContentViewCore.removeGestureStateListener(mGestureStateListener);
    }

    mContentViewCore = contentViewCore;
    if (mContentViewCore != null) {
        mContentViewCore.addGestureStateListener(mGestureStateListener);
    }
}
 
Example #22
Source File: TabModelUtils.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @param model The {@link TabModel} to act on.
 * @return      The currently active {@link ContentViewCore}, or {@code null} if no {@link Tab}
 *              is selected or the selected {@link Tab} has no current {@link ContentViewCore}.
 */
public static ContentViewCore getCurrentContentViewCore(TabList model) {
    Tab tab = getCurrentTab(model);
    if (tab == null) return null;

    return tab.getContentViewCore();
}
 
Example #23
Source File: ColorChooserAndroid.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@CalledByNative
public static ColorChooserAndroid createColorChooserAndroid(
        long nativeColorChooserAndroid,
        ContentViewCore contentViewCore,
        int initialColor,
        ColorSuggestion[] suggestions) {
    if (contentViewCore.getWindowAndroid() == null) return null;
    Context windowContext = contentViewCore.getWindowAndroid().getContext().get();
    if (WindowAndroid.activityFromContext(windowContext) == null) return null;
    ColorChooserAndroid chooser = new ColorChooserAndroid(nativeColorChooserAndroid,
            windowContext, initialColor, suggestions);
    chooser.openColorChooser();
    return chooser;
}
 
Example #24
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void startSearchTermResolutionRequest(String selection) {
    ContentViewCore baseContentView = getBaseContentView();
    if (baseContentView != null) {
        nativeStartSearchTermResolutionRequest(mNativeContextualSearchManagerPtr, selection,
                ALWAYS_USE_RESOLVED_SEARCH_TERM, getBaseContentView(),
                mPolicy.maySendBasePageUrl());
    }
}
 
Example #25
Source File: ContextualSearchTabHelper.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the Contextual Search hooks, adding or removing them depending on whether it is
 * currently active.
 * @param cvc The content view core to attach the gesture state listener to.
 */
private void updateContextualSearchHooks(ContentViewCore cvc) {
    if (cvc == null) return;

    if (isContextualSearchActive(cvc)) {
        addContextualSearchHooks(cvc);
    } else {
        removeContextualSearchHooks(cvc);
    }
}
 
Example #26
Source File: ContextualSearchManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the current loaded URL in a ContentViewCore.
 *
 * @param searchContentViewCore The given ContentViewCore.
 * @return The current loaded URL.
 */
private String getContentViewUrl(ContentViewCore searchContentViewCore) {
    // First, check the pending navigation entry, because there might be an navigation
    // not yet committed being processed. Otherwise, get the URL from the WebContents.
    NavigationEntry entry =
            searchContentViewCore.getWebContents().getNavigationController().getPendingEntry();
    String url = entry != null
            ? entry.getUrl() : searchContentViewCore.getWebContents().getUrl();
    return url;
}
 
Example #27
Source File: CompositorViewHolder.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Adjusts the physical backing size of a given ContentViewCore. This method checks
 * the associated container view to see if the size needs to be overriden, such as when used for
 * {@link OverlayPanel}.
 * @param contentViewCore The {@link ContentViewCore} to resize.
 * @param width The default width.
 * @param height The default height.
 */
private void adjustPhysicalBackingSize(ContentViewCore contentViewCore, int width, int height) {
    ContentView contentView = (ContentView) contentViewCore.getContainerView();
    if (contentView == mOverlayContentView) {
        width = MeasureSpec.getSize(mOverlayContentWidthMeasureSpec);
        height = MeasureSpec.getSize(mOverlayContentHeightMeasureSpec);
    }
    mCompositorView.onPhysicalBackingSizeChanged(
            contentViewCore.getWebContents(), width, height);
}
 
Example #28
Source File: ContextualSearchSelectionController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Handles a notification that a selection event took place.
 * @param eventType The type of event that took place.
 * @param posXPix The x coordinate of the selection start handle.
 * @param posYPix The y coordinate of the selection start handle.
 */
void handleSelectionEvent(int eventType, float posXPix, float posYPix) {
    boolean shouldHandleSelection = false;
    switch (eventType) {
        case SelectionEventType.SELECTION_HANDLES_SHOWN:
            mWasTapGestureDetected = false;
            mSelectionType = SelectionType.LONG_PRESS;
            shouldHandleSelection = true;
            // Since we're showing pins, we don't care if the previous tap was invalid anymore.
            unscheduleInvalidTapNotification();
            break;
        case SelectionEventType.SELECTION_HANDLES_CLEARED:
            mHandler.handleSelectionDismissal();
            resetAllStates();
            break;
        case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED:
            shouldHandleSelection = mShouldHandleSelectionModification;
            break;
        case SelectionEventType.SELECTION_ESTABLISHED:
            mIsSelectionEstablished = true;
            break;
        case SelectionEventType.SELECTION_DISSOLVED:
            mIsSelectionEstablished = false;
            break;
        default:
    }

    if (shouldHandleSelection) {
        ContentViewCore baseContentView = getBaseContentView();
        if (baseContentView != null) {
            String selection = baseContentView.getSelectedText();
            if (selection != null) {
                mX = posXPix;
                mY = posYPix;
                mSelectedText = selection;
                handleSelection(selection, SelectionType.LONG_PRESS);
            }
        }
    }
}
 
Example #29
Source File: ChromeFullscreenManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the content view's viewport size to have it render the content correctly.
 *
 * @param viewCore The ContentViewCore to update.
 */
public void updateContentViewViewportSize(ContentViewCore viewCore) {
    if (viewCore == null) return;
    if (mInGesture || mContentViewScrolling) return;

    // Update content viewport size only when the browser controls are not animating.
    int contentOffset = (int) mRendererTopContentOffset;
    if (contentOffset != 0 && contentOffset != getTopControlsHeight()) return;
    viewCore.setTopControlsHeight(getTopControlsHeight(), contentOffset > 0);
}
 
Example #30
Source File: ContextualSearchSelectionController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Clears the selection.
 */
void clearSelection() {
    ContentViewCore baseContentView = getBaseContentView();
    if (baseContentView != null) {
        baseContentView.clearSelection();
    }
    resetAllStates();
}