Index: content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java b/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..94a304c777b782a49a5f6f5ea85db47f308de181 |
--- /dev/null |
+++ b/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java |
@@ -0,0 +1,90 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.content.browser; |
+ |
+import org.chromium.base.CalledByNative; |
+ |
+/* |
+ * Holds parameters for ContentViewCore.LoadUrl. Parameters should match |
+ * counterparts in NavigationController::LoadURLParams, including default |
+ * values. |
+ */ |
+public class LoadUrlParams { |
+ // Should match NavigationController::LoadUrlType exactly. See comments |
+ // there for proper usage. Values are initialized in initializeConstants. |
+ public static int LOAD_TYPE_DEFAULT; |
+ public static int LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; |
+ public static int LOAD_TYPE_DATA; |
+ |
+ // Should match NavigationController::UserAgentOverrideOption exactly. |
+ // See comments there for proper usage. Values are initialized in |
+ // initializeConstants. |
+ public static int UA_OVERRIDE_INHERIT; |
+ public static int UA_OVERRIDE_FALSE; |
+ public static int UA_OVERRIDE_TRUE; |
+ |
+ // Fields with counterparts in NavigationController::LoadURLParams |
+ // Package private so that ContentViewCore.loadUrl can pass them down to |
+ // native code. Should not be accessed directly anywhere else outside of |
+ // this class. |
+ final String mUrl; |
+ int mLoadUrlType; |
+ int mTransitionType; |
+ int mUaOverrideOption; |
+ byte[] mPostData; |
+ String mBaseUrlForDataUrl; |
+ String mVirtualUrlForDataUrl; |
+ |
+ public LoadUrlParams(String url) { |
joth
2012/08/09 00:33:55
we could add:
// check initializeConstants was cal
boliu
2012/08/09 01:22:00
Done.
|
+ mUrl = url; |
+ mLoadUrlType = LOAD_TYPE_DEFAULT; |
+ mTransitionType = ContentViewCore.PAGE_TRANSITION_LINK; |
+ mUaOverrideOption = UA_OVERRIDE_INHERIT; |
+ mPostData = null; |
+ mBaseUrlForDataUrl = null; |
+ mVirtualUrlForDataUrl = null; |
+ } |
+ |
+ public void setLoadType(int loadType) { |
+ mLoadUrlType = loadType; |
+ } |
+ |
+ public void setTransitionType(int transitionType) { |
+ mTransitionType = transitionType; |
+ } |
+ |
+ public void setOverrideUserAgent(int uaOption) { |
+ mUaOverrideOption = uaOption; |
+ } |
+ |
+ public void setPostData(byte[] postData) { |
+ mPostData = postData; |
+ } |
+ |
+ public void setBaseUrlForDataUrl(String baseUrl) { |
+ mBaseUrlForDataUrl = baseUrl; |
+ } |
+ |
+ public void setVirtualUrlForDataUrl(String virtualUrl) { |
+ mVirtualUrlForDataUrl = virtualUrl; |
+ } |
+ |
+ @SuppressWarnings("unused") |
+ @CalledByNative |
+ private static void initializeConstants( |
+ int load_type_default, |
+ int load_type_browser_initiated_http_post, |
+ int load_type_data, |
+ int ua_override_inherit, |
+ int ua_override_false, |
+ int ua_override_true) { |
+ LOAD_TYPE_DEFAULT = load_type_default; |
+ LOAD_TYPE_BROWSER_INITIATED_HTTP_POST = load_type_browser_initiated_http_post; |
+ LOAD_TYPE_DATA = load_type_data; |
+ UA_OVERRIDE_INHERIT = ua_override_inherit; |
+ UA_OVERRIDE_FALSE = ua_override_false; |
+ UA_OVERRIDE_TRUE = ua_override_true; |
+ } |
+} |