| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/web_url_request_util.h" | 5 #include "content/child/web_url_request_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 request.frameType() == WebURLRequest::FrameTypeAuxiliary) { | 80 request.frameType() == WebURLRequest::FrameTypeAuxiliary) { |
| 81 return RESOURCE_TYPE_MAIN_FRAME; | 81 return RESOURCE_TYPE_MAIN_FRAME; |
| 82 } | 82 } |
| 83 if (request.frameType() == WebURLRequest::FrameTypeNested) | 83 if (request.frameType() == WebURLRequest::FrameTypeNested) |
| 84 return RESOURCE_TYPE_SUB_FRAME; | 84 return RESOURCE_TYPE_SUB_FRAME; |
| 85 NOTREACHED(); | 85 NOTREACHED(); |
| 86 return RESOURCE_TYPE_SUB_RESOURCE; | 86 return RESOURCE_TYPE_SUB_RESOURCE; |
| 87 } | 87 } |
| 88 | 88 |
| 89 switch (requestContext) { | 89 switch (requestContext) { |
| 90 // CSP report |
| 91 case WebURLRequest::RequestContextCSPReport: |
| 92 return RESOURCE_TYPE_CSP_REPORT; |
| 93 |
| 90 // Favicon | 94 // Favicon |
| 91 case WebURLRequest::RequestContextFavicon: | 95 case WebURLRequest::RequestContextFavicon: |
| 92 return RESOURCE_TYPE_FAVICON; | 96 return RESOURCE_TYPE_FAVICON; |
| 93 | 97 |
| 94 // Font | 98 // Font |
| 95 case WebURLRequest::RequestContextFont: | 99 case WebURLRequest::RequestContextFont: |
| 96 return RESOURCE_TYPE_FONT_RESOURCE; | 100 return RESOURCE_TYPE_FONT_RESOURCE; |
| 97 | 101 |
| 98 // Image | 102 // Image |
| 99 case WebURLRequest::RequestContextImage: | 103 case WebURLRequest::RequestContextImage: |
| 100 case WebURLRequest::RequestContextImageSet: | 104 case WebURLRequest::RequestContextImageSet: |
| 101 return RESOURCE_TYPE_IMAGE; | 105 return RESOURCE_TYPE_IMAGE; |
| 102 | 106 |
| 103 // Media | 107 // Media |
| 104 case WebURLRequest::RequestContextAudio: | 108 case WebURLRequest::RequestContextAudio: |
| 105 case WebURLRequest::RequestContextVideo: | 109 case WebURLRequest::RequestContextVideo: |
| 106 return RESOURCE_TYPE_MEDIA; | 110 return RESOURCE_TYPE_MEDIA; |
| 107 | 111 |
| 108 // Object | 112 // Object |
| 109 case WebURLRequest::RequestContextEmbed: | 113 case WebURLRequest::RequestContextEmbed: |
| 110 case WebURLRequest::RequestContextObject: | 114 case WebURLRequest::RequestContextObject: |
| 111 return RESOURCE_TYPE_OBJECT; | 115 return RESOURCE_TYPE_OBJECT; |
| 112 | 116 |
| 113 // Ping | 117 // Ping |
| 114 case WebURLRequest::RequestContextBeacon: | 118 case WebURLRequest::RequestContextBeacon: |
| 115 case WebURLRequest::RequestContextCSPReport: | |
| 116 case WebURLRequest::RequestContextPing: | 119 case WebURLRequest::RequestContextPing: |
| 117 return RESOURCE_TYPE_PING; | 120 return RESOURCE_TYPE_PING; |
| 118 | 121 |
| 122 // Subresource of plugins |
| 123 case WebURLRequest::RequestContextPlugin: |
| 124 return RESOURCE_TYPE_PLUGIN_RESOURCE; |
| 125 |
| 119 // Prefetch | 126 // Prefetch |
| 120 case WebURLRequest::RequestContextPrefetch: | 127 case WebURLRequest::RequestContextPrefetch: |
| 121 return RESOURCE_TYPE_PREFETCH; | 128 return RESOURCE_TYPE_PREFETCH; |
| 122 | 129 |
| 123 // Script | 130 // Script |
| 124 case WebURLRequest::RequestContextImport: | 131 case WebURLRequest::RequestContextImport: |
| 125 case WebURLRequest::RequestContextScript: | 132 case WebURLRequest::RequestContextScript: |
| 126 return RESOURCE_TYPE_SCRIPT; | 133 return RESOURCE_TYPE_SCRIPT; |
| 127 | 134 |
| 128 // Style | 135 // Style |
| 129 case WebURLRequest::RequestContextXSLT: | 136 case WebURLRequest::RequestContextXSLT: |
| 130 case WebURLRequest::RequestContextStyle: | 137 case WebURLRequest::RequestContextStyle: |
| 131 return RESOURCE_TYPE_STYLESHEET; | 138 return RESOURCE_TYPE_STYLESHEET; |
| 132 | 139 |
| 133 // Subresource | 140 // Subresource |
| 134 case WebURLRequest::RequestContextDownload: | 141 case WebURLRequest::RequestContextDownload: |
| 135 case WebURLRequest::RequestContextManifest: | 142 case WebURLRequest::RequestContextManifest: |
| 136 case WebURLRequest::RequestContextSubresource: | 143 case WebURLRequest::RequestContextSubresource: |
| 137 case WebURLRequest::RequestContextPlugin: | |
| 138 return RESOURCE_TYPE_SUB_RESOURCE; | 144 return RESOURCE_TYPE_SUB_RESOURCE; |
| 139 | 145 |
| 140 // TextTrack | 146 // TextTrack |
| 141 case WebURLRequest::RequestContextTrack: | 147 case WebURLRequest::RequestContextTrack: |
| 142 return RESOURCE_TYPE_MEDIA; | 148 return RESOURCE_TYPE_MEDIA; |
| 143 | 149 |
| 144 // Workers | 150 // Workers |
| 145 case WebURLRequest::RequestContextServiceWorker: | 151 case WebURLRequest::RequestContextServiceWorker: |
| 146 return RESOURCE_TYPE_SERVICE_WORKER; | 152 return RESOURCE_TYPE_SERVICE_WORKER; |
| 147 case WebURLRequest::RequestContextSharedWorker: | 153 case WebURLRequest::RequestContextSharedWorker: |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 bool stale_copy_in_cache, | 440 bool stale_copy_in_cache, |
| 435 int reason, | 441 int reason, |
| 436 bool was_ignored_by_handler) { | 442 bool was_ignored_by_handler) { |
| 437 blink::WebURLError error = | 443 blink::WebURLError error = |
| 438 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 444 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
| 439 error.wasIgnoredByHandler = was_ignored_by_handler; | 445 error.wasIgnoredByHandler = was_ignored_by_handler; |
| 440 return error; | 446 return error; |
| 441 } | 447 } |
| 442 | 448 |
| 443 } // namespace content | 449 } // namespace content |
| OLD | NEW |