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> | |
79 | 78 |
80 namespace blink { | 79 namespace blink { |
81 | 80 |
82 static bool isArchiveMIMEType(const String& mimeType) | 81 static bool isArchiveMIMEType(const String& mimeType) |
83 { | 82 { |
84 return equalIgnoringCase("multipart/related", mimeType); | 83 return equalIgnoringCase("multipart/related", mimeType); |
85 } | 84 } |
86 | 85 |
87 static bool shouldInheritSecurityOriginFromOwner(const KURL& url) | 86 static bool shouldInheritSecurityOriginFromOwner(const KURL& url) |
88 { | 87 { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const ResourceRequest& DocumentLoader::request() const | 158 const ResourceRequest& DocumentLoader::request() const |
160 { | 159 { |
161 return m_request; | 160 return m_request; |
162 } | 161 } |
163 | 162 |
164 const KURL& DocumentLoader::url() const | 163 const KURL& DocumentLoader::url() const |
165 { | 164 { |
166 return m_request.url(); | 165 return m_request.url(); |
167 } | 166 } |
168 | 167 |
169 void DocumentLoader::setSubresourceFilter(std::unique_ptr<WebDocumentSubresource
Filter> subresourceFilter) | 168 void DocumentLoader::setSubresourceFilter(PassOwnPtr<WebDocumentSubresourceFilte
r> subresourceFilter) |
170 { | 169 { |
171 m_subresourceFilter = std::move(subresourceFilter); | 170 m_subresourceFilter = std::move(subresourceFilter); |
172 } | 171 } |
173 | 172 |
174 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
t) | 173 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
t) |
175 { | 174 { |
176 Resource* resource = nullptr; | 175 Resource* resource = nullptr; |
177 switch (type) { | 176 switch (type) { |
178 case Resource::Image: | 177 case Resource::Image: |
179 resource = ImageResource::fetch(request, fetcher()); | 178 resource = ImageResource::fetch(request, fetcher()); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 setWasBlockedAfterXFrameOptionsOrCSP(); | 363 setWasBlockedAfterXFrameOptionsOrCSP(); |
365 | 364 |
366 // Pretend that this was an empty HTTP 200 response. | 365 // Pretend that this was an empty HTTP 200 response. |
367 clearMainResourceHandle(); | 366 clearMainResourceHandle(); |
368 m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String()
); | 367 m_response = ResourceResponse(blankURL(), "text/html", 0, nullAtom, String()
); |
369 finishedLoading(monotonicallyIncreasingTime()); | 368 finishedLoading(monotonicallyIncreasingTime()); |
370 | 369 |
371 return; | 370 return; |
372 } | 371 } |
373 | 372 |
374 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
& response, std::unique_ptr<WebDataConsumerHandle> handle) | 373 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
& response, PassOwnPtr<WebDataConsumerHandle> handle) |
375 { | 374 { |
376 ASSERT_UNUSED(resource, m_mainResource == resource); | 375 ASSERT_UNUSED(resource, m_mainResource == resource); |
377 ASSERT_UNUSED(handle, !handle); | 376 ASSERT_UNUSED(handle, !handle); |
378 ASSERT(frame()); | 377 ASSERT(frame()); |
379 | 378 |
380 m_applicationCacheHost->didReceiveResponseForMainResource(response); | 379 m_applicationCacheHost->didReceiveResponseForMainResource(response); |
381 | 380 |
382 // The memory cache doesn't understand the application cache or its caching
rules. So if a main resource is served | 381 // The memory cache doesn't understand the application cache or its caching
rules. So if a main resource is served |
383 // from the application cache, ensure we don't save the result for future us
e. All responses loaded | 382 // from the application cache, ensure we don't save the result for future us
e. All responses loaded |
384 // from appcache will have a non-zero appCacheID(). | 383 // from appcache will have a non-zero appCacheID(). |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 { | 690 { |
692 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); | 691 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); |
693 if (!source.isNull()) | 692 if (!source.isNull()) |
694 m_writer->appendReplacingData(source); | 693 m_writer->appendReplacingData(source); |
695 endWriting(m_writer.get()); | 694 endWriting(m_writer.get()); |
696 } | 695 } |
697 | 696 |
698 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 697 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
699 | 698 |
700 } // namespace blink | 699 } // namespace blink |
OLD | NEW |