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

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

Issue 834133004: Don't initialize C++ constants in Java during JNI registration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: multi-line package name yet again 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_library_common.mk » ('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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 import org.chromium.content.browser.ContentViewStatics; 52 import org.chromium.content.browser.ContentViewStatics;
53 import org.chromium.content.browser.SmartClipProvider; 53 import org.chromium.content.browser.SmartClipProvider;
54 import org.chromium.content.browser.WebContentsObserver; 54 import org.chromium.content.browser.WebContentsObserver;
55 import org.chromium.content.common.CleanupReference; 55 import org.chromium.content.common.CleanupReference;
56 import org.chromium.content_public.browser.GestureStateListener; 56 import org.chromium.content_public.browser.GestureStateListener;
57 import org.chromium.content_public.browser.JavaScriptCallback; 57 import org.chromium.content_public.browser.JavaScriptCallback;
58 import org.chromium.content_public.browser.LoadUrlParams; 58 import org.chromium.content_public.browser.LoadUrlParams;
59 import org.chromium.content_public.browser.NavigationController; 59 import org.chromium.content_public.browser.NavigationController;
60 import org.chromium.content_public.browser.NavigationHistory; 60 import org.chromium.content_public.browser.NavigationHistory;
61 import org.chromium.content_public.browser.WebContents; 61 import org.chromium.content_public.browser.WebContents;
62 import org.chromium.content_public.browser.navigation_controller.LoadURLType;
63 import org.chromium.content_public.browser.navigation_controller.UserAgentOverri deOption;
62 import org.chromium.content_public.common.Referrer; 64 import org.chromium.content_public.common.Referrer;
63 import org.chromium.ui.base.ActivityWindowAndroid; 65 import org.chromium.ui.base.ActivityWindowAndroid;
64 import org.chromium.ui.base.PageTransition; 66 import org.chromium.ui.base.PageTransition;
65 import org.chromium.ui.base.WindowAndroid; 67 import org.chromium.ui.base.WindowAndroid;
66 import org.chromium.ui.gfx.DeviceDisplayInfo; 68 import org.chromium.ui.gfx.DeviceDisplayInfo;
67 69
68 import java.io.File; 70 import java.io.File;
69 import java.lang.annotation.Annotation; 71 import java.lang.annotation.Annotation;
70 import java.net.MalformedURLException; 72 import java.net.MalformedURLException;
71 import java.net.URL; 73 import java.net.URL;
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 /** 1146 /**
1145 * Load url without fixing up the url string. Consumers of ContentView are r esponsible for 1147 * Load url without fixing up the url string. Consumers of ContentView are r esponsible for
1146 * ensuring the URL passed in is properly formatted (i.e. the scheme has bee n added if left 1148 * ensuring the URL passed in is properly formatted (i.e. the scheme has bee n added if left
1147 * off during user input). 1149 * off during user input).
1148 * 1150 *
1149 * @param params Parameters for this load. 1151 * @param params Parameters for this load.
1150 */ 1152 */
1151 public void loadUrl(LoadUrlParams params) { 1153 public void loadUrl(LoadUrlParams params) {
1152 if (isDestroyed()) return; 1154 if (isDestroyed()) return;
1153 1155
1154 if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA 1156 if (params.getLoadUrlType() == LoadURLType.DATA && !params.isBaseUrlData Scheme()) {
1155 && !params.isBaseUrlDataScheme()) {
1156 // This allows data URLs with a non-data base URL access to file:/// android_asset/ and 1157 // This allows data URLs with a non-data base URL access to file:/// android_asset/ and
1157 // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permi ts, it will also 1158 // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permi ts, it will also
1158 // allow access to file:// URLs (subject to OS level permission chec ks). 1159 // allow access to file:// URLs (subject to OS level permission chec ks).
1159 params.setCanLoadLocalResources(true); 1160 params.setCanLoadLocalResources(true);
1160 } 1161 }
1161 1162
1162 // If we are reloading the same url, then set transition type as reload. 1163 // If we are reloading the same url, then set transition type as reload.
1163 if (params.getUrl() != null 1164 if (params.getUrl() != null
1164 && params.getUrl().equals(mWebContents.getUrl()) 1165 && params.getUrl().equals(mWebContents.getUrl())
1165 && params.getTransitionType() == PageTransition.LINK) { 1166 && params.getTransitionType() == PageTransition.LINK) {
1166 params.setTransitionType(PageTransition.RELOAD); 1167 params.setTransitionType(PageTransition.RELOAD);
1167 } 1168 }
1168 params.setTransitionType( 1169 params.setTransitionType(
1169 params.getTransitionType() | PageTransition.FROM_API); 1170 params.getTransitionType() | PageTransition.FROM_API);
1170 1171
1171 // For WebView, always use the user agent override, which is set 1172 // For WebView, always use the user agent override, which is set
1172 // every time the user agent in AwSettings is modified. 1173 // every time the user agent in AwSettings is modified.
1173 params.setOverrideUserAgent(LoadUrlParams.UA_OVERRIDE_TRUE); 1174 params.setOverrideUserAgent(UserAgentOverrideOption.TRUE);
1174 1175
1175 1176
1176 // We don't pass extra headers to the content layer, as WebViewClassic 1177 // We don't pass extra headers to the content layer, as WebViewClassic
1177 // was adding them in a very narrow set of conditions. See http://crbug. com/306873 1178 // was adding them in a very narrow set of conditions. See http://crbug. com/306873
1178 // However, if the embedder is attempting to inject a Referer header for their 1179 // However, if the embedder is attempting to inject a Referer header for their
1179 // loadUrl call, then we set that separately and remove it from the extr a headers map/ 1180 // loadUrl call, then we set that separately and remove it from the extr a headers map/
1180 final String referer = "referer"; 1181 final String referer = "referer";
1181 Map<String, String> extraHeaders = params.getExtraHeaders(); 1182 Map<String, String> extraHeaders = params.getExtraHeaders();
1182 if (extraHeaders != null) { 1183 if (extraHeaders != null) {
1183 for (String header : extraHeaders.keySet()) { 1184 for (String header : extraHeaders.keySet()) {
(...skipping 12 matching lines...) Expand all
1196 mNavigationController.loadUrl(params); 1197 mNavigationController.loadUrl(params);
1197 1198
1198 // The behavior of WebViewClassic uses the populateVisitedLinks callback in WebKit. 1199 // The behavior of WebViewClassic uses the populateVisitedLinks callback in WebKit.
1199 // Chromium does not use this use code path and the best emulation of th is behavior to call 1200 // Chromium does not use this use code path and the best emulation of th is behavior to call
1200 // request visited links once on the first URL load of the WebView. 1201 // request visited links once on the first URL load of the WebView.
1201 if (!mHasRequestedVisitedHistoryFromClient) { 1202 if (!mHasRequestedVisitedHistoryFromClient) {
1202 mHasRequestedVisitedHistoryFromClient = true; 1203 mHasRequestedVisitedHistoryFromClient = true;
1203 requestVisitedHistoryFromClient(); 1204 requestVisitedHistoryFromClient();
1204 } 1205 }
1205 1206
1206 if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA 1207 if (params.getLoadUrlType() == LoadURLType.DATA && params.getBaseUrl() ! = null) {
1207 && params.getBaseUrl() != null) {
1208 // Data loads with a base url will be resolved in Blink, and not cau se an onPageStarted 1208 // Data loads with a base url will be resolved in Blink, and not cau se an onPageStarted
1209 // event to be sent. Sending the callback directly from here. 1209 // event to be sent. Sending the callback directly from here.
1210 mContentsClient.getCallbackHelper().postOnPageStarted(params.getBase Url()); 1210 mContentsClient.getCallbackHelper().postOnPageStarted(params.getBase Url());
1211 } 1211 }
1212 } 1212 }
1213 1213
1214 /** 1214 /**
1215 * Get the URL of the current page. 1215 * Get the URL of the current page.
1216 * 1216 *
1217 * @return The URL of the current page or null if it's empty. 1217 * @return The URL of the current page or null if it's empty.
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 2703
2704 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 2704 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
2705 long resources); 2705 long resources);
2706 2706
2707 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId, 2707 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId,
2708 String message, String sourceOrigin, String targetOrigin, int[] msgP orts); 2708 String message, String sourceOrigin, String targetOrigin, int[] msgP orts);
2709 2709
2710 private native void nativeCreateMessageChannel(long nativeAwContents, 2710 private native void nativeCreateMessageChannel(long nativeAwContents,
2711 ValueCallback<MessageChannel> callback); 2711 ValueCallback<MessageChannel> callback);
2712 } 2712 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/java_library_common.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698