| 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 | 9 |
| 10 import org.chromium.chrome.browser.ChromeWebContentsDelegateAndroid; | 10 import org.chromium.chrome.browser.ChromeWebContentsDelegateAndroid; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 public TabBase(Context context, int nativeWebContentsPtr, | 49 public TabBase(Context context, int nativeWebContentsPtr, |
| 50 NativeWindow window, ChromeWebContentsDelegateAndroid delegate) { | 50 NativeWindow window, ChromeWebContentsDelegateAndroid delegate) { |
| 51 mWindow = window; | 51 mWindow = window; |
| 52 | 52 |
| 53 // Build the WebContents and the ContentView/ContentViewCore | 53 // Build the WebContents and the ContentView/ContentViewCore |
| 54 if (nativeWebContentsPtr == 0) { | 54 if (nativeWebContentsPtr == 0) { |
| 55 nativeWebContentsPtr = ContentViewUtil.createNativeWebContents(false
); | 55 nativeWebContentsPtr = ContentViewUtil.createNativeWebContents(false
); |
| 56 } | 56 } |
| 57 mContentView = ContentView.newInstance(context, nativeWebContentsPtr, mW
indow, | 57 mContentView = ContentView.newInstance(context, nativeWebContentsPtr, mW
indow, |
| 58 ContentView.PERSONALITY_CHROME); | 58 ContentView.PERSONALITY_CHROME); |
| 59 mNativeTabBaseAndroidImpl = nativeInit(nativeWebContentsPtr); | 59 mNativeTabBaseAndroidImpl = nativeInit(nativeWebContentsPtr, window.getN
ativePointer()); |
| 60 | 60 |
| 61 // Build the WebContentsDelegate | 61 // Build the WebContentsDelegate |
| 62 mWebContentsDelegate = delegate == null ? new ChromeWebContentsDelegateA
ndroid() : delegate; | 62 mWebContentsDelegate = delegate == null ? new ChromeWebContentsDelegateA
ndroid() : delegate; |
| 63 nativeInitWebContentsDelegate(mNativeTabBaseAndroidImpl, mWebContentsDel
egate); | 63 nativeInitWebContentsDelegate(mNativeTabBaseAndroidImpl, mWebContentsDel
egate); |
| 64 | 64 |
| 65 // To be called after everything is initialized. | 65 // To be called after everything is initialized. |
| 66 mCleanupReference = new CleanupReference(this, | 66 mCleanupReference = new CleanupReference(this, |
| 67 new DestroyRunnable(mNativeTabBaseAndroidImpl)); | 67 new DestroyRunnable(mNativeTabBaseAndroidImpl)); |
| 68 } | 68 } |
| 69 | 69 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 private final int mNativeTabBaseAndroidImpl; | 124 private final int mNativeTabBaseAndroidImpl; |
| 125 private DestroyRunnable(int nativeTabBaseAndroidImpl) { | 125 private DestroyRunnable(int nativeTabBaseAndroidImpl) { |
| 126 mNativeTabBaseAndroidImpl = nativeTabBaseAndroidImpl; | 126 mNativeTabBaseAndroidImpl = nativeTabBaseAndroidImpl; |
| 127 } | 127 } |
| 128 @Override | 128 @Override |
| 129 public void run() { | 129 public void run() { |
| 130 nativeDestroy(mNativeTabBaseAndroidImpl); | 130 nativeDestroy(mNativeTabBaseAndroidImpl); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 private native int nativeInit(int webContentsPtr); | 134 private native int nativeInit(int webContentsPtr, int windowAndroidPtr); |
| 135 private static native void nativeDestroy(int nativeTabBaseAndroidImpl); | 135 private static native void nativeDestroy(int nativeTabBaseAndroidImpl); |
| 136 private native void nativeInitWebContentsDelegate(int nativeTabBaseAndroidIm
pl, | 136 private native void nativeInitWebContentsDelegate(int nativeTabBaseAndroidIm
pl, |
| 137 ChromeWebContentsDelegateAndroid chromeWebContentsDelegateAndroid); | 137 ChromeWebContentsDelegateAndroid chromeWebContentsDelegateAndroid); |
| 138 private native String nativeFixupUrl(int nativeTabBaseAndroidImpl, String ur
l); | 138 private native String nativeFixupUrl(int nativeTabBaseAndroidImpl, String ur
l); |
| 139 } | 139 } |
| OLD | NEW |