Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.content.res.Configuration; | 7 import android.content.res.Configuration; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 int nativeWebContents = nativeGetWebContents(mNativeAwContents); | 258 int nativeWebContents = nativeGetWebContents(mNativeAwContents); |
| 259 mContentViewCore.initialize(containerView, internalAccessAdapter, | 259 mContentViewCore.initialize(containerView, internalAccessAdapter, |
| 260 nativeWebContents, | 260 nativeWebContents, |
| 261 new AwNativeWindow(mContainerView.getContext()), | 261 new AwNativeWindow(mContainerView.getContext()), |
| 262 isAccessFromFileURLsGrantedByDefault); | 262 isAccessFromFileURLsGrantedByDefault); |
| 263 mContentViewCore.setContentViewClient(mContentsClient); | 263 mContentViewCore.setContentViewClient(mContentsClient); |
| 264 mLayoutSizer = new AwLayoutSizer(new AwLayoutSizerDelegate()); | 264 mLayoutSizer = new AwLayoutSizer(new AwLayoutSizerDelegate()); |
| 265 mContentViewCore.setContentSizeChangeListener(mLayoutSizer); | 265 mContentViewCore.setContentSizeChangeListener(mLayoutSizer); |
| 266 mContentsClient.installWebContentsObserver(mContentViewCore); | 266 mContentsClient.installWebContentsObserver(mContentViewCore); |
| 267 | 267 |
| 268 mSettings = new AwSettings(mContentViewCore.getContext(), nativeWebConte nts); | 268 mSettings = new AwSettings(this, mContentViewCore.getContext(), nativeWe bContents); |
| 269 setIoThreadClient(new IoThreadClientImpl()); | 269 setIoThreadClient(new IoThreadClientImpl()); |
| 270 setInterceptNavigationDelegate(new InterceptNavigationDelegateImpl()); | 270 setInterceptNavigationDelegate(new InterceptNavigationDelegateImpl()); |
| 271 | 271 |
| 272 mPossiblyStaleHitTestData = new HitTestData(); | 272 mPossiblyStaleHitTestData = new HitTestData(); |
| 273 nativeDidInitializeContentViewCore(mNativeAwContents, | 273 nativeDidInitializeContentViewCore(mNativeAwContents, |
| 274 mContentViewCore.getNativeContentViewCore()); | 274 mContentViewCore.getNativeContentViewCore()); |
| 275 | 275 |
| 276 mDIPScale = DeviceDisplayInfo.create(containerView.getContext()).getDIPS cale(); | 276 mDIPScale = DeviceDisplayInfo.create(containerView.getContext()).getDIPS cale(); |
| 277 | 277 |
| 278 ContentVideoView.registerContentVideoViewContextDelegate( | 278 ContentVideoView.registerContentVideoViewContextDelegate( |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 public void requestImageRef(Message msg) { | 668 public void requestImageRef(Message msg) { |
| 669 if (msg == null || mNativeAwContents == 0) return; | 669 if (msg == null || mNativeAwContents == 0) return; |
| 670 | 670 |
| 671 nativeUpdateLastHitTestData(mNativeAwContents); | 671 nativeUpdateLastHitTestData(mNativeAwContents); |
| 672 Bundle data = msg.getData(); | 672 Bundle data = msg.getData(); |
| 673 data.putString("url", mPossiblyStaleHitTestData.imgSrc); | 673 data.putString("url", mPossiblyStaleHitTestData.imgSrc); |
| 674 msg.setData(data); | 674 msg.setData(data); |
| 675 msg.sendToTarget(); | 675 msg.sendToTarget(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 public void resetScrollAndScaleState() { | |
|
benm (inactive)
2013/02/25 12:37:04
does this need to be public?
mnaganov (inactive)
2013/02/25 12:59:23
After addressing your second comment, now it reall
| |
| 679 nativeResetScrollAndScaleState(mNativeAwContents); | |
| 680 } | |
| 681 | |
| 678 //-------------------------------------------------------------------------- ------------------ | 682 //-------------------------------------------------------------------------- ------------------ |
| 679 // View and ViewGroup method implementations | 683 // View and ViewGroup method implementations |
| 680 //-------------------------------------------------------------------------- ------------------ | 684 //-------------------------------------------------------------------------- ------------------ |
| 681 | 685 |
| 682 /** | 686 /** |
| 683 * @see android.webkit.View#onTouchEvent() | 687 * @see android.webkit.View#onTouchEvent() |
| 684 */ | 688 */ |
| 685 public boolean onTouchEvent(MotionEvent event) { | 689 public boolean onTouchEvent(MotionEvent event) { |
| 686 if (mNativeAwContents == 0) return false; | 690 if (mNativeAwContents == 0) return false; |
| 687 boolean rv = mContentViewCore.onTouchEvent(event); | 691 boolean rv = mContentViewCore.onTouchEvent(event); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 // Returns null if save state fails. | 1068 // Returns null if save state fails. |
| 1065 private native byte[] nativeGetOpaqueState(int nativeAwContents); | 1069 private native byte[] nativeGetOpaqueState(int nativeAwContents); |
| 1066 | 1070 |
| 1067 // Returns false if restore state fails. | 1071 // Returns false if restore state fails. |
| 1068 private native boolean nativeRestoreFromOpaqueState(int nativeAwContents, by te[] state); | 1072 private native boolean nativeRestoreFromOpaqueState(int nativeAwContents, by te[] state); |
| 1069 | 1073 |
| 1070 private native int nativeReleasePopupWebContents(int nativeAwContents); | 1074 private native int nativeReleasePopupWebContents(int nativeAwContents); |
| 1071 private native void nativeSetWebContents(int nativeAwContents, int nativeNew WebContents); | 1075 private native void nativeSetWebContents(int nativeAwContents, int nativeNew WebContents); |
| 1072 private native void nativeFocusFirstNode(int nativeAwContents); | 1076 private native void nativeFocusFirstNode(int nativeAwContents); |
| 1073 | 1077 |
| 1078 private native void nativeResetScrollAndScaleState(int nativeAwContents); | |
| 1079 | |
| 1074 private native boolean nativeDrawSW(int nativeAwContents, Canvas canvas, int clipX, int clipY, | 1080 private native boolean nativeDrawSW(int nativeAwContents, Canvas canvas, int clipX, int clipY, |
| 1075 int clipW, int clipH); | 1081 int clipW, int clipH); |
| 1076 private native int nativeGetAwDrawGLViewContext(int nativeAwContents); | 1082 private native int nativeGetAwDrawGLViewContext(int nativeAwContents); |
| 1077 private native Picture nativeCapturePicture(int nativeAwContents); | 1083 private native Picture nativeCapturePicture(int nativeAwContents); |
| 1078 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled, | 1084 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled, |
| 1079 boolean invalidationOnly); | 1085 boolean invalidationOnly); |
| 1080 | 1086 |
| 1081 private native void nativeInvokeGeolocationCallback( | 1087 private native void nativeInvokeGeolocationCallback( |
| 1082 int nativeAwContents, boolean value, String requestingFrame); | 1088 int nativeAwContents, boolean value, String requestingFrame); |
| 1083 } | 1089 } |
| OLD | NEW |