Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: Source/web/AssociatedURLLoader.cpp

Issue 68173029: Support full range of PreflightPolicy over WebURLLoaderOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | public/web/WebURLLoaderOptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 AssociatedURLLoader::~AssociatedURLLoader() 301 AssociatedURLLoader::~AssociatedURLLoader()
302 { 302 {
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);
jochen (gone - plz use gerrit) 2013/11/18 11:59:06 please add new enums here
312 312
313 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL Response& response, WebURLError& error, WebData& data) 313 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL Response& response, WebURLError& error, WebData& data)
314 { 314 {
315 ASSERT(0); // Synchronous loading is not supported. 315 ASSERT(0); // Synchronous loading is not supported.
316 } 316 }
317 317
318 void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR LLoaderClient* client) 318 void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR LLoaderClient* client)
319 { 319 {
320 ASSERT(!m_client); 320 ASSERT(!m_client);
321 321
(...skipping 13 matching lines...) Expand all
335 } 335 }
336 } 336 }
337 337
338 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); 338 m_clientAdapter = ClientAdapter::create(this, m_client, m_options);
339 339
340 if (allowLoad) { 340 if (allowLoad) {
341 ThreadableLoaderOptions options; 341 ThreadableLoaderOptions options;
342 options.sendLoadCallbacks = SendCallbacks; // Always send callbacks. 342 options.sendLoadCallbacks = SendCallbacks; // Always send callbacks.
343 options.sniffContent = m_options.sniffContent ? SniffContent : DoNotSnif fContent; 343 options.sniffContent = m_options.sniffContent ? SniffContent : DoNotSnif fContent;
344 options.allowCredentials = m_options.allowCredentials ? AllowStoredCrede ntials : DoNotAllowStoredCredentials; 344 options.allowCredentials = m_options.allowCredentials ? AllowStoredCrede ntials : DoNotAllowStoredCredentials;
345 options.preflightPolicy = m_options.forcePreflight ? ForcePreflight : Co nsiderPreflight; 345 options.preflightPolicy = static_cast<WebCore::PreflightPolicy>(m_option s.preflightPolicy);
346 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque stPolicy>(m_options.crossOriginRequestPolicy); 346 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque stPolicy>(m_options.crossOriginRequestPolicy);
347 options.dataBufferingPolicy = DoNotBufferData; 347 options.dataBufferingPolicy = DoNotBufferData;
348 348
349 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); 349 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest();
350 Document* webcoreDocument = m_frameImpl->frame()->document(); 350 Document* webcoreDocument = m_frameImpl->frame()->document();
351 m_loader = DocumentThreadableLoader::create(webcoreDocument, m_clientAda pter.get(), webcoreRequest, options); 351 m_loader = DocumentThreadableLoader::create(webcoreDocument, m_clientAda pter.get(), webcoreRequest, options);
352 } else { 352 } else {
353 // FIXME: return meaningful error codes. 353 // FIXME: return meaningful error codes.
354 m_clientAdapter->setDelayedError(ResourceError()); 354 m_clientAdapter->setDelayedError(ResourceError());
355 } 355 }
356 m_clientAdapter->enableErrorNotifications(); 356 m_clientAdapter->enableErrorNotifications();
357 } 357 }
358 358
359 void AssociatedURLLoader::cancel() 359 void AssociatedURLLoader::cancel()
360 { 360 {
361 if (m_clientAdapter) 361 if (m_clientAdapter)
362 m_clientAdapter->clearClient(); 362 m_clientAdapter->clearClient();
363 if (m_loader) 363 if (m_loader)
364 m_loader->cancel(); 364 m_loader->cancel();
365 } 365 }
366 366
367 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 367 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
368 { 368 {
369 if (m_loader) 369 if (m_loader)
370 m_loader->setDefersLoading(defersLoading); 370 m_loader->setDefersLoading(defersLoading);
371 } 371 }
372 372
373 } // namespace blink 373 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | public/web/WebURLLoaderOptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698