| 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.ComponentCallbacks2; | 8 import android.content.ComponentCallbacks2; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.res.Configuration; | 10 import android.content.res.Configuration; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 import org.chromium.content.common.CleanupReference; | 50 import org.chromium.content.common.CleanupReference; |
| 51 import org.chromium.ui.base.ActivityWindowAndroid; | 51 import org.chromium.ui.base.ActivityWindowAndroid; |
| 52 import org.chromium.ui.base.WindowAndroid; | 52 import org.chromium.ui.base.WindowAndroid; |
| 53 import org.chromium.ui.gfx.DeviceDisplayInfo; | 53 import org.chromium.ui.gfx.DeviceDisplayInfo; |
| 54 | 54 |
| 55 import java.io.File; | 55 import java.io.File; |
| 56 import java.lang.annotation.Annotation; | 56 import java.lang.annotation.Annotation; |
| 57 import java.net.MalformedURLException; | 57 import java.net.MalformedURLException; |
| 58 import java.net.URL; | 58 import java.net.URL; |
| 59 import java.util.ArrayList; | 59 import java.util.ArrayList; |
| 60 import java.util.HashMap; |
| 60 import java.util.List; | 61 import java.util.List; |
| 61 import java.util.concurrent.Callable; | 62 import java.util.concurrent.Callable; |
| 62 | 63 |
| 63 /** | 64 /** |
| 64 * Exposes the native AwContents class, and together these classes wrap the Cont
entViewCore | 65 * Exposes the native AwContents class, and together these classes wrap the Cont
entViewCore |
| 65 * and Browser components that are required to implement Android WebView API. Th
is is the | 66 * and Browser components that are required to implement Android WebView API. Th
is is the |
| 66 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob
ject | 67 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob
ject |
| 67 * relationship with application WebView instances. | 68 * relationship with application WebView instances. |
| 68 * (We define this class independent of the hidden WebViewProvider interfaces, t
o allow | 69 * (We define this class independent of the hidden WebViewProvider interfaces, t
o allow |
| 69 * continuous build & test in the open source SDK-based tree). | 70 * continuous build & test in the open source SDK-based tree). |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 params.getTransitionType() == PageTransitionTypes.PAGE_TRANSITION_LI
NK) { | 904 params.getTransitionType() == PageTransitionTypes.PAGE_TRANSITION_LI
NK) { |
| 904 params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_RELOAD)
; | 905 params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_RELOAD)
; |
| 905 } | 906 } |
| 906 params.setTransitionType( | 907 params.setTransitionType( |
| 907 params.getTransitionType() | PageTransitionTypes.PAGE_TRANSITION
_FROM_API); | 908 params.getTransitionType() | PageTransitionTypes.PAGE_TRANSITION
_FROM_API); |
| 908 | 909 |
| 909 // For WebView, always use the user agent override, which is set | 910 // For WebView, always use the user agent override, which is set |
| 910 // every time the user agent in AwSettings is modified. | 911 // every time the user agent in AwSettings is modified. |
| 911 params.setOverrideUserAgent(LoadUrlParams.UA_OVERRIDE_TRUE); | 912 params.setOverrideUserAgent(LoadUrlParams.UA_OVERRIDE_TRUE); |
| 912 | 913 |
| 914 // We don't pass extra headers to the content layer, as WebViewClassic |
| 915 // was adding them in a very narrow set of conditions. See http://crbug.
com/306873 |
| 916 if (mNativeAwContents != 0) nativeSetExtraHeadersForUrl( |
| 917 mNativeAwContents, params.getUrl(), params.getExtraHttpRequestHe
adersString()); |
| 918 params.setExtraHeaders(new HashMap<String, String>()); |
| 919 |
| 913 mContentViewCore.loadUrl(params); | 920 mContentViewCore.loadUrl(params); |
| 914 | 921 |
| 915 suppressInterceptionForThisNavigation(); | 922 suppressInterceptionForThisNavigation(); |
| 916 | 923 |
| 917 // The behavior of WebViewClassic uses the populateVisitedLinks callback
in WebKit. | 924 // The behavior of WebViewClassic uses the populateVisitedLinks callback
in WebKit. |
| 918 // Chromium does not use this use code path and the best emulation of th
is behavior to call | 925 // Chromium does not use this use code path and the best emulation of th
is behavior to call |
| 919 // request visited links once on the first URL load of the WebView. | 926 // request visited links once on the first URL load of the WebView. |
| 920 if (!mHasRequestedVisitedHistoryFromClient) { | 927 if (!mHasRequestedVisitedHistoryFromClient) { |
| 921 mHasRequestedVisitedHistoryFromClient = true; | 928 mHasRequestedVisitedHistoryFromClient = true; |
| 922 requestVisitedHistoryFromClient(); | 929 requestVisitedHistoryFromClient(); |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 // Returns false if restore state fails. | 2083 // Returns false if restore state fails. |
| 2077 private native boolean nativeRestoreFromOpaqueState(long nativeAwContents, b
yte[] state); | 2084 private native boolean nativeRestoreFromOpaqueState(long nativeAwContents, b
yte[] state); |
| 2078 | 2085 |
| 2079 private native int nativeReleasePopupAwContents(long nativeAwContents); | 2086 private native int nativeReleasePopupAwContents(long nativeAwContents); |
| 2080 private native void nativeFocusFirstNode(long nativeAwContents); | 2087 private native void nativeFocusFirstNode(long nativeAwContents); |
| 2081 private native void nativeSetBackgroundColor(long nativeAwContents, int colo
r); | 2088 private native void nativeSetBackgroundColor(long nativeAwContents, int colo
r); |
| 2082 | 2089 |
| 2083 private native int nativeGetAwDrawGLViewContext(long nativeAwContents); | 2090 private native int nativeGetAwDrawGLViewContext(long nativeAwContents); |
| 2084 private native long nativeCapturePicture(long nativeAwContents, int width, i
nt height); | 2091 private native long nativeCapturePicture(long nativeAwContents, int width, i
nt height); |
| 2085 private native void nativeEnableOnNewPicture(long nativeAwContents, boolean
enabled); | 2092 private native void nativeEnableOnNewPicture(long nativeAwContents, boolean
enabled); |
| 2093 private native void nativeSetExtraHeadersForUrl(long nativeAwContents, |
| 2094 String url, String extraHeaders); |
| 2086 | 2095 |
| 2087 private native void nativeInvokeGeolocationCallback( | 2096 private native void nativeInvokeGeolocationCallback( |
| 2088 long nativeAwContents, boolean value, String requestingFrame); | 2097 long nativeAwContents, boolean value, String requestingFrame); |
| 2089 | 2098 |
| 2090 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); | 2099 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); |
| 2091 | 2100 |
| 2092 private native void nativeTrimMemory(long nativeAwContents, int level); | 2101 private native void nativeTrimMemory(long nativeAwContents, int level); |
| 2093 | 2102 |
| 2094 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); | 2103 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); |
| 2095 } | 2104 } |
| OLD | NEW |