OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013, Intel Corporation | 3 * Copyright (C) 2013, Intel Corporation |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 Result endRead(size_t) override { | 87 Result endRead(size_t) override { |
88 return WebDataConsumerHandle::UnexpectedError; | 88 return WebDataConsumerHandle::UnexpectedError; |
89 } | 89 } |
90 void notify(WebDataConsumerHandle::Client* client) { | 90 void notify(WebDataConsumerHandle::Client* client) { |
91 client->didGetReadable(); | 91 client->didGetReadable(); |
92 } | 92 } |
93 WeakPtrFactory<EmptyDataReader> m_factory; | 93 WeakPtrFactory<EmptyDataReader> m_factory; |
94 }; | 94 }; |
95 | 95 |
96 std::unique_ptr<Reader> obtainReader(Client* client) override { | 96 std::unique_ptr<Reader> obtainReader(Client* client) override { |
97 return makeUnique<EmptyDataReader>(client); | 97 return WTF::makeUnique<EmptyDataReader>(client); |
98 } | 98 } |
99 const char* debugName() const override { return "EmptyDataHandle"; } | 99 const char* debugName() const override { return "EmptyDataHandle"; } |
100 }; | 100 }; |
101 | 101 |
102 // No-CORS requests are allowed for all these contexts, and plugin contexts with | 102 // No-CORS requests are allowed for all these contexts, and plugin contexts with |
103 // private permission when we set skipServiceWorker flag in PepperURLLoaderHost. | 103 // private permission when we set skipServiceWorker flag in PepperURLLoaderHost. |
104 bool IsNoCORSAllowedContext( | 104 bool IsNoCORSAllowedContext( |
105 WebURLRequest::RequestContext context, | 105 WebURLRequest::RequestContext context, |
106 WebURLRequest::SkipServiceWorker skipServiceWorker) { | 106 WebURLRequest::SkipServiceWorker skipServiceWorker) { |
107 switch (context) { | 107 switch (context) { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // We use |m_redirectMode| to check the original redirect mode. |request| is | 505 // We use |m_redirectMode| to check the original redirect mode. |request| is |
506 // a new request for redirect. So we don't set the redirect mode of it in | 506 // a new request for redirect. So we don't set the redirect mode of it in |
507 // WebURLLoaderImpl::Context::OnReceivedRedirect(). | 507 // WebURLLoaderImpl::Context::OnReceivedRedirect(). |
508 DCHECK(request.useStreamOnResponse()); | 508 DCHECK(request.useStreamOnResponse()); |
509 // There is no need to read the body of redirect response because there is | 509 // There is no need to read the body of redirect response because there is |
510 // no way to read the body of opaque-redirect filtered response's internal | 510 // no way to read the body of opaque-redirect filtered response's internal |
511 // response. | 511 // response. |
512 // TODO(horo): If we support any API which expose the internal body, we will | 512 // TODO(horo): If we support any API which expose the internal body, we will |
513 // have to read the body. And also HTTPCache changes will be needed because | 513 // have to read the body. And also HTTPCache changes will be needed because |
514 // it doesn't store the body of redirect responses. | 514 // it doesn't store the body of redirect responses. |
515 responseReceived(resource, redirectResponse, makeUnique<EmptyDataHandle>()); | 515 responseReceived(resource, redirectResponse, |
| 516 WTF::makeUnique<EmptyDataHandle>()); |
516 | 517 |
517 if (m_client) { | 518 if (m_client) { |
518 DCHECK(m_actualRequest.isNull()); | 519 DCHECK(m_actualRequest.isNull()); |
519 notifyFinished(resource); | 520 notifyFinished(resource); |
520 } | 521 } |
521 | 522 |
522 return false; | 523 return false; |
523 } | 524 } |
524 | 525 |
525 if (m_redirectMode == WebURLRequest::FetchRedirectModeError) { | 526 if (m_redirectMode == WebURLRequest::FetchRedirectModeError) { |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 } | 715 } |
715 | 716 |
716 if (m_actualRequest.isExternalRequest() && | 717 if (m_actualRequest.isExternalRequest() && |
717 !passesExternalPreflightCheck(response, accessControlErrorDescription)) { | 718 !passesExternalPreflightCheck(response, accessControlErrorDescription)) { |
718 handlePreflightFailure(response.url().getString(), | 719 handlePreflightFailure(response.url().getString(), |
719 accessControlErrorDescription); | 720 accessControlErrorDescription); |
720 return; | 721 return; |
721 } | 722 } |
722 | 723 |
723 std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult = | 724 std::unique_ptr<CrossOriginPreflightResultCacheItem> preflightResult = |
724 wrapUnique( | 725 WTF::wrapUnique( |
725 new CrossOriginPreflightResultCacheItem(effectiveAllowCredentials())); | 726 new CrossOriginPreflightResultCacheItem(effectiveAllowCredentials())); |
726 if (!preflightResult->parse(response, accessControlErrorDescription) || | 727 if (!preflightResult->parse(response, accessControlErrorDescription) || |
727 !preflightResult->allowsCrossOriginMethod( | 728 !preflightResult->allowsCrossOriginMethod( |
728 m_actualRequest.httpMethod(), accessControlErrorDescription) || | 729 m_actualRequest.httpMethod(), accessControlErrorDescription) || |
729 !preflightResult->allowsCrossOriginHeaders( | 730 !preflightResult->allowsCrossOriginHeaders( |
730 m_actualRequest.httpHeaderFields(), accessControlErrorDescription)) { | 731 m_actualRequest.httpHeaderFields(), accessControlErrorDescription)) { |
731 handlePreflightFailure(response.url().getString(), | 732 handlePreflightFailure(response.url().getString(), |
732 accessControlErrorDescription); | 733 accessControlErrorDescription); |
733 return; | 734 return; |
734 } | 735 } |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 } | 1116 } |
1116 | 1117 |
1117 DEFINE_TRACE(DocumentThreadableLoader) { | 1118 DEFINE_TRACE(DocumentThreadableLoader) { |
1118 visitor->trace(m_resource); | 1119 visitor->trace(m_resource); |
1119 visitor->trace(m_document); | 1120 visitor->trace(m_document); |
1120 ThreadableLoader::trace(visitor); | 1121 ThreadableLoader::trace(visitor); |
1121 RawResourceClient::trace(visitor); | 1122 RawResourceClient::trace(visitor); |
1122 } | 1123 } |
1123 | 1124 |
1124 } // namespace blink | 1125 } // namespace blink |
OLD | NEW |