OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.ComponentCallbacks2; | 8 import android.content.ComponentCallbacks2; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.res.Configuration; | 10 import android.content.res.Configuration; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 * should fallback to the SW path. | 135 * should fallback to the SW path. |
136 */ | 136 */ |
137 boolean requestDrawGL(Canvas canvas); | 137 boolean requestDrawGL(Canvas canvas); |
138 } | 138 } |
139 | 139 |
140 private int mNativeAwContents; | 140 private int mNativeAwContents; |
141 private final AwBrowserContext mBrowserContext; | 141 private final AwBrowserContext mBrowserContext; |
142 private final ViewGroup mContainerView; | 142 private final ViewGroup mContainerView; |
143 private ContentViewCore mContentViewCore; | 143 private ContentViewCore mContentViewCore; |
144 private final AwContentsClient mContentsClient; | 144 private final AwContentsClient mContentsClient; |
| 145 private final AwContentViewClient mContentViewClient; |
145 private final AwContentsClientBridge mContentsClientBridge; | 146 private final AwContentsClientBridge mContentsClientBridge; |
146 private final AwWebContentsDelegate mWebContentsDelegate; | 147 private final AwWebContentsDelegate mWebContentsDelegate; |
147 private final AwContentsIoThreadClient mIoThreadClient; | 148 private final AwContentsIoThreadClient mIoThreadClient; |
148 private final InterceptNavigationDelegateImpl mInterceptNavigationDelegate; | 149 private final InterceptNavigationDelegateImpl mInterceptNavigationDelegate; |
149 private final InternalAccessDelegate mInternalAccessAdapter; | 150 private final InternalAccessDelegate mInternalAccessAdapter; |
150 private final AwLayoutSizer mLayoutSizer; | 151 private final AwLayoutSizer mLayoutSizer; |
151 private final AwZoomControls mZoomControls; | 152 private final AwZoomControls mZoomControls; |
152 private final AwScrollOffsetManager mScrollOffsetManager; | 153 private final AwScrollOffsetManager mScrollOffsetManager; |
153 private OverScrollGlow mOverScrollGlow; | 154 private OverScrollGlow mOverScrollGlow; |
154 // This can be accessed on any thread after construction. See AwContentsIoTh
readClient. | 155 // This can be accessed on any thread after construction. See AwContentsIoTh
readClient. |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 * This version of the constructor is used in test code to inject test versi
ons of the above | 491 * This version of the constructor is used in test code to inject test versi
ons of the above |
491 * documented classes. | 492 * documented classes. |
492 */ | 493 */ |
493 public AwContents(AwBrowserContext browserContext, ViewGroup containerView, | 494 public AwContents(AwBrowserContext browserContext, ViewGroup containerView, |
494 InternalAccessDelegate internalAccessAdapter, AwContentsClient conte
ntsClient, | 495 InternalAccessDelegate internalAccessAdapter, AwContentsClient conte
ntsClient, |
495 AwSettings settings, AwLayoutSizer layoutSizer) { | 496 AwSettings settings, AwLayoutSizer layoutSizer) { |
496 mBrowserContext = browserContext; | 497 mBrowserContext = browserContext; |
497 mContainerView = containerView; | 498 mContainerView = containerView; |
498 mInternalAccessAdapter = internalAccessAdapter; | 499 mInternalAccessAdapter = internalAccessAdapter; |
499 mContentsClient = contentsClient; | 500 mContentsClient = contentsClient; |
| 501 mContentViewClient = new AwContentViewClient(contentsClient, settings); |
500 mLayoutSizer = layoutSizer; | 502 mLayoutSizer = layoutSizer; |
501 mSettings = settings; | 503 mSettings = settings; |
502 mDIPScale = DeviceDisplayInfo.create(mContainerView.getContext()).getDIP
Scale(); | 504 mDIPScale = DeviceDisplayInfo.create(mContainerView.getContext()).getDIP
Scale(); |
503 mLayoutSizer.setDelegate(new AwLayoutSizerDelegate()); | 505 mLayoutSizer.setDelegate(new AwLayoutSizerDelegate()); |
504 mLayoutSizer.setDIPScale(mDIPScale); | 506 mLayoutSizer.setDIPScale(mDIPScale); |
505 mWebContentsDelegate = new AwWebContentsDelegateAdapter(contentsClient,
mContainerView); | 507 mWebContentsDelegate = new AwWebContentsDelegateAdapter(contentsClient,
mContainerView); |
506 mContentsClientBridge = new AwContentsClientBridge(contentsClient); | 508 mContentsClientBridge = new AwContentsClientBridge(contentsClient); |
507 mZoomControls = new AwZoomControls(this); | 509 mZoomControls = new AwZoomControls(this); |
508 mIoThreadClient = new IoThreadClientImpl(); | 510 mIoThreadClient = new IoThreadClientImpl(); |
509 mInterceptNavigationDelegate = new InterceptNavigationDelegateImpl(); | 511 mInterceptNavigationDelegate = new InterceptNavigationDelegateImpl(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // each other, we should update |mBrowserContext| according to the newly
received native | 577 // each other, we should update |mBrowserContext| according to the newly
received native |
576 // WebContent's browser context. | 578 // WebContent's browser context. |
577 | 579 |
578 // The native side object has been bound to this java instance, so now i
s the time to | 580 // The native side object has been bound to this java instance, so now i
s the time to |
579 // bind all the native->java relationships. | 581 // bind all the native->java relationships. |
580 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati
veAwContents)); | 582 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati
veAwContents)); |
581 | 583 |
582 int nativeWebContents = nativeGetWebContents(mNativeAwContents); | 584 int nativeWebContents = nativeGetWebContents(mNativeAwContents); |
583 mContentViewCore = createAndInitializeContentViewCore( | 585 mContentViewCore = createAndInitializeContentViewCore( |
584 mContainerView, mInternalAccessAdapter, nativeWebContents, | 586 mContainerView, mInternalAccessAdapter, nativeWebContents, |
585 new AwGestureStateListener(), mContentsClient.getContentViewClie
nt(), | 587 new AwGestureStateListener(), mContentViewClient, mZoomControls)
; |
586 mZoomControls); | |
587 nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mConte
ntsClientBridge, | 588 nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mConte
ntsClientBridge, |
588 mIoThreadClient, mInterceptNavigationDelegate); | 589 mIoThreadClient, mInterceptNavigationDelegate); |
589 mContentsClient.installWebContentsObserver(mContentViewCore); | 590 mContentsClient.installWebContentsObserver(mContentViewCore); |
590 mSettings.setWebContents(nativeWebContents); | 591 mSettings.setWebContents(nativeWebContents); |
591 nativeSetDipScale(mNativeAwContents, (float) mDIPScale); | 592 nativeSetDipScale(mNativeAwContents, (float) mDIPScale); |
592 updateGlobalVisibleRect(); | 593 updateGlobalVisibleRect(); |
593 | 594 |
594 // The only call to onShow. onHide should never be called. | 595 // The only call to onShow. onHide should never be called. |
595 mContentViewCore.onShow(); | 596 mContentViewCore.onShow(); |
596 } | 597 } |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 private native int nativeCapturePicture(int nativeAwContents, int width, int
height); | 2071 private native int nativeCapturePicture(int nativeAwContents, int width, int
height); |
2071 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e
nabled); | 2072 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e
nabled); |
2072 | 2073 |
2073 private native void nativeInvokeGeolocationCallback( | 2074 private native void nativeInvokeGeolocationCallback( |
2074 int nativeAwContents, boolean value, String requestingFrame); | 2075 int nativeAwContents, boolean value, String requestingFrame); |
2075 | 2076 |
2076 private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean
networkUp); | 2077 private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean
networkUp); |
2077 | 2078 |
2078 private native void nativeTrimMemory(int nativeAwContents, int level); | 2079 private native void nativeTrimMemory(int nativeAwContents, int level); |
2079 } | 2080 } |
OLD | NEW |