OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.browser.webcontents; | 5 package org.chromium.content.browser.webcontents; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
10 import android.os.Bundle; | 10 import android.os.Bundle; |
11 import android.os.Handler; | 11 import android.os.Handler; |
12 import android.os.Message; | 12 import android.os.Message; |
13 import android.os.Parcel; | 13 import android.os.Parcel; |
14 import android.os.ParcelUuid; | 14 import android.os.ParcelUuid; |
15 import android.os.Parcelable; | 15 import android.os.Parcelable; |
16 | 16 |
17 import org.chromium.base.ThreadUtils; | 17 import org.chromium.base.ThreadUtils; |
18 import org.chromium.base.VisibleForTesting; | 18 import org.chromium.base.VisibleForTesting; |
19 import org.chromium.base.annotations.CalledByNative; | 19 import org.chromium.base.annotations.CalledByNative; |
20 import org.chromium.base.annotations.JNINamespace; | 20 import org.chromium.base.annotations.JNINamespace; |
21 import org.chromium.content.browser.AppWebMessagePort; | 21 import org.chromium.content.browser.AppWebMessagePort; |
22 import org.chromium.content.browser.MediaSessionImpl; | 22 import org.chromium.content.browser.MediaSessionImpl; |
23 import org.chromium.content.browser.framehost.RenderFrameHostDelegate; | 23 import org.chromium.content.browser.framehost.RenderFrameHostDelegate; |
24 import org.chromium.content.browser.framehost.RenderFrameHostImpl; | |
25 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; | 24 import org.chromium.content_public.browser.AccessibilitySnapshotCallback; |
26 import org.chromium.content_public.browser.AccessibilitySnapshotNode; | 25 import org.chromium.content_public.browser.AccessibilitySnapshotNode; |
27 import org.chromium.content_public.browser.ContentBitmapCallback; | 26 import org.chromium.content_public.browser.ContentBitmapCallback; |
28 import org.chromium.content_public.browser.ImageDownloadCallback; | 27 import org.chromium.content_public.browser.ImageDownloadCallback; |
29 import org.chromium.content_public.browser.JavaScriptCallback; | 28 import org.chromium.content_public.browser.JavaScriptCallback; |
30 import org.chromium.content_public.browser.MessagePort; | 29 import org.chromium.content_public.browser.MessagePort; |
31 import org.chromium.content_public.browser.NavigationController; | 30 import org.chromium.content_public.browser.NavigationController; |
32 import org.chromium.content_public.browser.RenderFrameHost; | 31 import org.chromium.content_public.browser.RenderFrameHost; |
33 import org.chromium.content_public.browser.SmartClipCallback; | 32 import org.chromium.content_public.browser.SmartClipCallback; |
34 import org.chromium.content_public.browser.WebContents; | 33 import org.chromium.content_public.browser.WebContents; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Attempt to retrieve the WebContents object from the nativ
e pointer. | 88 // Attempt to retrieve the WebContents object from the nativ
e pointer. |
90 return nativeFromNativePtr(bundle.getLong(PARCEL_WEBCONTENTS
_KEY)); | 89 return nativeFromNativePtr(bundle.getLong(PARCEL_WEBCONTENTS
_KEY)); |
91 } | 90 } |
92 | 91 |
93 @Override | 92 @Override |
94 public WebContents[] newArray(int size) { | 93 public WebContents[] newArray(int size) { |
95 return new WebContents[size]; | 94 return new WebContents[size]; |
96 } | 95 } |
97 }; | 96 }; |
98 | 97 |
99 public static WebContents fromRenderFrameHost(RenderFrameHost rfh) { | |
100 RenderFrameHostDelegate delegate = ((RenderFrameHostImpl) rfh).getRender
FrameHostDelegate(); | |
101 if (delegate == null || !(delegate instanceof WebContents)) { | |
102 return null; | |
103 } | |
104 return (WebContents) delegate; | |
105 } | |
106 | |
107 private long mNativeWebContentsAndroid; | 98 private long mNativeWebContentsAndroid; |
108 private NavigationController mNavigationController; | 99 private NavigationController mNavigationController; |
109 private RenderFrameHost mMainFrame; | 100 private RenderFrameHost mMainFrame; |
110 | 101 |
111 // Lazily created proxy observer for handling all Java-based WebContentsObse
rvers. | 102 // Lazily created proxy observer for handling all Java-based WebContentsObse
rvers. |
112 private WebContentsObserverProxy mObserverProxy; | 103 private WebContentsObserverProxy mObserverProxy; |
113 | 104 |
114 // The media session for this WebContents. It is constructed by the native M
ediaSession and has | 105 // The media session for this WebContents. It is constructed by the native M
ediaSession and has |
115 // the same life time as native MediaSession. | 106 // the same life time as native MediaSession. |
116 private MediaSessionImpl mMediaSession; | 107 private MediaSessionImpl mMediaSession; |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 long nativeWebContentsAndroid, int width, int height, ContentBitmapC
allback callback); | 639 long nativeWebContentsAndroid, int width, int height, ContentBitmapC
allback callback); |
649 private native void nativeReloadLoFiImages(long nativeWebContentsAndroid); | 640 private native void nativeReloadLoFiImages(long nativeWebContentsAndroid); |
650 private native int nativeDownloadImage(long nativeWebContentsAndroid, | 641 private native int nativeDownloadImage(long nativeWebContentsAndroid, |
651 String url, boolean isFavicon, int maxBitmapSize, | 642 String url, boolean isFavicon, int maxBitmapSize, |
652 boolean bypassCache, ImageDownloadCallback callback); | 643 boolean bypassCache, ImageDownloadCallback callback); |
653 private native void nativeDismissTextHandles(long nativeWebContentsAndroid); | 644 private native void nativeDismissTextHandles(long nativeWebContentsAndroid); |
654 private native void nativeSetHasPersistentVideo(long nativeWebContentsAndroi
d, boolean value); | 645 private native void nativeSetHasPersistentVideo(long nativeWebContentsAndroi
d, boolean value); |
655 private native boolean nativeHasActiveEffectivelyFullscreenVideo(long native
WebContentsAndroid); | 646 private native boolean nativeHasActiveEffectivelyFullscreenVideo(long native
WebContentsAndroid); |
656 private native EventForwarder nativeGetOrCreateEventForwarder(long nativeWeb
ContentsAndroid); | 647 private native EventForwarder nativeGetOrCreateEventForwarder(long nativeWeb
ContentsAndroid); |
657 } | 648 } |
OLD | NEW |