OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 HTTPRequestHeaderValidator validator; | 334 HTTPRequestHeaderValidator validator; |
335 newRequest.visitHTTPHeaderFields(&validator); | 335 newRequest.visitHTTPHeaderFields(&validator); |
336 allowLoad = validator.isSafe(); | 336 allowLoad = validator.isSafe(); |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); | 340 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); |
341 | 341 |
342 if (allowLoad) { | 342 if (allowLoad) { |
343 ThreadableLoaderOptions options; | 343 ThreadableLoaderOptions options; |
344 options.sniffContent = m_options.sniffContent ? SniffContent : DoNotSnif
fContent; | |
345 options.allowCredentials = m_options.allowCredentials ? AllowStoredCrede
ntials : DoNotAllowStoredCredentials; | |
346 options.preflightPolicy = static_cast<WebCore::PreflightPolicy>(m_option
s.preflightPolicy); | 344 options.preflightPolicy = static_cast<WebCore::PreflightPolicy>(m_option
s.preflightPolicy); |
347 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque
stPolicy>(m_options.crossOriginRequestPolicy); | 345 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque
stPolicy>(m_options.crossOriginRequestPolicy); |
348 options.dataBufferingPolicy = DoNotBufferData; | 346 |
| 347 ResourceLoaderOptions resourceLoaderOptions; |
| 348 resourceLoaderOptions.sniffContent = m_options.sniffContent ? SniffConte
nt : DoNotSniffContent; |
| 349 resourceLoaderOptions.allowCredentials = m_options.allowCredentials ? Al
lowStoredCredentials : DoNotAllowStoredCredentials; |
| 350 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData; |
349 | 351 |
350 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); | 352 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); |
351 Document* webcoreDocument = m_frameImpl->frame()->document(); | 353 Document* webcoreDocument = m_frameImpl->frame()->document(); |
352 ASSERT(webcoreDocument); | 354 ASSERT(webcoreDocument); |
353 m_loader = DocumentThreadableLoader::create(*webcoreDocument, m_clientAd
apter.get(), webcoreRequest, options); | 355 m_loader = DocumentThreadableLoader::create(*webcoreDocument, m_clientAd
apter.get(), webcoreRequest, options, resourceLoaderOptions); |
354 } else { | 356 } else { |
355 // FIXME: return meaningful error codes. | 357 // FIXME: return meaningful error codes. |
356 m_clientAdapter->setDelayedError(ResourceError()); | 358 m_clientAdapter->setDelayedError(ResourceError()); |
357 } | 359 } |
358 m_clientAdapter->enableErrorNotifications(); | 360 m_clientAdapter->enableErrorNotifications(); |
359 } | 361 } |
360 | 362 |
361 void AssociatedURLLoader::cancel() | 363 void AssociatedURLLoader::cancel() |
362 { | 364 { |
363 if (m_clientAdapter) | 365 if (m_clientAdapter) |
364 m_clientAdapter->clearClient(); | 366 m_clientAdapter->clearClient(); |
365 if (m_loader) | 367 if (m_loader) |
366 m_loader->cancel(); | 368 m_loader->cancel(); |
367 } | 369 } |
368 | 370 |
369 void AssociatedURLLoader::setDefersLoading(bool defersLoading) | 371 void AssociatedURLLoader::setDefersLoading(bool defersLoading) |
370 { | 372 { |
371 if (m_loader) | 373 if (m_loader) |
372 m_loader->setDefersLoading(defersLoading); | 374 m_loader->setDefersLoading(defersLoading); |
373 } | 375 } |
374 | 376 |
375 } // namespace blink | 377 } // namespace blink |
OLD | NEW |