Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 12041009: [Android WebView] Migrate the rendering code to a separate set of classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload error, re-uploading. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 public static void setAwDrawSWFunctionTable(int functionTablePointer) { 313 public static void setAwDrawSWFunctionTable(int functionTablePointer) {
314 nativeSetAwDrawSWFunctionTable(functionTablePointer); 314 nativeSetAwDrawSWFunctionTable(functionTablePointer);
315 } 315 }
316 316
317 public static int getAwDrawGLFunction() { 317 public static int getAwDrawGLFunction() {
318 return nativeGetAwDrawGLFunction(); 318 return nativeGetAwDrawGLFunction();
319 } 319 }
320 320
321 public int getAwDrawGLViewContext() { 321 public int getAwDrawGLViewContext() {
322 // Using the native pointer as the returned viewContext. This is matched by the 322 // Using the native pointer as the returned viewContext. This is matched by the
323 // reinterpret_cast back to AwContents pointer in the native DrawGLFunct ion. 323 // reinterpret_cast back to BrowserViewRenderer pointer in the native Dr awGLFunction.
324 return mNativeAwContents; 324 return nativeGetAwDrawGLViewContext(mNativeAwContents);
325 } 325 }
326 326
327 public boolean onPrepareDrawGL(Canvas canvas) { 327 public boolean onPrepareDrawGL(Canvas canvas) {
328 if (mNativeAwContents == 0) return false; 328 if (mNativeAwContents == 0) return false;
329 nativeSetScrollForHWFrame(mNativeAwContents, 329 nativeSetScrollForHWFrame(mNativeAwContents,
330 mContainerView.getScrollX(), mContainerView.getScrollY()); 330 mContainerView.getScrollX(), mContainerView.getScrollY());
331 331
332 // returning false will cause a fallback to SW path. 332 // returning false will cause a fallback to SW path.
333 return true; 333 return true;
334 } 334 }
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 991
992 for (int i = 1; i < 100; i++) { 992 for (int i = 1; i < 100; i++) {
993 testName = baseName + name + "-" + i + WEB_ARCHIVE_EXTENSION; 993 testName = baseName + name + "-" + i + WEB_ARCHIVE_EXTENSION;
994 if (!new File(testName).exists()) return testName; 994 if (!new File(testName).exists()) return testName;
995 } 995 }
996 996
997 Log.e(TAG, "Unable to auto generate archive name for path: " + baseName) ; 997 Log.e(TAG, "Unable to auto generate archive name for path: " + baseName) ;
998 return null; 998 return null;
999 } 999 }
1000 1000
1001 /**
1002 * Provides a Bitmap object with a given width and height used for auxiliary rasterization.
1003 */
1004 @CalledByNative
1005 private static Bitmap createBitmap(int width, int height) {
1006 return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
1007 }
1008
1009 /**
1010 * Draws a provided bitmap into a canvas.
1011 * Used for convenience from the native side and other static helper methods .
1012 */
1013 @CalledByNative
1014 private static void drawBitmapIntoCanvas(Bitmap bitmap, Canvas canvas) {
1015 canvas.drawBitmap(bitmap, 0, 0, null);
1016 }
1017
1018 /**
1019 * Creates a new Picture that records drawing a provided bitmap.
1020 * Will return an empty Picture if the Bitmap is null.
1021 */
1022 @CalledByNative
1023 private static Picture recordBitmapIntoPicture(Bitmap bitmap) {
1024 Picture picture = new Picture();
1025 if (bitmap != null) {
1026 Canvas recordingCanvas = picture.beginRecording(bitmap.getWidth(), b itmap.getHeight());
1027 drawBitmapIntoCanvas(bitmap, recordingCanvas);
1028 picture.endRecording();
1029 }
1030 return picture;
1031 }
1032
1033 @CalledByNative 1001 @CalledByNative
1034 private void handleJsAlert(String url, String message, JsResultReceiver rece iver) { 1002 private void handleJsAlert(String url, String message, JsResultReceiver rece iver) {
1035 mContentsClient.handleJsAlert(url, message, receiver); 1003 mContentsClient.handleJsAlert(url, message, receiver);
1036 } 1004 }
1037 1005
1038 @CalledByNative 1006 @CalledByNative
1039 private void handleJsBeforeUnload(String url, String message, JsResultReceiv er receiver) { 1007 private void handleJsBeforeUnload(String url, String message, JsResultReceiv er receiver) {
1040 mContentsClient.handleJsBeforeUnload(url, message, receiver); 1008 mContentsClient.handleJsBeforeUnload(url, message, receiver);
1041 } 1009 }
1042 1010
(...skipping 25 matching lines...) Expand all
1068 private native void nativeGenerateMHTML( 1036 private native void nativeGenerateMHTML(
1069 int nativeAwContents, String path, ValueCallback<String> callback); 1037 int nativeAwContents, String path, ValueCallback<String> callback);
1070 1038
1071 private native void nativeSetIoThreadClient(int nativeAwContents, 1039 private native void nativeSetIoThreadClient(int nativeAwContents,
1072 AwContentsIoThreadClient ioThreadClient); 1040 AwContentsIoThreadClient ioThreadClient);
1073 private native void nativeSetInterceptNavigationDelegate(int nativeAwContent s, 1041 private native void nativeSetInterceptNavigationDelegate(int nativeAwContent s,
1074 InterceptNavigationDelegate navigationInterceptionDelegate); 1042 InterceptNavigationDelegate navigationInterceptionDelegate);
1075 1043
1076 private native void nativeAddVisitedLinks(int nativeAwContents, String[] vis itedLinks); 1044 private native void nativeAddVisitedLinks(int nativeAwContents, String[] vis itedLinks);
1077 1045
1078 private native boolean nativeDrawSW(int nativeAwContents, Canvas canvas, int clipX, int clipY,
1079 int clipW, int clipH);
1080 private native void nativeSetScrollForHWFrame(int nativeAwContents, int scro llX, int scrollY); 1046 private native void nativeSetScrollForHWFrame(int nativeAwContents, int scro llX, int scrollY);
1081 private native int nativeFindAllSync(int nativeAwContents, String searchStri ng); 1047 private native int nativeFindAllSync(int nativeAwContents, String searchStri ng);
1082 private native void nativeFindAllAsync(int nativeAwContents, String searchSt ring); 1048 private native void nativeFindAllAsync(int nativeAwContents, String searchSt ring);
1083 private native void nativeFindNext(int nativeAwContents, boolean forward); 1049 private native void nativeFindNext(int nativeAwContents, boolean forward);
1084 private native void nativeClearMatches(int nativeAwContents); 1050 private native void nativeClearMatches(int nativeAwContents);
1085 private native void nativeClearCache(int nativeAwContents, boolean includeDi skFiles); 1051 private native void nativeClearCache(int nativeAwContents, boolean includeDi skFiles);
1086 private native byte[] nativeGetCertificate(int nativeAwContents); 1052 private native byte[] nativeGetCertificate(int nativeAwContents);
1087 1053
1088 // Coordinates in desity independent pixels. 1054 // Coordinates in desity independent pixels.
1089 private native void nativeRequestNewHitTestDataAt(int nativeAwContents, int x, int y); 1055 private native void nativeRequestNewHitTestDataAt(int nativeAwContents, int x, int y);
1090 private native void nativeUpdateLastHitTestData(int nativeAwContents); 1056 private native void nativeUpdateLastHitTestData(int nativeAwContents);
1091 1057
1092 private native void nativeOnSizeChanged(int nativeAwContents, int w, int h, int ow, int oh); 1058 private native void nativeOnSizeChanged(int nativeAwContents, int w, int h, int ow, int oh);
1093 private native void nativeSetWindowViewVisibility(int nativeAwContents, bool ean windowVisible, 1059 private native void nativeSetWindowViewVisibility(int nativeAwContents, bool ean windowVisible,
1094 boolean viewVisible); 1060 boolean viewVisible);
1095 private native void nativeOnAttachedToWindow(int nativeAwContents, int w, in t h); 1061 private native void nativeOnAttachedToWindow(int nativeAwContents, int w, in t h);
1096 private native void nativeOnDetachedFromWindow(int nativeAwContents); 1062 private native void nativeOnDetachedFromWindow(int nativeAwContents);
1097 1063
1098 // Returns null if save state fails. 1064 // Returns null if save state fails.
1099 private native byte[] nativeGetOpaqueState(int nativeAwContents); 1065 private native byte[] nativeGetOpaqueState(int nativeAwContents);
1100 1066
1101 // Returns false if restore state fails. 1067 // Returns false if restore state fails.
1102 private native boolean nativeRestoreFromOpaqueState(int nativeAwContents, by te[] state); 1068 private native boolean nativeRestoreFromOpaqueState(int nativeAwContents, by te[] state);
1103 1069
1104 private native int nativeReleasePopupWebContents(int nativeAwContents); 1070 private native int nativeReleasePopupWebContents(int nativeAwContents);
1105 private native void nativeSetWebContents(int nativeAwContents, int nativeNew WebContents); 1071 private native void nativeSetWebContents(int nativeAwContents, int nativeNew WebContents);
1106 private native void nativeFocusFirstNode(int nativeAwContents); 1072 private native void nativeFocusFirstNode(int nativeAwContents);
1107 1073
1074 private native boolean nativeDrawSW(int nativeAwContents, Canvas canvas, int clipX, int clipY,
1075 int clipW, int clipH);
1076 private native int nativeGetAwDrawGLViewContext(int nativeAwContents);
1108 private native Picture nativeCapturePicture(int nativeAwContents); 1077 private native Picture nativeCapturePicture(int nativeAwContents);
1109 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled, 1078 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled,
1110 boolean invalidationOnly); 1079 boolean invalidationOnly);
1111 1080
1112 private native void nativeInvokeGeolocationCallback( 1081 private native void nativeInvokeGeolocationCallback(
1113 int nativeAwContents, boolean value, String requestingFrame); 1082 int nativeAwContents, boolean value, String requestingFrame);
1114 } 1083 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698