| 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.view.ViewGroup; | 7 import android.view.ViewGroup; |
| 8 import android.os.Message; | 8 import android.os.Message; |
| 9 | 9 |
| 10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
| 11 import org.chromium.base.JNINamespace; | 11 import org.chromium.base.JNINamespace; |
| 12 import org.chromium.content.browser.ContentViewCore; | 12 import org.chromium.content.browser.ContentViewCore; |
| 13 import org.chromium.content.common.CleanupReference; | 13 import org.chromium.content.common.CleanupReference; |
| 14 import org.chromium.ui.gfx.NativeWindow; |
| 14 | 15 |
| 15 /** | 16 /** |
| 16 * Exposes the native AwContents class, and together these classes wrap the Cont
entViewCore | 17 * Exposes the native AwContents class, and together these classes wrap the Cont
entViewCore |
| 17 * and Browser components that are required to implement Android WebView API. Th
is is the | 18 * and Browser components that are required to implement Android WebView API. Th
is is the |
| 18 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob
ject | 19 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob
ject |
| 19 * relationship with application WebView instances. | 20 * relationship with application WebView instances. |
| 20 * (We define this class independent of the hidden WebViewProvider interfaces, t
o allow | 21 * (We define this class independent of the hidden WebViewProvider interfaces, t
o allow |
| 21 * continuous build & test in the open source SDK-based tree). | 22 * continuous build & test in the open source SDK-based tree). |
| 22 */ | 23 */ |
| 23 @JNINamespace("android_webview") | 24 @JNINamespace("android_webview") |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 * @param internalAccessAdapter to access private methods on containerView. | 50 * @param internalAccessAdapter to access private methods on containerView. |
| 50 * @param contentViewCore requires an existing but not yet initialized insta
nce. Will be | 51 * @param contentViewCore requires an existing but not yet initialized insta
nce. Will be |
| 51 * initialized on return. | 52 * initialized on return. |
| 52 * @param contentsClient will receive API callbacks from this WebView Conten
ts | 53 * @param contentsClient will receive API callbacks from this WebView Conten
ts |
| 53 * @param privateBrowsing whether this is a private browsing instance of Web
View. | 54 * @param privateBrowsing whether this is a private browsing instance of Web
View. |
| 54 * @param isAccessFromFileURLsGrantedByDefault passed to ContentViewCore.ini
tialize. | 55 * @param isAccessFromFileURLsGrantedByDefault passed to ContentViewCore.ini
tialize. |
| 55 */ | 56 */ |
| 56 public AwContents(ViewGroup containerView, | 57 public AwContents(ViewGroup containerView, |
| 57 ContentViewCore.InternalAccessDelegate internalAccessAdapter, | 58 ContentViewCore.InternalAccessDelegate internalAccessAdapter, |
| 58 ContentViewCore contentViewCore, AwContentsClient contentsClient, | 59 ContentViewCore contentViewCore, AwContentsClient contentsClient, |
| 59 boolean privateBrowsing, boolean isAccessFromFileURLsGrantedByDefault) { | 60 NativeWindow nativeWindow, boolean privateBrowsing, |
| 61 boolean isAccessFromFileURLsGrantedByDefault) { |
| 60 mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(), pr
ivateBrowsing); | 62 mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(), pr
ivateBrowsing); |
| 61 mContentViewCore = contentViewCore; | 63 mContentViewCore = contentViewCore; |
| 62 mContentsClient = contentsClient; | 64 mContentsClient = contentsClient; |
| 63 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNative
AwContents)); | 65 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNative
AwContents)); |
| 64 | 66 |
| 65 // TODO: upstream the needed ContentViewCore initialization method. | 67 // TODO: upstream the needed ContentViewCore initialization method. |
| 66 // mContentViewCore.initialize(containerView, internalAccessAdapter, false
, | 68 // mContentViewCore.initialize(containerView, internalAccessAdapter, false
, |
| 67 // nativeGetWebContents(mNativeAwContents), isAccessFromFileURLsGrante
dByDefault); | 69 // nativeGetWebContents(mNativeAwContents), nativeWindow, |
| 70 // isAccessFromFileURLsGrantedByDefault); |
| 68 mContentViewCore.setContentViewClient(contentsClient); | 71 mContentViewCore.setContentViewClient(contentsClient); |
| 69 } | 72 } |
| 70 | 73 |
| 71 public ContentViewCore getContentViewCore() { | 74 public ContentViewCore getContentViewCore() { |
| 72 return mContentViewCore; | 75 return mContentViewCore; |
| 73 } | 76 } |
| 74 | 77 |
| 75 public void destroy() { | 78 public void destroy() { |
| 76 if (mContentViewCore != null) { | 79 if (mContentViewCore != null) { |
| 77 mContentViewCore.destroy(); | 80 mContentViewCore.destroy(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 //--------------------------------------------------------------------------
------------------ | 119 //--------------------------------------------------------------------------
------------------ |
| 117 | 120 |
| 118 private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelega
te, | 121 private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelega
te, |
| 119 boolean privateBrowsing); | 122 boolean privateBrowsing); |
| 120 private static native void nativeDestroy(int nativeAwContents); | 123 private static native void nativeDestroy(int nativeAwContents); |
| 121 | 124 |
| 122 private native int nativeGetWebContents(int nativeAwContents); | 125 private native int nativeGetWebContents(int nativeAwContents); |
| 123 | 126 |
| 124 private native void nativeDocumentHasImages(int nativeAwContents, Message me
ssage); | 127 private native void nativeDocumentHasImages(int nativeAwContents, Message me
ssage); |
| 125 } | 128 } |
| OLD | NEW |