This source file includes following definitions.
- newInstance
- newInstance
- newInstance
- getUrl
- getTitle
- getBackgroundColor
- getView
- getContentViewCore
- getRenderCoordinates
- destroy
- isAlive
- setContentViewClient
- getContentViewClient
- loadUrl
- canGoBack
- canGoForward
- goBack
- goForward
- fling
- evaluateJavaScript
- onShow
- onHide
- hideSelectActionBar
- drawChild
- onScrollChanged
- onSizeChanged
- onLayout
- onCreateInputConnection
- onCheckIsTextEditor
- onFocusChanged
- onWindowFocusChanged
- onKeyUp
- dispatchKeyEventPreIme
- dispatchKeyEvent
- onTouchEvent
- onHoverEvent
- onGenericMotionEvent
- performLongClick
- setCurrentMotionEventOffsets
- createOffsetMotionEvent
- onConfigurationChanged
- scrollBy
- scrollTo
- computeHorizontalScrollExtent
- computeHorizontalScrollOffset
- computeHorizontalScrollRange
- computeVerticalScrollExtent
- computeVerticalScrollOffset
- computeVerticalScrollRange
- awakenScrollBars
- awakenScrollBars
- getSingleTapX
- getSingleTapY
- onInitializeAccessibilityNodeInfo
- onInitializeAccessibilityEvent
- onAttachedToWindow
- onDetachedFromWindow
- onVisibilityChanged
- getScale
- setAccessibilityState
- exitFullscreen
- getContentScrollY
- getContentHeight
- super_onKeyUp
- super_dispatchKeyEventPreIme
- super_dispatchKeyEvent
- super_onGenericMotionEvent
- super_onConfigurationChanged
- super_awakenScrollBars
package org.chromium.content.browser;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Build;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.FrameLayout;
import com.google.common.annotations.VisibleForTesting;
import org.chromium.base.TraceEvent;
import org.chromium.ui.base.WindowAndroid;
public class ContentView extends FrameLayout
implements ContentViewCore.InternalAccessDelegate, PageInfo {
private final ContentViewCore mContentViewCore;
private float mCurrentTouchOffsetX;
private float mCurrentTouchOffsetY;
private final int[] mLocationInWindow = new int[2];
public static ContentView newInstance(Context context, long nativeWebContents,
WindowAndroid windowAndroid) {
return newInstance(context, nativeWebContents, windowAndroid, null,
android.R.attr.webViewStyle);
}
public static ContentView newInstance(Context context, long nativeWebContents,
WindowAndroid windowAndroid, AttributeSet attrs) {
return newInstance(context, nativeWebContents, windowAndroid, attrs,
android.R.attr.webViewStyle);
}
public static ContentView newInstance(Context context, long nativeWebContents,
WindowAndroid windowAndroid, AttributeSet attrs, int defStyle) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
return new ContentView(context, nativeWebContents, windowAndroid, attrs, defStyle);
} else {
return new JellyBeanContentView(context, nativeWebContents, windowAndroid, attrs,
defStyle);
}
}
protected ContentView(Context context, long nativeWebContents, WindowAndroid windowAndroid,
AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (getScrollBarStyle() == View.SCROLLBARS_INSIDE_OVERLAY) {
setHorizontalScrollBarEnabled(false);
setVerticalScrollBarEnabled(false);
}
setFocusable(true);
setFocusableInTouchMode(true);
mContentViewCore = new ContentViewCore(context);
mContentViewCore.initialize(this, this, nativeWebContents, windowAndroid);
}
public String getUrl() {
return mContentViewCore.getUrl();
}
@Override
public String getTitle() {
return mContentViewCore.getTitle();
}
@Override
public int getBackgroundColor() {
return mContentViewCore.getBackgroundColor();
}
@Override
public View getView() {
return this;
}
public ContentViewCore getContentViewCore() {
return mContentViewCore;
}
public RenderCoordinates getRenderCoordinates() {
return mContentViewCore.getRenderCoordinates();
}
public void destroy() {
mContentViewCore.destroy();
}
public boolean isAlive() {
return mContentViewCore.isAlive();
}
public void setContentViewClient(ContentViewClient client) {
mContentViewCore.setContentViewClient(client);
}
@VisibleForTesting
public ContentViewClient getContentViewClient() {
return mContentViewCore.getContentViewClient();
}
public void loadUrl(LoadUrlParams params) {
mContentViewCore.loadUrl(params);
}
public boolean canGoBack() {
return mContentViewCore.canGoBack();
}
public boolean canGoForward() {
return mContentViewCore.canGoForward();
}
public void goBack() {
mContentViewCore.goBack();
}
public void goForward() {
mContentViewCore.goForward();
}
@VisibleForTesting
public void fling(long timeMs, int x, int y, int velocityX, int velocityY) {
mContentViewCore.flingForTest(timeMs, x, y, velocityX, velocityY);
}
public void evaluateJavaScript(String script) throws IllegalStateException {
mContentViewCore.evaluateJavaScript(script, null);
}
public void onShow() {
mContentViewCore.onShow();
}
public void onHide() {
mContentViewCore.onHide();
}
public void hideSelectActionBar() {
mContentViewCore.hideSelectActionBar();
}
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
return super.drawChild(canvas, child, drawingTime);
}
@Override
public void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
}
@Override
protected void onSizeChanged(int w, int h, int ow, int oh) {
TraceEvent.begin();
super.onSizeChanged(w, h, ow, oh);
mContentViewCore.onSizeChanged(w, h, ow, oh);
TraceEvent.end();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (changed) {
getLocationInWindow(mLocationInWindow);
mContentViewCore.onLocationInWindowChanged(mLocationInWindow[0], mLocationInWindow[1]);
}
}
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
return mContentViewCore.onCreateInputConnection(outAttrs);
}
@Override
public boolean onCheckIsTextEditor() {
return mContentViewCore.onCheckIsTextEditor();
}
@Override
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
TraceEvent.begin();
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
mContentViewCore.onFocusChanged(gainFocus);
TraceEvent.end();
}
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
mContentViewCore.onWindowFocusChanged(hasWindowFocus);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
return mContentViewCore.onKeyUp(keyCode, event);
}
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
return mContentViewCore.dispatchKeyEventPreIme(event);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (isFocused()) {
return mContentViewCore.dispatchKeyEvent(event);
} else {
return super.dispatchKeyEvent(event);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
MotionEvent offset = createOffsetMotionEvent(event);
boolean consumed = mContentViewCore.onTouchEvent(offset);
offset.recycle();
return consumed;
}
@Override
public boolean onHoverEvent(MotionEvent event) {
MotionEvent offset = createOffsetMotionEvent(event);
boolean consumed = mContentViewCore.onHoverEvent(offset);
offset.recycle();
super.onHoverEvent(event);
return consumed;
}
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
return mContentViewCore.onGenericMotionEvent(event);
}
@Override
public boolean performLongClick() {
return false;
}
public void setCurrentMotionEventOffsets(float dx, float dy) {
mCurrentTouchOffsetX = dx;
mCurrentTouchOffsetY = dy;
}
private MotionEvent createOffsetMotionEvent(MotionEvent src) {
MotionEvent dst = MotionEvent.obtain(src);
dst.offsetLocation(mCurrentTouchOffsetX, mCurrentTouchOffsetY);
return dst;
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
mContentViewCore.onConfigurationChanged(newConfig);
}
@Override
public void scrollBy(int x, int y) {
mContentViewCore.scrollBy(x, y);
}
@Override
public void scrollTo(int x, int y) {
mContentViewCore.scrollTo(x, y);
}
@Override
protected int computeHorizontalScrollExtent() {
return mContentViewCore.computeHorizontalScrollExtent();
}
@Override
protected int computeHorizontalScrollOffset() {
return mContentViewCore.computeHorizontalScrollOffset();
}
@Override
protected int computeHorizontalScrollRange() {
return mContentViewCore.computeHorizontalScrollRange();
}
@Override
protected int computeVerticalScrollExtent() {
return mContentViewCore.computeVerticalScrollExtent();
}
@Override
protected int computeVerticalScrollOffset() {
return mContentViewCore.computeVerticalScrollOffset();
}
@Override
protected int computeVerticalScrollRange() {
return mContentViewCore.computeVerticalScrollRange();
}
@Override
public boolean awakenScrollBars(int startDelay, boolean invalidate) {
return mContentViewCore.awakenScrollBars(startDelay, invalidate);
}
@Override
public boolean awakenScrollBars() {
return super.awakenScrollBars();
}
public int getSingleTapX() {
return mContentViewCore.getSingleTapX();
}
public int getSingleTapY() {
return mContentViewCore.getSingleTapY();
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
mContentViewCore.onInitializeAccessibilityNodeInfo(info);
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
mContentViewCore.onInitializeAccessibilityEvent(event);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mContentViewCore.onAttachedToWindow();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mContentViewCore.onDetachedFromWindow();
}
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
mContentViewCore.onVisibilityChanged(changedView, visibility);
}
public float getScale() {
return mContentViewCore.getScale();
}
public void setAccessibilityState(boolean state) {
mContentViewCore.setAccessibilityState(state);
}
public void exitFullscreen() {
mContentViewCore.exitFullscreen();
}
public int getContentScrollY() {
return mContentViewCore.computeVerticalScrollOffset();
}
public int getContentHeight() {
return mContentViewCore.computeVerticalScrollRange();
}
@Override
public boolean super_onKeyUp(int keyCode, KeyEvent event) {
return super.onKeyUp(keyCode, event);
}
@Override
public boolean super_dispatchKeyEventPreIme(KeyEvent event) {
return super.dispatchKeyEventPreIme(event);
}
@Override
public boolean super_dispatchKeyEvent(KeyEvent event) {
return super.dispatchKeyEvent(event);
}
@Override
public boolean super_onGenericMotionEvent(MotionEvent event) {
return super.onGenericMotionEvent(event);
}
@Override
public void super_onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public boolean super_awakenScrollBars(int startDelay, boolean invalidate) {
return super.awakenScrollBars(startDelay, invalidate);
}
}