use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.
the class CompositorViewHolder method initializeTab.
/**
* Sets the correct size for {@link View} on {@code tab} and sets the correct rendering
* parameters on {@link ContentViewCore} on {@code tab}.
* @param tab The {@link Tab} to initialize.
*/
private void initializeTab(Tab tab) {
ContentViewCore content = tab.getActiveContentViewCore();
if (content != null)
initializeContentViewCore(content);
View view = tab.getContentView();
if (view != tab.getView() || !tab.isNativePage())
setSizeOfUnattachedView(view);
}
use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.
the class OverlayPanel method setBasePageTextControlsVisibility.
/**
* Set the visibility of the base page text selection controls. This will also attempt to
* remove focus from the base page to clear any open controls.
* TODO(mdjones): This should be replaced with focusing the panel's ContentViewCore.
* @param visible If the text controls are visible.
*/
protected void setBasePageTextControlsVisibility(boolean visible) {
if (mActivity == null || mActivity.getActivityTab() == null)
return;
ContentViewCore baseContentView = mActivity.getActivityTab().getContentViewCore();
if (baseContentView == null)
return;
// If the panel does not have focus or isn't open, return.
if (isPanelOpened() && mDidClearTextControls && !visible)
return;
if (!isPanelOpened() && !mDidClearTextControls && visible)
return;
mDidClearTextControls = !visible;
if (!visible) {
baseContentView.preserveSelectionOnNextLossOfFocus();
baseContentView.getContainerView().clearFocus();
}
baseContentView.updateTextSelectionUI(visible);
}
use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.
the class ChromeActivity method onBackPressed.
@Override
public final void onBackPressed() {
RecordUserAction.record("SystemBack");
if (mCompositorViewHolder != null) {
LayoutManager layoutManager = mCompositorViewHolder.getLayoutManager();
if (layoutManager != null && layoutManager.onBackPressed())
return;
}
ContentViewCore contentViewCore = getContentViewCore();
if (contentViewCore != null && contentViewCore.isSelectActionBarShowing()) {
contentViewCore.clearSelection();
return;
}
if (mContextualSearchManager != null && mContextualSearchManager.onBackPressed())
return;
if (handleBackPressed())
return;
super.onBackPressed();
}
use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.
the class ContextualSearchManager method handleValidTap.
@Override
public void handleValidTap() {
if (mIsAccessibilityModeEnabled)
return;
if (isTapSupported()) {
// Here we are starting a new Contextual Search with a Tap gesture, therefore
// we need to clear to properly reflect that a search just started and we don't
// have the resolved search term yet.
mSearchRequest = null;
// Let the policy know that a tap gesture has been received.
mPolicy.registerTap();
ContentViewCore baseContentView = getBaseContentView();
if (baseContentView != null)
baseContentView.getWebContents().selectWordAroundCaret();
}
}
use of org.chromium.content.browser.ContentViewCore in project AndroidChromium by JackyAndroid.
the class ContextualSearchSelectionController method handleSelectionEvent.
/**
* 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:
if (!mIsContextMenuShown) {
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);
}
}
}
}
Aggregations