Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.content.browser; | |
| 6 | |
| 7 import org.chromium.base.CalledByNative; | |
| 8 | |
| 9 /* | |
| 10 * Holds parameters for ContentViewCore.LoadUrl. Parameters should match | |
| 11 * counterparts in NavigationController::LoadURLParams, including default | |
| 12 * values. | |
| 13 */ | |
| 14 public class LoadUrlParams { | |
| 15 // Should match NavigationController::LoadUrlType exactly. See comments | |
| 16 // there for proper usage. Values are initialized in initializeConstants. | |
| 17 public static int LOAD_TYPE_DEFAULT; | |
| 18 public static int LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; | |
| 19 public static int LOAD_TYPE_DATA; | |
| 20 | |
| 21 // Should match NavigationController::UserAgentOverrideOption exactly. | |
| 22 // See comments there for proper usage. Values are initialized in | |
| 23 // initializeConstants. | |
| 24 public static int UA_OVERRIDE_INHERIT; | |
| 25 public static int UA_OVERRIDE_FALSE; | |
| 26 public static int UA_OVERRIDE_TRUE; | |
| 27 | |
| 28 // Fields with counterparts in NavigationController::LoadURLParams | |
| 29 // Package private so that ContentViewCore.loadUrl can pass them down to | |
| 30 // native code. Should not be accessed directly anywhere else outside of | |
| 31 // this class. | |
| 32 final String mUrl; | |
| 33 int mLoadUrlType; | |
| 34 int mTransitionType; | |
| 35 int mUaOverrideOption; | |
| 36 byte[] mPostData; | |
| 37 String mBaseUrlForDataUrl; | |
| 38 String mVirtualUrlForDataUrl; | |
| 39 | |
| 40 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.
| |
| 41 mUrl = url; | |
| 42 mLoadUrlType = LOAD_TYPE_DEFAULT; | |
| 43 mTransitionType = ContentViewCore.PAGE_TRANSITION_LINK; | |
| 44 mUaOverrideOption = UA_OVERRIDE_INHERIT; | |
| 45 mPostData = null; | |
| 46 mBaseUrlForDataUrl = null; | |
| 47 mVirtualUrlForDataUrl = null; | |
| 48 } | |
| 49 | |
| 50 public void setLoadType(int loadType) { | |
| 51 mLoadUrlType = loadType; | |
| 52 } | |
| 53 | |
| 54 public void setTransitionType(int transitionType) { | |
| 55 mTransitionType = transitionType; | |
| 56 } | |
| 57 | |
| 58 public void setOverrideUserAgent(int uaOption) { | |
| 59 mUaOverrideOption = uaOption; | |
| 60 } | |
| 61 | |
| 62 public void setPostData(byte[] postData) { | |
| 63 mPostData = postData; | |
| 64 } | |
| 65 | |
| 66 public void setBaseUrlForDataUrl(String baseUrl) { | |
| 67 mBaseUrlForDataUrl = baseUrl; | |
| 68 } | |
| 69 | |
| 70 public void setVirtualUrlForDataUrl(String virtualUrl) { | |
| 71 mVirtualUrlForDataUrl = virtualUrl; | |
| 72 } | |
| 73 | |
| 74 @SuppressWarnings("unused") | |
| 75 @CalledByNative | |
| 76 private static void initializeConstants( | |
| 77 int load_type_default, | |
| 78 int load_type_browser_initiated_http_post, | |
| 79 int load_type_data, | |
| 80 int ua_override_inherit, | |
| 81 int ua_override_false, | |
| 82 int ua_override_true) { | |
| 83 LOAD_TYPE_DEFAULT = load_type_default; | |
| 84 LOAD_TYPE_BROWSER_INITIATED_HTTP_POST = load_type_browser_initiated_http _post; | |
| 85 LOAD_TYPE_DATA = load_type_data; | |
| 86 UA_OVERRIDE_INHERIT = ua_override_inherit; | |
| 87 UA_OVERRIDE_FALSE = ua_override_false; | |
| 88 UA_OVERRIDE_TRUE = ua_override_true; | |
| 89 } | |
| 90 } | |
| OLD | NEW |