| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "net/base/mime_util.h" | 8 #include "net/base/mime_util.h" |
| 9 #include "net/base/platform_mime_util.h" | 9 #include "net/base/platform_mime_util.h" |
| 10 | 10 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // So, by including "text/css" into this list we choose Firefox | 329 // So, by including "text/css" into this list we choose Firefox |
| 330 // behavior - css files will be displayed: | 330 // behavior - css files will be displayed: |
| 331 "text/css", | 331 "text/css", |
| 332 "text/vnd.chromium.ftp-dir", | 332 "text/vnd.chromium.ftp-dir", |
| 333 "text/", | 333 "text/", |
| 334 "image/svg+xml", // SVG is text-based XML, even though it has an image/ type | 334 "image/svg+xml", // SVG is text-based XML, even though it has an image/ type |
| 335 "application/xml", | 335 "application/xml", |
| 336 "application/xhtml+xml", | 336 "application/xhtml+xml", |
| 337 "application/json", | 337 "application/json", |
| 338 "application/x-x509-user-cert", | 338 "application/x-x509-user-cert", |
| 339 #if defined(OS_ANDROID) |
| 340 "application/x-x509-ca-cert", |
| 341 "application/x-pkcs12", |
| 342 #endif |
| 339 "multipart/related", // For MHTML support. | 343 "multipart/related", // For MHTML support. |
| 340 "multipart/x-mixed-replace" | 344 "multipart/x-mixed-replace" |
| 341 // Note: ADDING a new type here will probably render it AS HTML. This can | 345 // Note: ADDING a new type here will probably render it AS HTML. This can |
| 342 // result in cross site scripting. | 346 // result in cross site scripting. |
| 343 }; | 347 }; |
| 344 | 348 |
| 345 // These types are excluded from the logic that allows all text/ types because | 349 // These types are excluded from the logic that allows all text/ types because |
| 346 // while they are technically text, it's very unlikely that a user expects to | 350 // while they are technically text, it's very unlikely that a user expects to |
| 347 // see them rendered in text form. | 351 // see them rendered in text form. |
| 348 static const char* const unsupported_text_types[] = { | 352 static const char* const unsupported_text_types[] = { |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 const std::string GetIANAMediaType(const std::string& mime_type) { | 918 const std::string GetIANAMediaType(const std::string& mime_type) { |
| 915 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { | 919 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { |
| 916 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { | 920 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { |
| 917 return kIanaMediaTypes[i].name; | 921 return kIanaMediaTypes[i].name; |
| 918 } | 922 } |
| 919 } | 923 } |
| 920 return ""; | 924 return ""; |
| 921 } | 925 } |
| 922 | 926 |
| 923 } // namespace net | 927 } // namespace net |
| OLD | NEW |