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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.content.ComponentCallbacks2; | 9 import android.content.ComponentCallbacks2; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 // TODO(joth): when the native and java counterparts of AwBrowserContext
are hooked up to | 786 // TODO(joth): when the native and java counterparts of AwBrowserContext
are hooked up to |
787 // each other, we should update |mBrowserContext| according to the newly
received native | 787 // each other, we should update |mBrowserContext| according to the newly
received native |
788 // WebContent's browser context. | 788 // WebContent's browser context. |
789 | 789 |
790 // The native side object has been bound to this java instance, so now i
s the time to | 790 // The native side object has been bound to this java instance, so now i
s the time to |
791 // bind all the native->java relationships. | 791 // bind all the native->java relationships. |
792 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati
veAwContents)); | 792 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati
veAwContents)); |
793 | 793 |
794 long nativeWebContents = nativeGetWebContents(mNativeAwContents); | 794 long nativeWebContents = nativeGetWebContents(mNativeAwContents); |
795 | 795 |
796 mWindowAndroid = mContext instanceof Activity | 796 Activity activity = ContentViewCore.activityFromContext(mContext); |
797 ? new ActivityWindowAndroid((Activity) mContext) | 797 mWindowAndroid = activity != null |
| 798 ? new ActivityWindowAndroid(activity) |
798 : new WindowAndroid(mContext.getApplicationContext()); | 799 : new WindowAndroid(mContext.getApplicationContext()); |
799 mContentViewCore = createAndInitializeContentViewCore( | 800 mContentViewCore = createAndInitializeContentViewCore( |
800 mContainerView, mContext, mInternalAccessAdapter, nativeWebConte
nts, | 801 mContainerView, mContext, mInternalAccessAdapter, nativeWebConte
nts, |
801 new AwGestureStateListener(), mContentViewClient, mZoomControls,
mWindowAndroid); | 802 new AwGestureStateListener(), mContentViewClient, mZoomControls,
mWindowAndroid); |
802 nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mConte
ntsClientBridge, | 803 nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mConte
ntsClientBridge, |
803 mIoThreadClient, mInterceptNavigationDelegate); | 804 mIoThreadClient, mInterceptNavigationDelegate); |
804 mWebContents = mContentViewCore.getWebContents(); | 805 mWebContents = mContentViewCore.getWebContents(); |
805 mNavigationController = mWebContents.getNavigationController(); | 806 mNavigationController = mWebContents.getNavigationController(); |
806 installWebContentsObserver(); | 807 installWebContentsObserver(); |
807 mSettings.setWebContents(nativeWebContents); | 808 mSettings.setWebContents(nativeWebContents); |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 | 2679 |
2679 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, | 2680 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, |
2680 long resources); | 2681 long resources); |
2681 | 2682 |
2682 private native void nativePostMessageToFrame(long nativeAwContents, String f
rameId, | 2683 private native void nativePostMessageToFrame(long nativeAwContents, String f
rameId, |
2683 String message, String sourceOrigin, String targetOrigin, int[] msgP
orts); | 2684 String message, String sourceOrigin, String targetOrigin, int[] msgP
orts); |
2684 | 2685 |
2685 private native void nativeCreateMessageChannel(long nativeAwContents, | 2686 private native void nativeCreateMessageChannel(long nativeAwContents, |
2686 ValueCallback<MessageChannel> callback); | 2687 ValueCallback<MessageChannel> callback); |
2687 } | 2688 } |
OLD | NEW |