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