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

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

Issue 831523005: Remove most native WebContents references from Java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwSettings.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 setScrollBarStyle(mInternalAccessAdapter.super_getScrollBarStyle()); 633 setScrollBarStyle(mInternalAccessAdapter.super_getScrollBarStyle());
634 mLayoutChangeListener = new AwLayoutChangeListener(); 634 mLayoutChangeListener = new AwLayoutChangeListener();
635 mContainerView.addOnLayoutChangeListener(mLayoutChangeListener); 635 mContainerView.addOnLayoutChangeListener(mLayoutChangeListener);
636 636
637 setNewAwContents(nativeInit(mBrowserContext)); 637 setNewAwContents(nativeInit(mBrowserContext));
638 638
639 onContainerViewChanged(); 639 onContainerViewChanged();
640 } 640 }
641 641
642 private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView, 642 private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView,
643 Context context, InternalAccessDelegate internalDispatcher, long nat iveWebContents, 643 Context context, InternalAccessDelegate internalDispatcher, WebConte nts webContents,
644 GestureStateListener gestureStateListener, 644 GestureStateListener gestureStateListener,
645 ContentViewClient contentViewClient, 645 ContentViewClient contentViewClient,
646 ContentViewCore.ZoomControlsDelegate zoomControlsDelegate, 646 ContentViewCore.ZoomControlsDelegate zoomControlsDelegate,
647 WindowAndroid windowAndroid) { 647 WindowAndroid windowAndroid) {
648 ContentViewCore contentViewCore = new ContentViewCore(context); 648 ContentViewCore contentViewCore = new ContentViewCore(context);
649 contentViewCore.initialize(containerView, internalDispatcher, nativeWebC ontents, 649 contentViewCore.initialize(containerView, internalDispatcher, webContent s,
650 windowAndroid); 650 windowAndroid);
651 contentViewCore.addGestureStateListener(gestureStateListener); 651 contentViewCore.addGestureStateListener(gestureStateListener);
652 contentViewCore.setContentViewClient(contentViewClient); 652 contentViewCore.setContentViewClient(contentViewClient);
653 contentViewCore.setZoomControlsDelegate(zoomControlsDelegate); 653 contentViewCore.setZoomControlsDelegate(zoomControlsDelegate);
654 return contentViewCore; 654 return contentViewCore;
655 } 655 }
656 656
657 boolean isFullScreen() { 657 boolean isFullScreen() {
658 return mFullScreenTransitionsState.isFullScreen(); 658 return mFullScreenTransitionsState.isFullScreen();
659 } 659 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 805
806 mNativeAwContents = newAwContentsPtr; 806 mNativeAwContents = newAwContentsPtr;
807 // TODO(joth): when the native and java counterparts of AwBrowserContext are hooked up to 807 // TODO(joth): when the native and java counterparts of AwBrowserContext are hooked up to
808 // each other, we should update |mBrowserContext| according to the newly received native 808 // each other, we should update |mBrowserContext| according to the newly received native
809 // WebContent's browser context. 809 // WebContent's browser context.
810 810
811 // The native side object has been bound to this java instance, so now i s the time to 811 // The native side object has been bound to this java instance, so now i s the time to
812 // bind all the native->java relationships. 812 // bind all the native->java relationships.
813 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati veAwContents)); 813 mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNati veAwContents));
814 814
815 long nativeWebContents = nativeGetWebContents(mNativeAwContents); 815 WebContents webContents = nativeGetWebContents(mNativeAwContents);
816 816
817 Activity activity = ContentViewCore.activityFromContext(mContext); 817 Activity activity = ContentViewCore.activityFromContext(mContext);
818 mWindowAndroid = activity != null 818 mWindowAndroid = activity != null
819 ? new ActivityWindowAndroid(activity) 819 ? new ActivityWindowAndroid(activity)
820 : new WindowAndroid(mContext.getApplicationContext()); 820 : new WindowAndroid(mContext.getApplicationContext());
821 mContentViewCore = createAndInitializeContentViewCore( 821 mContentViewCore = createAndInitializeContentViewCore(
822 mContainerView, mContext, mInternalAccessAdapter, nativeWebConte nts, 822 mContainerView, mContext, mInternalAccessAdapter, webContents,
823 new AwGestureStateListener(), mContentViewClient, mZoomControls, mWindowAndroid); 823 new AwGestureStateListener(), mContentViewClient, mZoomControls, mWindowAndroid);
824 nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mConte ntsClientBridge, 824 nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mConte ntsClientBridge,
825 mIoThreadClient, mInterceptNavigationDelegate); 825 mIoThreadClient, mInterceptNavigationDelegate);
826 mWebContents = mContentViewCore.getWebContents(); 826 mWebContents = mContentViewCore.getWebContents();
827 mNavigationController = mWebContents.getNavigationController(); 827 mNavigationController = mWebContents.getNavigationController();
828 installWebContentsObserver(); 828 installWebContentsObserver();
829 mSettings.setWebContents(nativeWebContents); 829 mSettings.setWebContents(webContents);
830 nativeSetDipScale(mNativeAwContents, (float) mDIPScale); 830 nativeSetDipScale(mNativeAwContents, (float) mDIPScale);
831 mContentViewCore.onShow(); 831 mContentViewCore.onShow();
832 } 832 }
833 833
834 private void installWebContentsObserver() { 834 private void installWebContentsObserver() {
835 if (mWebContentsObserver != null) { 835 if (mWebContentsObserver != null) {
836 mWebContentsObserver.detachFromWebContents(); 836 mWebContentsObserver.detachFromWebContents();
837 } 837 }
838 mWebContentsObserver = new AwWebContentsObserver(mWebContents, mContents Client); 838 mWebContentsObserver = new AwWebContentsObserver(mWebContents, mContents Client);
839 } 839 }
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 private static native void nativeSetAwDrawGLFunctionTable(long functionTable Pointer); 2641 private static native void nativeSetAwDrawGLFunctionTable(long functionTable Pointer);
2642 private static native long nativeGetAwDrawGLFunction(); 2642 private static native long nativeGetAwDrawGLFunction();
2643 private static native int nativeGetNativeInstanceCount(); 2643 private static native int nativeGetNativeInstanceCount();
2644 private static native void nativeSetShouldDownloadFavicons(); 2644 private static native void nativeSetShouldDownloadFavicons();
2645 2645
2646 private native void nativeSetJavaPeers(long nativeAwContents, AwContents awC ontents, 2646 private native void nativeSetJavaPeers(long nativeAwContents, AwContents awC ontents,
2647 AwWebContentsDelegate webViewWebContentsDelegate, 2647 AwWebContentsDelegate webViewWebContentsDelegate,
2648 AwContentsClientBridge contentsClientBridge, 2648 AwContentsClientBridge contentsClientBridge,
2649 AwContentsIoThreadClient ioThreadClient, 2649 AwContentsIoThreadClient ioThreadClient,
2650 InterceptNavigationDelegate navigationInterceptionDelegate); 2650 InterceptNavigationDelegate navigationInterceptionDelegate);
2651 private native long nativeGetWebContents(long nativeAwContents); 2651 private native WebContents nativeGetWebContents(long nativeAwContents);
2652 2652
2653 private native void nativeDocumentHasImages(long nativeAwContents, Message m essage); 2653 private native void nativeDocumentHasImages(long nativeAwContents, Message m essage);
2654 private native void nativeGenerateMHTML( 2654 private native void nativeGenerateMHTML(
2655 long nativeAwContents, String path, ValueCallback<String> callback); 2655 long nativeAwContents, String path, ValueCallback<String> callback);
2656 2656
2657 private native void nativeAddVisitedLinks(long nativeAwContents, String[] vi sitedLinks); 2657 private native void nativeAddVisitedLinks(long nativeAwContents, String[] vi sitedLinks);
2658 private native boolean nativeOnDraw(long nativeAwContents, Canvas canvas, 2658 private native boolean nativeOnDraw(long nativeAwContents, Canvas canvas,
2659 boolean isHardwareAccelerated, int scrollX, int scrollY, 2659 boolean isHardwareAccelerated, int scrollX, int scrollY,
2660 int visibleLeft, int visibleTop, int visibleRight, int visibleBottom ); 2660 int visibleLeft, int visibleTop, int visibleRight, int visibleBottom );
2661 private native void nativeFindAllAsync(long nativeAwContents, String searchS tring); 2661 private native void nativeFindAllAsync(long nativeAwContents, String searchS tring);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 2706
2707 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 2707 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
2708 long resources); 2708 long resources);
2709 2709
2710 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId, 2710 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId,
2711 String message, String sourceOrigin, String targetOrigin, int[] msgP orts); 2711 String message, String sourceOrigin, String targetOrigin, int[] msgP orts);
2712 2712
2713 private native void nativeCreateMessageChannel(long nativeAwContents, 2713 private native void nativeCreateMessageChannel(long nativeAwContents,
2714 ValueCallback<MessageChannel> callback); 2714 ValueCallback<MessageChannel> callback);
2715 } 2715 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwSettings.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698