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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 } | 1016 } |
1017 | 1017 |
1018 /** | 1018 /** |
1019 * Load url without fixing up the url string. Consumers of ContentView are r
esponsible for | 1019 * Load url without fixing up the url string. Consumers of ContentView are r
esponsible for |
1020 * ensuring the URL passed in is properly formatted (i.e. the scheme has bee
n added if left | 1020 * ensuring the URL passed in is properly formatted (i.e. the scheme has bee
n added if left |
1021 * off during user input). | 1021 * off during user input). |
1022 * | 1022 * |
1023 * @param params Parameters for this load. | 1023 * @param params Parameters for this load. |
1024 */ | 1024 */ |
1025 public void loadUrl(LoadUrlParams params) { | 1025 public void loadUrl(LoadUrlParams params) { |
1026 if (mNativeAwContents == 0) return; | |
1027 | |
1028 if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA && | 1026 if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA && |
1029 !params.isBaseUrlDataScheme()) { | 1027 !params.isBaseUrlDataScheme()) { |
1030 // This allows data URLs with a non-data base URL access to file:///
android_asset/ and | 1028 // This allows data URLs with a non-data base URL access to file:///
android_asset/ and |
1031 // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permi
ts, it will also | 1029 // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permi
ts, it will also |
1032 // allow access to file:// URLs (subject to OS level permission chec
ks). | 1030 // allow access to file:// URLs (subject to OS level permission chec
ks). |
1033 params.setCanLoadLocalResources(true); | 1031 params.setCanLoadLocalResources(true); |
1034 } | 1032 } |
1035 | 1033 |
1036 // If we are reloading the same url, then set transition type as reload. | 1034 // If we are reloading the same url, then set transition type as reload. |
1037 if (params.getUrl() != null && | 1035 if (params.getUrl() != null && |
(...skipping 18 matching lines...) Expand all Loading... |
1056 if (extraHeaders != null) { | 1054 if (extraHeaders != null) { |
1057 for (String header : extraHeaders.keySet()) { | 1055 for (String header : extraHeaders.keySet()) { |
1058 if (REFERER.equals(header.toLowerCase(Locale.US))) { | 1056 if (REFERER.equals(header.toLowerCase(Locale.US))) { |
1059 params.setReferrer(new Referrer(extraHeaders.remove(header),
1)); | 1057 params.setReferrer(new Referrer(extraHeaders.remove(header),
1)); |
1060 params.setExtraHeaders(extraHeaders); | 1058 params.setExtraHeaders(extraHeaders); |
1061 break; | 1059 break; |
1062 } | 1060 } |
1063 } | 1061 } |
1064 } | 1062 } |
1065 | 1063 |
1066 nativeSetExtraHeadersForUrl( | 1064 if (mNativeAwContents != 0) { |
1067 mNativeAwContents, params.getUrl(), params.getExtraHttpRequestHe
adersString()); | 1065 nativeSetExtraHeadersForUrl( |
| 1066 mNativeAwContents, params.getUrl(), params.getExtraHttpReque
stHeadersString()); |
| 1067 } |
1068 params.setExtraHeaders(new HashMap<String, String>()); | 1068 params.setExtraHeaders(new HashMap<String, String>()); |
1069 | 1069 |
1070 nativeSendCheckRenderThreadResponsiveness(mNativeAwContents); | |
1071 mContentViewCore.loadUrl(params); | 1070 mContentViewCore.loadUrl(params); |
1072 | 1071 |
1073 // The behavior of WebViewClassic uses the populateVisitedLinks callback
in WebKit. | 1072 // The behavior of WebViewClassic uses the populateVisitedLinks callback
in WebKit. |
1074 // Chromium does not use this use code path and the best emulation of th
is behavior to call | 1073 // Chromium does not use this use code path and the best emulation of th
is behavior to call |
1075 // request visited links once on the first URL load of the WebView. | 1074 // request visited links once on the first URL load of the WebView. |
1076 if (!mHasRequestedVisitedHistoryFromClient) { | 1075 if (!mHasRequestedVisitedHistoryFromClient) { |
1077 mHasRequestedVisitedHistoryFromClient = true; | 1076 mHasRequestedVisitedHistoryFromClient = true; |
1078 requestVisitedHistoryFromClient(); | 1077 requestVisitedHistoryFromClient(); |
1079 } | 1078 } |
1080 | 1079 |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 private native long nativeReleasePopupAwContents(long nativeAwContents); | 2447 private native long nativeReleasePopupAwContents(long nativeAwContents); |
2449 private native void nativeFocusFirstNode(long nativeAwContents); | 2448 private native void nativeFocusFirstNode(long nativeAwContents); |
2450 private native void nativeSetBackgroundColor(long nativeAwContents, int colo
r); | 2449 private native void nativeSetBackgroundColor(long nativeAwContents, int colo
r); |
2451 | 2450 |
2452 private native long nativeGetAwDrawGLViewContext(long nativeAwContents); | 2451 private native long nativeGetAwDrawGLViewContext(long nativeAwContents); |
2453 private native long nativeCapturePicture(long nativeAwContents, int width, i
nt height); | 2452 private native long nativeCapturePicture(long nativeAwContents, int width, i
nt height); |
2454 private native void nativeEnableOnNewPicture(long nativeAwContents, boolean
enabled); | 2453 private native void nativeEnableOnNewPicture(long nativeAwContents, boolean
enabled); |
2455 private native void nativeClearView(long nativeAwContents); | 2454 private native void nativeClearView(long nativeAwContents); |
2456 private native void nativeSetExtraHeadersForUrl(long nativeAwContents, | 2455 private native void nativeSetExtraHeadersForUrl(long nativeAwContents, |
2457 String url, String extraHeaders); | 2456 String url, String extraHeaders); |
2458 private native void nativeSendCheckRenderThreadResponsiveness(long nativeAwC
ontents); | |
2459 | 2457 |
2460 private native void nativeInvokeGeolocationCallback( | 2458 private native void nativeInvokeGeolocationCallback( |
2461 long nativeAwContents, boolean value, String requestingFrame); | 2459 long nativeAwContents, boolean value, String requestingFrame); |
2462 | 2460 |
2463 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); | 2461 private native void nativeSetJsOnlineProperty(long nativeAwContents, boolean
networkUp); |
2464 | 2462 |
2465 private native void nativeTrimMemory(long nativeAwContents, int level, boole
an visible); | 2463 private native void nativeTrimMemory(long nativeAwContents, int level, boole
an visible); |
2466 | 2464 |
2467 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); | 2465 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo
rter awPdfExporter); |
2468 | 2466 |
2469 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, | 2467 private native void nativePreauthorizePermission(long nativeAwContents, Stri
ng origin, |
2470 long resources); | 2468 long resources); |
2471 } | 2469 } |
OLD | NEW |