| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // Mirrors WebViewImpl::CanShowMIMEType() | 378 // Mirrors WebViewImpl::CanShowMIMEType() |
| 379 bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { | 379 bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { |
| 380 return (mime_type.compare(0, 6, "image/") == 0 && | 380 return (mime_type.compare(0, 6, "image/") == 0 && |
| 381 IsSupportedImageMimeType(mime_type.c_str())) || | 381 IsSupportedImageMimeType(mime_type.c_str())) || |
| 382 IsSupportedNonImageMimeType(mime_type.c_str()); | 382 IsSupportedNonImageMimeType(mime_type.c_str()); |
| 383 } | 383 } |
| 384 | 384 |
| 385 bool MimeUtil::MatchesMimeType(const std::string &mime_type_pattern, | 385 bool MimeUtil::MatchesMimeType(const std::string &mime_type_pattern, |
| 386 const std::string &mime_type) const { | 386 const std::string &mime_type) const { |
| 387 // verify caller is passing lowercase | 387 // verify caller is passing lowercase |
| 388 DCHECK(mime_type_pattern == StringToLowerASCII(mime_type_pattern)); | 388 DCHECK_EQ(StringToLowerASCII(mime_type_pattern), mime_type_pattern); |
| 389 DCHECK(mime_type == StringToLowerASCII(mime_type)); | 389 DCHECK_EQ(StringToLowerASCII(mime_type), mime_type); |
| 390 | 390 |
| 391 // This comparison handles absolute maching and also basic | 391 // This comparison handles absolute maching and also basic |
| 392 // wildcards. The plugin mime types could be: | 392 // wildcards. The plugin mime types could be: |
| 393 // application/x-foo | 393 // application/x-foo |
| 394 // application/* | 394 // application/* |
| 395 // application/*+xml | 395 // application/*+xml |
| 396 // * | 396 // * |
| 397 if (mime_type_pattern.empty()) | 397 if (mime_type_pattern.empty()) |
| 398 return false; | 398 return false; |
| 399 | 399 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 GetExtensionsFromHardCodedMappings(secondary_mappings, | 708 GetExtensionsFromHardCodedMappings(secondary_mappings, |
| 709 arraysize(secondary_mappings), | 709 arraysize(secondary_mappings), |
| 710 mime_type, | 710 mime_type, |
| 711 &unique_extensions); | 711 &unique_extensions); |
| 712 | 712 |
| 713 HashSetToVector(&unique_extensions, extensions); | 713 HashSetToVector(&unique_extensions, extensions); |
| 714 } | 714 } |
| 715 | 715 |
| 716 } // namespace net | 716 } // namespace net |
| OLD | NEW |