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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 cancel(); | 303 cancel(); |
304 } | 304 } |
305 | 305 |
306 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ | 306 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ |
307 COMPILE_ASSERT(static_cast<int>(blink::webkit_name) == static_cast<int>(WebC
ore::webcore_name), mismatching_enums) | 307 COMPILE_ASSERT(static_cast<int>(blink::webkit_name) == static_cast<int>(WebC
ore::webcore_name), mismatching_enums) |
308 | 308 |
309 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyDeny,
DenyCrossOriginRequests); | 309 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyDeny,
DenyCrossOriginRequests); |
310 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyUseAcc
essControl, UseAccessControl); | 310 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyUseAcc
essControl, UseAccessControl); |
311 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyAllow,
AllowCrossOriginRequests); | 311 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyAllow,
AllowCrossOriginRequests); |
312 | 312 |
| 313 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ConsiderPreflight, ConsiderPre
flight); |
| 314 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ForcePreflight, ForcePreflight
); |
| 315 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::PreventPreflight, PreventPrefl
ight); |
| 316 |
313 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL
Response& response, WebURLError& error, WebData& data) | 317 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL
Response& response, WebURLError& error, WebData& data) |
314 { | 318 { |
315 ASSERT(0); // Synchronous loading is not supported. | 319 ASSERT(0); // Synchronous loading is not supported. |
316 } | 320 } |
317 | 321 |
318 void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR
LLoaderClient* client) | 322 void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR
LLoaderClient* client) |
319 { | 323 { |
320 ASSERT(!m_client); | 324 ASSERT(!m_client); |
321 | 325 |
322 m_client = client; | 326 m_client = client; |
(...skipping 12 matching lines...) Expand all Loading... |
335 } | 339 } |
336 } | 340 } |
337 | 341 |
338 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); | 342 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); |
339 | 343 |
340 if (allowLoad) { | 344 if (allowLoad) { |
341 ThreadableLoaderOptions options; | 345 ThreadableLoaderOptions options; |
342 options.sendLoadCallbacks = SendCallbacks; // Always send callbacks. | 346 options.sendLoadCallbacks = SendCallbacks; // Always send callbacks. |
343 options.sniffContent = m_options.sniffContent ? SniffContent : DoNotSnif
fContent; | 347 options.sniffContent = m_options.sniffContent ? SniffContent : DoNotSnif
fContent; |
344 options.allowCredentials = m_options.allowCredentials ? AllowStoredCrede
ntials : DoNotAllowStoredCredentials; | 348 options.allowCredentials = m_options.allowCredentials ? AllowStoredCrede
ntials : DoNotAllowStoredCredentials; |
345 options.preflightPolicy = m_options.forcePreflight ? ForcePreflight : Co
nsiderPreflight; | 349 options.preflightPolicy = static_cast<WebCore::PreflightPolicy>(m_option
s.preflightPolicy); |
346 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque
stPolicy>(m_options.crossOriginRequestPolicy); | 350 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque
stPolicy>(m_options.crossOriginRequestPolicy); |
347 options.dataBufferingPolicy = DoNotBufferData; | 351 options.dataBufferingPolicy = DoNotBufferData; |
348 | 352 |
349 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); | 353 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); |
350 Document* webcoreDocument = m_frameImpl->frame()->document(); | 354 Document* webcoreDocument = m_frameImpl->frame()->document(); |
351 m_loader = DocumentThreadableLoader::create(webcoreDocument, m_clientAda
pter.get(), webcoreRequest, options); | 355 m_loader = DocumentThreadableLoader::create(webcoreDocument, m_clientAda
pter.get(), webcoreRequest, options); |
352 } else { | 356 } else { |
353 // FIXME: return meaningful error codes. | 357 // FIXME: return meaningful error codes. |
354 m_clientAdapter->setDelayedError(ResourceError()); | 358 m_clientAdapter->setDelayedError(ResourceError()); |
355 } | 359 } |
356 m_clientAdapter->enableErrorNotifications(); | 360 m_clientAdapter->enableErrorNotifications(); |
357 } | 361 } |
358 | 362 |
359 void AssociatedURLLoader::cancel() | 363 void AssociatedURLLoader::cancel() |
360 { | 364 { |
361 if (m_clientAdapter) | 365 if (m_clientAdapter) |
362 m_clientAdapter->clearClient(); | 366 m_clientAdapter->clearClient(); |
363 if (m_loader) | 367 if (m_loader) |
364 m_loader->cancel(); | 368 m_loader->cancel(); |
365 } | 369 } |
366 | 370 |
367 void AssociatedURLLoader::setDefersLoading(bool defersLoading) | 371 void AssociatedURLLoader::setDefersLoading(bool defersLoading) |
368 { | 372 { |
369 if (m_loader) | 373 if (m_loader) |
370 m_loader->setDefersLoading(defersLoading); | 374 m_loader->setDefersLoading(defersLoading); |
371 } | 375 } |
372 | 376 |
373 } // namespace blink | 377 } // namespace blink |
OLD | NEW |