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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "public/platform/WebHTTPHeaderVisitor.h" | 43 #include "public/platform/WebHTTPHeaderVisitor.h" |
44 #include "public/platform/WebString.h" | 44 #include "public/platform/WebString.h" |
45 #include "public/platform/WebURLError.h" | 45 #include "public/platform/WebURLError.h" |
46 #include "public/platform/WebURLLoaderClient.h" | 46 #include "public/platform/WebURLLoaderClient.h" |
47 #include "public/platform/WebURLRequest.h" | 47 #include "public/platform/WebURLRequest.h" |
48 #include "public/web/WebDataSource.h" | 48 #include "public/web/WebDataSource.h" |
49 #include "web/WebLocalFrameImpl.h" | 49 #include "web/WebLocalFrameImpl.h" |
50 #include "wtf/HashSet.h" | 50 #include "wtf/HashSet.h" |
51 #include "wtf/text/WTFString.h" | 51 #include "wtf/text/WTFString.h" |
52 | 52 |
53 using namespace WebCore; | 53 using namespace blink; |
54 using namespace WTF; | 54 using namespace WTF; |
55 | 55 |
56 namespace blink { | 56 namespace blink { |
57 | 57 |
58 namespace { | 58 namespace { |
59 | 59 |
60 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { | 60 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { |
61 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); | 61 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); |
62 public: | 62 public: |
63 HTTPRequestHeaderValidator() : m_isSafe(true) { } | 63 HTTPRequestHeaderValidator() : m_isSafe(true) { } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 { | 293 { |
294 ASSERT(m_frameImpl); | 294 ASSERT(m_frameImpl); |
295 } | 295 } |
296 | 296 |
297 AssociatedURLLoader::~AssociatedURLLoader() | 297 AssociatedURLLoader::~AssociatedURLLoader() |
298 { | 298 { |
299 cancel(); | 299 cancel(); |
300 } | 300 } |
301 | 301 |
302 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ | 302 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ |
303 COMPILE_ASSERT(static_cast<int>(blink::webkit_name) == static_cast<int>(WebC
ore::webcore_name), mismatching_enums) | 303 COMPILE_ASSERT(static_cast<int>(blink::webkit_name) == static_cast<int>(blin
k::webcore_name), mismatching_enums) |
304 | 304 |
305 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyDeny,
DenyCrossOriginRequests); | 305 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyDeny,
DenyCrossOriginRequests); |
306 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyUseAcc
essControl, UseAccessControl); | 306 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyUseAcc
essControl, UseAccessControl); |
307 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyAllow,
AllowCrossOriginRequests); | 307 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::CrossOriginRequestPolicyAllow,
AllowCrossOriginRequests); |
308 | 308 |
309 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ConsiderPreflight, ConsiderPre
flight); | 309 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ConsiderPreflight, ConsiderPre
flight); |
310 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ForcePreflight, ForcePreflight
); | 310 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ForcePreflight, ForcePreflight
); |
311 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::PreventPreflight, PreventPrefl
ight); | 311 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::PreventPreflight, PreventPrefl
ight); |
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) |
(...skipping 18 matching lines...) Expand all Loading... |
332 HTTPRequestHeaderValidator validator; | 332 HTTPRequestHeaderValidator validator; |
333 newRequest.visitHTTPHeaderFields(&validator); | 333 newRequest.visitHTTPHeaderFields(&validator); |
334 allowLoad = validator.isSafe(); | 334 allowLoad = validator.isSafe(); |
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.preflightPolicy = static_cast<WebCore::PreflightPolicy>(m_option
s.preflightPolicy); | 342 options.preflightPolicy = static_cast<blink::PreflightPolicy>(m_options.
preflightPolicy); |
343 options.crossOriginRequestPolicy = static_cast<WebCore::CrossOriginReque
stPolicy>(m_options.crossOriginRequestPolicy); | 343 options.crossOriginRequestPolicy = static_cast<blink::CrossOriginRequest
Policy>(m_options.crossOriginRequestPolicy); |
344 | 344 |
345 ResourceLoaderOptions resourceLoaderOptions; | 345 ResourceLoaderOptions resourceLoaderOptions; |
346 resourceLoaderOptions.sniffContent = m_options.sniffContent ? SniffConte
nt : DoNotSniffContent; | 346 resourceLoaderOptions.sniffContent = m_options.sniffContent ? SniffConte
nt : DoNotSniffContent; |
347 resourceLoaderOptions.allowCredentials = m_options.allowCredentials ? Al
lowStoredCredentials : DoNotAllowStoredCredentials; | 347 resourceLoaderOptions.allowCredentials = m_options.allowCredentials ? Al
lowStoredCredentials : DoNotAllowStoredCredentials; |
348 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData; | 348 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData; |
349 | 349 |
350 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); | 350 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); |
351 if (webcoreRequest.requestContext() == blink::WebURLRequest::RequestCont
extUnspecified) { | 351 if (webcoreRequest.requestContext() == blink::WebURLRequest::RequestCont
extUnspecified) { |
352 // FIXME: We load URLs without setting a TargetType (and therefore a
request context) in several | 352 // FIXME: We load URLs without setting a TargetType (and therefore a
request context) in several |
353 // places in content/ (P2PPortAllocatorSession::AllocateLegacyRelayS
ession, for example). Remove | 353 // places in content/ (P2PPortAllocatorSession::AllocateLegacyRelayS
ession, for example). Remove |
(...skipping 19 matching lines...) Expand all Loading... |
373 m_loader->cancel(); | 373 m_loader->cancel(); |
374 } | 374 } |
375 | 375 |
376 void AssociatedURLLoader::setDefersLoading(bool defersLoading) | 376 void AssociatedURLLoader::setDefersLoading(bool defersLoading) |
377 { | 377 { |
378 if (m_loader) | 378 if (m_loader) |
379 m_loader->setDefersLoading(defersLoading); | 379 m_loader->setDefersLoading(defersLoading); |
380 } | 380 } |
381 | 381 |
382 } // namespace blink | 382 } // namespace blink |
OLD | NEW |