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 <algorithm> | 5 #include <algorithm> |
6 #include <iterator> | 6 #include <iterator> |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 return image_map_.find(mime_type) != image_map_.end(); | 511 return image_map_.find(mime_type) != image_map_.end(); |
512 } | 512 } |
513 | 513 |
514 bool MimeUtil::IsSupportedMediaMimeType(const std::string& mime_type) const { | 514 bool MimeUtil::IsSupportedMediaMimeType(const std::string& mime_type) const { |
515 return media_map_.find(mime_type) != media_map_.end(); | 515 return media_map_.find(mime_type) != media_map_.end(); |
516 } | 516 } |
517 | 517 |
518 bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { | 518 bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { |
519 return non_image_map_.find(mime_type) != non_image_map_.end() || | 519 return non_image_map_.find(mime_type) != non_image_map_.end() || |
520 (mime_type.compare(0, 5, "text/") == 0 && | 520 (mime_type.compare(0, 5, "text/") == 0 && |
521 !IsUnsupportedTextMimeType(mime_type)); | 521 !IsUnsupportedTextMimeType(mime_type)) || |
522 (mime_type.compare(0, 12, "application/") == 0 && | |
523 MatchesMimeType("application/*+json", mime_type)); | |
abarth-chromium
2013/12/01 23:02:32
Is this how we check for +xml as well?
sof
2013/12/02 06:28:58
Good question; there is no generic check for "xml
| |
522 } | 524 } |
523 | 525 |
524 bool MimeUtil::IsUnsupportedTextMimeType(const std::string& mime_type) const { | 526 bool MimeUtil::IsUnsupportedTextMimeType(const std::string& mime_type) const { |
525 return unsupported_text_map_.find(mime_type) != unsupported_text_map_.end(); | 527 return unsupported_text_map_.find(mime_type) != unsupported_text_map_.end(); |
526 } | 528 } |
527 | 529 |
528 bool MimeUtil::IsSupportedJavascriptMimeType( | 530 bool MimeUtil::IsSupportedJavascriptMimeType( |
529 const std::string& mime_type) const { | 531 const std::string& mime_type) const { |
530 return javascript_map_.find(mime_type) != javascript_map_.end(); | 532 return javascript_map_.find(mime_type) != javascript_map_.end(); |
531 } | 533 } |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1015 post_data->append("\r\n" + value + "\r\n"); | 1017 post_data->append("\r\n" + value + "\r\n"); |
1016 } | 1018 } |
1017 | 1019 |
1018 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, | 1020 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
1019 std::string* post_data) { | 1021 std::string* post_data) { |
1020 DCHECK(post_data); | 1022 DCHECK(post_data); |
1021 post_data->append("--" + mime_boundary + "--\r\n"); | 1023 post_data->append("--" + mime_boundary + "--\r\n"); |
1022 } | 1024 } |
1023 | 1025 |
1024 } // namespace net | 1026 } // namespace net |
OLD | NEW |