Chromium Code Reviews| 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
| 8 import org.chromium.base.JNINamespace; | 8 import org.chromium.base.JNINamespace; |
| 9 import org.chromium.content_public.Referrer; | 9 import org.chromium.content_public.Referrer; |
| 10 | 10 |
| 11 import java.util.Locale; | 11 import java.util.Locale; |
| 12 import java.util.Map; | 12 import java.util.Map; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Holds parameters for ContentViewCore.LoadUrl. Parameters should match | 15 * Holds parameters for ContentViewCore.LoadUrl. Parameters should match |
|
Yaron
2014/07/22 20:49:06
NavigationController
AKVT
2014/07/23 11:49:23
Done.
| |
| 16 * counterparts in NavigationController::LoadURLParams, including default | 16 * counterparts in NavigationController::LoadURLParams, including default |
| 17 * values. | 17 * values. |
| 18 */ | 18 */ |
| 19 @JNINamespace("content") | 19 @JNINamespace("content") |
| 20 public class LoadUrlParams { | 20 public class LoadUrlParams { |
| 21 // Should match NavigationController::LoadUrlType exactly. See comments | 21 // Should match NavigationController::LoadUrlType exactly. See comments |
| 22 // there for proper usage. initializeConstants() checks that the values | 22 // there for proper usage. initializeConstants() checks that the values |
| 23 // are correct. | 23 // are correct. |
| 24 public static final int LOAD_TYPE_DEFAULT = 0; | 24 public static final int LOAD_TYPE_DEFAULT = 0; |
| 25 public static final int LOAD_TYPE_BROWSER_INITIATED_HTTP_POST = 1; | 25 public static final int LOAD_TYPE_BROWSER_INITIATED_HTTP_POST = 1; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 return mExtraHeaders; | 252 return mExtraHeaders; |
| 253 } | 253 } |
| 254 | 254 |
| 255 /** | 255 /** |
| 256 * Return the extra headers as a single String separated by "\n", or null if no extra header is | 256 * Return the extra headers as a single String separated by "\n", or null if no extra header is |
| 257 * set. This form is suitable for passing to native | 257 * set. This form is suitable for passing to native |
| 258 * NavigationController::LoadUrlParams::extra_headers. This will return the headers set in an | 258 * NavigationController::LoadUrlParams::extra_headers. This will return the headers set in an |
| 259 * exploded form through setExtraHeaders(). Embedders that work with extra h eaders in opaque | 259 * exploded form through setExtraHeaders(). Embedders that work with extra h eaders in opaque |
| 260 * collapsed form can use the setVerbatimHeaders() / getVerbatimHeaders() in stead. | 260 * collapsed form can use the setVerbatimHeaders() / getVerbatimHeaders() in stead. |
| 261 */ | 261 */ |
| 262 String getExtraHeadersString() { | 262 public String getExtraHeadersString() { |
| 263 return getExtraHeadersString("\n", false); | 263 return getExtraHeadersString("\n", false); |
| 264 } | 264 } |
| 265 | 265 |
| 266 /** | 266 /** |
| 267 * Return the extra headers as a single String separated by "\r\n", or null if no extra header | 267 * Return the extra headers as a single String separated by "\r\n", or null if no extra header |
| 268 * is set. This form is suitable for passing to native | 268 * is set. This form is suitable for passing to native |
| 269 * net::HttpRequestHeaders::AddHeadersFromString. | 269 * net::HttpRequestHeaders::AddHeadersFromString. |
| 270 */ | 270 */ |
| 271 public String getExtraHttpRequestHeadersString() { | 271 public String getExtraHttpRequestHeadersString() { |
| 272 return getExtraHeadersString("\r\n", true); | 272 return getExtraHeadersString("\r\n", true); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 | 307 |
| 308 /** | 308 /** |
| 309 * Set user agent override option of this load. Defaults to UA_OVERRIDE_INHE RIT. | 309 * Set user agent override option of this load. Defaults to UA_OVERRIDE_INHE RIT. |
| 310 * @param uaOption One of UA_OVERRIDE static constants above. | 310 * @param uaOption One of UA_OVERRIDE static constants above. |
| 311 */ | 311 */ |
| 312 public void setOverrideUserAgent(int uaOption) { | 312 public void setOverrideUserAgent(int uaOption) { |
| 313 mUaOverrideOption = uaOption; | 313 mUaOverrideOption = uaOption; |
| 314 } | 314 } |
| 315 | 315 |
| 316 /** | 316 /** |
| 317 * Get user agent override option of this load. Defaults to UA_OVERRIDE_INHE RIT. | |
| 318 * @param uaOption One of UA_OVERRIDE static constants above. | |
| 319 */ | |
| 320 public int getUserAgentOverrideOption() { | |
| 321 return mUaOverrideOption; | |
| 322 } | |
| 323 | |
| 324 /** | |
| 317 * Set the post data of this load. This field is ignored unless load type is | 325 * Set the post data of this load. This field is ignored unless load type is |
| 318 * LOAD_TYPE_BROWSER_INITIATED_HTTP_POST. | 326 * LOAD_TYPE_BROWSER_INITIATED_HTTP_POST. |
| 319 * @param postData Post data for this http post load. | 327 * @param postData Post data for this http post load. |
| 320 */ | 328 */ |
| 321 public void setPostData(byte[] postData) { | 329 public void setPostData(byte[] postData) { |
| 322 mPostData = postData; | 330 mPostData = postData; |
| 323 } | 331 } |
| 324 | 332 |
| 325 /** | 333 /** |
| 326 * @return the data to be sent through POST | 334 * @return the data to be sent through POST |
| 327 */ | 335 */ |
| 328 public byte[] getPostData() { | 336 public byte[] getPostData() { |
| 329 return mPostData; | 337 return mPostData; |
| 330 } | 338 } |
| 331 | 339 |
| 332 /** | 340 /** |
| 333 * Set the base url for data load. It is used both to resolve relative URLs | 341 * Set the base url for data load. It is used both to resolve relative URLs |
| 334 * and when applying JavaScript's same origin policy. It is ignored unless | 342 * and when applying JavaScript's same origin policy. It is ignored unless |
| 335 * load type is LOAD_TYPE_DATA. | 343 * load type is LOAD_TYPE_DATA. |
| 336 * @param baseUrl The base url for this data load. | 344 * @param baseUrl The base url for this data load. |
| 337 */ | 345 */ |
| 338 public void setBaseUrlForDataUrl(String baseUrl) { | 346 public void setBaseUrlForDataUrl(String baseUrl) { |
| 339 mBaseUrlForDataUrl = baseUrl; | 347 mBaseUrlForDataUrl = baseUrl; |
| 340 } | 348 } |
| 341 | 349 |
| 342 /** | 350 /** |
| 351 * Get the virtual url for data load. It is the url displayed to the user. | |
| 352 * It is ignored unless load type is LOAD_TYPE_DATA. | |
| 353 * @return The virtual url for this data load. | |
| 354 */ | |
| 355 public String getVirtualUrlForDataUrl() { | |
| 356 return mVirtualUrlForDataUrl; | |
| 357 } | |
| 358 | |
| 359 /** | |
| 343 * Set the virtual url for data load. It is the url displayed to the user. | 360 * Set the virtual url for data load. It is the url displayed to the user. |
| 344 * It is ignored unless load type is LOAD_TYPE_DATA. | 361 * It is ignored unless load type is LOAD_TYPE_DATA. |
| 345 * @param virtualUrl The virtual url for this data load. | 362 * @param virtualUrl The virtual url for this data load. |
| 346 */ | 363 */ |
| 347 public void setVirtualUrlForDataUrl(String virtualUrl) { | 364 public void setVirtualUrlForDataUrl(String virtualUrl) { |
| 348 mVirtualUrlForDataUrl = virtualUrl; | 365 mVirtualUrlForDataUrl = virtualUrl; |
| 349 } | 366 } |
| 350 | 367 |
| 351 /** | 368 /** |
| 352 * Set whether the load should be able to access local resources. This | 369 * Set whether the load should be able to access local resources. This |
| 353 * defaults to false. | 370 * defaults to false. |
| 354 */ | 371 */ |
| 355 public void setCanLoadLocalResources(boolean canLoad) { | 372 public void setCanLoadLocalResources(boolean canLoad) { |
| 356 mCanLoadLocalResources = canLoad; | 373 mCanLoadLocalResources = canLoad; |
| 357 } | 374 } |
| 358 | 375 |
| 376 /** | |
| 377 * Get whether the load should be able to access local resources. This | |
| 378 * defaults to false. | |
| 379 */ | |
| 380 public boolean getCanLoadLocalResources() { | |
| 381 return mCanLoadLocalResources; | |
| 382 } | |
| 383 | |
| 359 public int getLoadUrlType() { | 384 public int getLoadUrlType() { |
| 360 return mLoadUrlType; | 385 return mLoadUrlType; |
| 361 } | 386 } |
| 362 | 387 |
| 363 /** | 388 /** |
| 364 * @param rendererInitiated Whether or not this load was initiated from a re nderer. | 389 * @param rendererInitiated Whether or not this load was initiated from a re nderer. |
| 365 */ | 390 */ |
| 366 public void setIsRendererInitiated(boolean rendererInitiated) { | 391 public void setIsRendererInitiated(boolean rendererInitiated) { |
| 367 mIsRendererInitiated = rendererInitiated; | 392 mIsRendererInitiated = rendererInitiated; |
| 368 } | 393 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 399 assert UA_OVERRIDE_FALSE == ua_override_false; | 424 assert UA_OVERRIDE_FALSE == ua_override_false; |
| 400 assert UA_OVERRIDE_TRUE == ua_override_true; | 425 assert UA_OVERRIDE_TRUE == ua_override_true; |
| 401 } | 426 } |
| 402 | 427 |
| 403 /** | 428 /** |
| 404 * Parses |url| as a GURL on the native side, and | 429 * Parses |url| as a GURL on the native side, and |
| 405 * returns true if it's scheme is data:. | 430 * returns true if it's scheme is data:. |
| 406 */ | 431 */ |
| 407 private static native boolean nativeIsDataScheme(String url); | 432 private static native boolean nativeIsDataScheme(String url); |
| 408 } | 433 } |
| OLD | NEW |