OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "platform/network/HTTPParsers.h" | 68 #include "platform/network/HTTPParsers.h" |
69 #include "platform/plugins/PluginData.h" | 69 #include "platform/plugins/PluginData.h" |
70 #include "platform/weborigin/SchemeRegistry.h" | 70 #include "platform/weborigin/SchemeRegistry.h" |
71 #include "platform/weborigin/SecurityPolicy.h" | 71 #include "platform/weborigin/SecurityPolicy.h" |
72 #include "public/platform/Platform.h" | 72 #include "public/platform/Platform.h" |
73 #include "public/platform/WebDocumentSubresourceFilter.h" | 73 #include "public/platform/WebDocumentSubresourceFilter.h" |
74 #include "public/platform/WebMimeRegistry.h" | 74 #include "public/platform/WebMimeRegistry.h" |
75 #include "wtf/Assertions.h" | 75 #include "wtf/Assertions.h" |
76 #include "wtf/TemporaryChange.h" | 76 #include "wtf/TemporaryChange.h" |
77 #include "wtf/text/WTFString.h" | 77 #include "wtf/text/WTFString.h" |
| 78 #include <memory> |
78 | 79 |
79 namespace blink { | 80 namespace blink { |
80 | 81 |
81 static bool isArchiveMIMEType(const String& mimeType) | 82 static bool isArchiveMIMEType(const String& mimeType) |
82 { | 83 { |
83 return equalIgnoringCase("multipart/related", mimeType); | 84 return equalIgnoringCase("multipart/related", mimeType); |
84 } | 85 } |
85 | 86 |
86 static bool shouldInheritSecurityOriginFromOwner(const KURL& url) | 87 static bool shouldInheritSecurityOriginFromOwner(const KURL& url) |
87 { | 88 { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 const ResourceRequest& DocumentLoader::request() const | 159 const ResourceRequest& DocumentLoader::request() const |
159 { | 160 { |
160 return m_request; | 161 return m_request; |
161 } | 162 } |
162 | 163 |
163 const KURL& DocumentLoader::url() const | 164 const KURL& DocumentLoader::url() const |
164 { | 165 { |
165 return m_request.url(); | 166 return m_request.url(); |
166 } | 167 } |
167 | 168 |
168 void DocumentLoader::setSubresourceFilter(PassOwnPtr<WebDocumentSubresourceFilte
r> subresourceFilter) | 169 void DocumentLoader::setSubresourceFilter(std::unique_ptr<WebDocumentSubresource
Filter> subresourceFilter) |
169 { | 170 { |
170 m_subresourceFilter = std::move(subresourceFilter); | 171 m_subresourceFilter = std::move(subresourceFilter); |
171 } | 172 } |
172 | 173 |
173 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
t) | 174 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
t) |
174 { | 175 { |
175 Resource* resource = nullptr; | 176 Resource* resource = nullptr; |
176 switch (type) { | 177 switch (type) { |
177 case Resource::Image: | 178 case Resource::Image: |
178 resource = ImageResource::fetch(request, fetcher()); | 179 resource = ImageResource::fetch(request, fetcher()); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 setWasBlockedAfterXFrameOptionsOrCSP(); | 364 setWasBlockedAfterXFrameOptionsOrCSP(); |
364 | 365 |
365 // Pretend that this was an empty HTTP 200 response. | 366 // Pretend that this was an empty HTTP 200 response. |
366 clearMainResourceHandle(); | 367 clearMainResourceHandle(); |
367 m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String()
); | 368 m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String()
); |
368 finishedLoading(monotonicallyIncreasingTime()); | 369 finishedLoading(monotonicallyIncreasingTime()); |
369 | 370 |
370 return; | 371 return; |
371 } | 372 } |
372 | 373 |
373 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
& response, PassOwnPtr<WebDataConsumerHandle> handle) | 374 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
& response, std::unique_ptr<WebDataConsumerHandle> handle) |
374 { | 375 { |
375 ASSERT_UNUSED(resource, m_mainResource == resource); | 376 ASSERT_UNUSED(resource, m_mainResource == resource); |
376 ASSERT_UNUSED(handle, !handle); | 377 ASSERT_UNUSED(handle, !handle); |
377 ASSERT(frame()); | 378 ASSERT(frame()); |
378 | 379 |
379 m_applicationCacheHost->didReceiveResponseForMainResource(response); | 380 m_applicationCacheHost->didReceiveResponseForMainResource(response); |
380 | 381 |
381 // The memory cache doesn't understand the application cache or its caching
rules. So if a main resource is served | 382 // The memory cache doesn't understand the application cache or its caching
rules. So if a main resource is served |
382 // from the application cache, ensure we don't save the result for future us
e. All responses loaded | 383 // from the application cache, ensure we don't save the result for future us
e. All responses loaded |
383 // from appcache will have a non-zero appCacheID(). | 384 // from appcache will have a non-zero appCacheID(). |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 { | 691 { |
691 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); | 692 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); |
692 if (!source.isNull()) | 693 if (!source.isNull()) |
693 m_writer->appendReplacingData(source); | 694 m_writer->appendReplacingData(source); |
694 endWriting(m_writer.get()); | 695 endWriting(m_writer.get()); |
695 } | 696 } |
696 | 697 |
697 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 698 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
698 | 699 |
699 } // namespace blink | 700 } // namespace blink |
OLD | NEW |